qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/1] Add -version-simple argument, printing onl


From: Blue Swirl
Subject: Re: [Qemu-devel] [PATCH 1/1] Add -version-simple argument, printing only version number.
Date: Thu, 13 May 2010 22:30:12 +0300

On 5/13/10, Daniel P. Berrange <address@hidden> wrote:
> On Thu, May 13, 2010 at 10:32:52AM +0200, address@hidden wrote:
>  > From: Jes Sorensen <address@hidden>
>  >
>  > Add -version-simple argument for QEMU, printing just the version
>  > number, without any supporting text.
>  >
>  > This makes it simpler for other apps, such as libvirt, to parse the
>  > version string from QEMU independant of how the naming string may
>  > change.
>  >
>  > Signed-off-by: Jes Sorensen <address@hidden>
>  > ---
>  >  qemu-options.hx |    8 ++++++++
>  >  vl.c            |    9 +++++++++
>  >  2 files changed, 17 insertions(+), 0 deletions(-)
>  >
>  > diff --git a/qemu-options.hx b/qemu-options.hx
>  > index 12f6b51..e4f3979 100644
>  > --- a/qemu-options.hx
>  > +++ b/qemu-options.hx
>  > @@ -27,6 +27,14 @@ STEXI
>  >  Display version information and exit
>  >  ETEXI
>  >
>  > +DEF("version-simple", 0, QEMU_OPTION_version_simple,
>  > +    "-version-simple display version information and exit\n", 
> QEMU_ARCH_ALL)
>  > +STEXI
>  > address@hidden -version-simple
>  > address@hidden -version-simple
>  > +Display basic version number information and exit
>  > +ETEXI
>  > +
>  >  DEF("M", HAS_ARG, QEMU_OPTION_M,
>  >      "-M machine      select emulated machine (-M ? for list)\n", 
> QEMU_ARCH_ALL)
>  >  STEXI
>  > diff --git a/vl.c b/vl.c
>  > index 85bcc84..5adca87 100644
>  > --- a/vl.c
>  > +++ b/vl.c
>  > @@ -2015,6 +2015,11 @@ static void version(void)
>  >      printf("QEMU emulator version " QEMU_VERSION QEMU_PKGVERSION ", 
> Copyright (c) 2003-2008 Fabrice Bellard\n");
>  >  }
>  >
>  > +static void version_simple(void)
>  > +{
>  > +    printf(QEMU_VERSION QEMU_PKGVERSION "\n");
>  > +}
>  > +
>  >  static void help(int exitcode)
>  >  {
>  >      const char *options_help =
>  > @@ -2960,6 +2965,10 @@ int main(int argc, char **argv, char **envp)
>  >                  version();
>  >                  exit(0);
>  >                  break;
>  > +            case QEMU_OPTION_version_simple:
>  > +                version_simple();
>  > +                exit(0);
>  > +                break;
>  >              case QEMU_OPTION_m: {
>  >                  uint64_t value;
>  >                  char *ptr;
>
>
> This omits the KVM version string which is something we also want to see.
>  It would also be nice to avoid having to parse the -help output to determine
>  ARGV supported too. I wonder if it would be a good idea to just produce a
>  well structured equivalent to -help that provides the same data, but in
>  JSON format for sane parsing. That would let peple easily determine the
>  supported ARGV as well as version number(s)

Perhaps QMP could be used to dump the same information, something
equivalent to monitor command 'info argv'.

Otherwise, I'd suggest to use a name with 'machine' or 'json' in it,
like -QEMU-machine-protocol-info-argv, or -get-json-info-argv.

Still, -version-simple may be useful for shell scripting etc.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]