From: Luiz Capitulino <lcapitulino@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>
Cc: Eric Blake <eblake@redhat.com>,
qemu-devel@nongnu.org, Markus Armbruster <armbru@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] Add 'query-events' command to QMP to query async events
Date: Wed, 16 May 2012 13:45:21 -0300 [thread overview]
Message-ID: <20120516134521.7fd7fecb@doriath.home> (raw)
In-Reply-To: <4FB3D34E.2090802@codemonkey.ws>
On Wed, 16 May 2012 11:18:22 -0500
Anthony Liguori <anthony@codemonkey.ws> wrote:
> On 05/16/2012 11:04 AM, Eric Blake wrote:
> > On 05/16/2012 06:55 AM, Daniel P. Berrange wrote:
> >> From: "Daniel P. Berrange"<berrange@redhat.com>
> >>
> >> Sometimes it is neccessary for an application to determine
> >> whether a particular QMP event is available, so they can
> >> decide whether to use compatibility code instead. This
> >> introduces a new 'query-events' command to QMP todo just
> >
> > s/todo/to do/
> >
> >> that
> >>
> >> { "execute": "query-events" }
> >> {"return": [{"name": "WAKEUP"},
> >> {"name": "SUSPEND"},
> >> {"name": "DEVICE_TRAY_MOVED"},
> >> {"name": "BLOCK_JOB_CANCELLED"},
> >> {"name": "BLOCK_JOB_COMPLETED"},
> >> ...snip...
> >> {"name": "SHUTDOWN"}]}
> >>
> >> * monitor.c: Split out MonitorEvent -> string conversion
> >> into monitor_protocol_event_name() API. Add impl of
> >> qmp_query_events monitor command handler
> >> * qapi-schema.json, qmp-commands.hx: Define contract of
> >> query-events command
> >
> > Definitely useful for libvirt.
> >
> >
> >> +static const char *monitor_protocol_event_name(MonitorEvent event)
> >> +{
> >> switch (event) {
> >> case QEVENT_SHUTDOWN:
> >> - event_name = "SHUTDOWN";
> >> + return "SHUTDOWN";
> >> break;
> >
> > These 'break' statements are now unreachable; does this matter in qemu
> > coding style?
>
> Seems like we should just take the opportunity to kill off the function entirely
> and replace it with a table:
>
> static const char *monitor_event_names[] = {
> [QEVENT_SHUTDOWN] = "SHUTDOWN",
> ...
> };
Yes, that's really better.
Btw, the ideal way of having this would be to add the event type to the
qapi and then add schema introspection.
As I'm not sure I can guarantee that for 1.2, I'm ok with this command.
Anthony, I'm assuming you're ok too.
prev parent reply other threads:[~2012-05-16 16:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-05-16 12:55 [Qemu-devel] [PATCH] Add 'query-events' command to QMP to query async events Daniel P. Berrange
2012-05-16 16:04 ` Eric Blake
2012-05-16 16:18 ` Anthony Liguori
2012-05-16 16:20 ` Daniel P. Berrange
2012-05-16 16:45 ` Luiz Capitulino [this message]
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=20120516134521.7fd7fecb@doriath.home \
--to=lcapitulino@redhat.com \
--cc=anthony@codemonkey.ws \
--cc=armbru@redhat.com \
--cc=eblake@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).