From: Luiz Capitulino <lcapitulino@redhat.com>
To: "Daniel P. Berrange" <berrange@redhat.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qapi: add 'query-target' command to return target arch/bit size
Date: Tue, 21 Aug 2012 09:53:55 -0300 [thread overview]
Message-ID: <20120821095355.6f7a59df@doriath.home> (raw)
In-Reply-To: <20120821100750.GG7982@redhat.com>
On Tue, 21 Aug 2012 11:07:50 +0100
"Daniel P. Berrange" <berrange@redhat.com> wrote:
> On Mon, Aug 20, 2012 at 04:02:39PM -0300, Luiz Capitulino wrote:
> > On Mon, 20 Aug 2012 15:31:38 +0100
> > "Daniel P. Berrange" <berrange@redhat.com> wrote:
> >
> > > From: "Daniel P. Berrange" <berrange@redhat.com>
> > >
> > > Add a 'query-target' QAPI command to allow management applications
> > > to determine what target architecture a QEMU binary is emulating
> > > without having to parse the binary name or -help output
> > >
> > > $ qmp-shell -p /tmp/qemu
> > > (QEMU) query-target
> > > { u'return': { u'arch': u'x86_64', u'bits': 64}}
> > >
> > > Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
> > > ---
> > > arch_init.c | 11 +++++++++++
> > > qapi-schema.json | 25 +++++++++++++++++++++++++
> > > qmp-commands.hx | 5 +++++
> > > 3 files changed, 41 insertions(+)
> > >
> > > diff --git a/arch_init.c b/arch_init.c
> > > index 9b46bfc..095672d 100644
> > > --- a/arch_init.c
> > > +++ b/arch_init.c
> > > @@ -1080,3 +1080,14 @@ int xen_available(void)
> > > return 0;
> > > #endif
> > > }
> > > +
> > > +
> > > +TargetInfo *qmp_query_target(Error **errp)
> > > +{
> > > + TargetInfo *info = g_malloc0(sizeof(*info));
> > > +
> > > + info->arch = g_strdup(TARGET_ARCH);
> > > + info->bits = TARGET_PHYS_ADDR_BITS;
> > > +
> > > + return info;
> > > +}
> > > diff --git a/qapi-schema.json b/qapi-schema.json
> > > index 3d2b2d1..f0e3fe0 100644
> > > --- a/qapi-schema.json
> > > +++ b/qapi-schema.json
> > > @@ -2454,3 +2454,28 @@
> > > #
> > > ##
> > > { 'command': 'query-fdsets', 'returns': ['FdsetInfo'] }
> > > +
> > > +##
> > > +# @TargetInfo:
> > > +#
> > > +# Information describing the QEMU target.
> > > +#
> > > +# @arch: the name of the target architecture (eg "x86_64", "i686", etc)
> >
> > Should be an enum, otherwise looks good.
>
> Really ? It feels a little bit odd to make this an enum IMHO.
I don't think it's odd. We should avoid using free-form strings when
the set of possible values a command returns is limited and known.
The only small issue I see though, is that TARGET_ARCH is defined in
configure, so you'll have to add something like CONFIG_TARGET_ENUM there too
(although we could probably kill TARGET_ARCH and use the strings generated
by the qapi, but this might end resulting too much work for the hard-freeze).
next prev parent reply other threads:[~2012-08-21 12:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-20 14:31 [Qemu-devel] [PATCH] qapi: add 'query-target' command to return target arch/bit size Daniel P. Berrange
2012-08-20 15:47 ` [Qemu-devel] For 1.2: " Eric Blake
2012-08-20 19:02 ` [Qemu-devel] " Luiz Capitulino
2012-08-21 10:07 ` Daniel P. Berrange
2012-08-21 12:53 ` Luiz Capitulino [this message]
2012-08-21 13:07 ` Daniel P. Berrange
2012-08-22 13:20 ` Anthony Liguori
2012-08-20 21:48 ` Anthony Liguori
2012-08-21 10:05 ` Daniel P. Berrange
2012-08-21 10:17 ` Peter Maydell
2012-08-21 10:24 ` Daniel P. Berrange
2012-08-21 13:21 ` Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20120821095355.6f7a59df@doriath.home \
--to=lcapitulino@redhat.com \
--cc=aliguori@us.ibm.com \
--cc=berrange@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).