qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] Add 'query-events' command to QMP to query asyn


From: Daniel P. Berrange
Subject: Re: [Qemu-devel] [PATCH] Add 'query-events' command to QMP to query async events
Date: Wed, 16 May 2012 17:20:59 +0100
User-agent: Mutt/1.5.21 (2010-09-15)

On Wed, May 16, 2012 at 11:18:22AM -0500, Anthony Liguori 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"<address@hidden>
> >>
> >>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",
>  ...
> };

That sounds good to me, I'll update the patch accordingly.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|



reply via email to

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