On 05/16/2012 06:55 AM, Daniel P. Berrange wrote: > From: "Daniel P. Berrange" > > 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? > +query-events > +-------------- > + > +List QMP available events. > + > +Each event is represented by a json-object, the returned value is a json-array > +of all events. > + > +Each json-object contain: s/contain/contains/ -- Eric Blake eblake@redhat.com +1-919-301-3266 Libvirt virtualization library http://libvirt.org