diff mbox

[4/6] qapi: move event defines to qapi-schema.json

Message ID 1382321765-29052-5-git-send-email-xiawenc@linux.vnet.ibm.com
State New
Headers show

Commit Message

Wayne Xia Oct. 21, 2013, 2:16 a.m. UTC
They are defined with capitals for compatibility, see monitor_event_names
in monitor.c, which was used to set the event strings.

Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
---
 include/monitor/monitor.h |   37 -------------------------------------
 qapi-schema.json          |   37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 37 insertions(+), 37 deletions(-)

Comments

Eric Blake Oct. 21, 2013, 8:45 p.m. UTC | #1
On 10/21/2013 03:16 AM, Wenchao Xia wrote:
> They are defined with capitals for compatibility, see monitor_event_names
> in monitor.c, which was used to set the event strings.

Agree; the existing 'query-events' commands returns all-capital strings.

> 
> Signed-off-by: Wenchao Xia <xiawenc@linux.vnet.ibm.com>
> ---
>  include/monitor/monitor.h |   37 -------------------------------------
>  qapi-schema.json          |   37 +++++++++++++++++++++++++++++++++++++
>  2 files changed, 37 insertions(+), 37 deletions(-)
> 
> -typedef enum QEvent {
> -    Q_EVENT_SHUTDOWN,
> -    Q_EVENT_RESET,
> -    Q_EVENT_POWERDOWN,
> -    Q_EVENT_STOP,
> -    Q_EVENT_RESUME,
> -    Q_EVENT_VNC_CONNECTED,
> -    Q_EVENT_VNC_INITIALIZED,
> -    Q_EVENT_VNC_DISCONNECTED,
> -    Q_EVENT_BLOCK_IO_ERROR,
> -    Q_EVENT_RTC_CHANGE,
> -    Q_EVENT_WATCHDOG,
> -    Q_EVENT_SPICE_CONNECTED,
> -    Q_EVENT_SPICE_INITIALIZED,
> -    Q_EVENT_SPICE_DISCONNECTED,
> -    Q_EVENT_BLOCK_JOB_COMPLETED,
> -    Q_EVENT_BLOCK_JOB_CANCELLED,
> -    Q_EVENT_BLOCK_JOB_ERROR,
> -    Q_EVENT_BLOCK_JOB_READY,
> -    Q_EVENT_DEVICE_DELETED,
> -    Q_EVENT_DEVICE_TRAY_MOVED,
> -    Q_EVENT_NIC_RX_FILTER_CHANGED,
> -    Q_EVENT_SUSPEND,
> -    Q_EVENT_SUSPEND_DISK,
> -    Q_EVENT_WAKEUP,
> -    Q_EVENT_BALLOON_CHANGE,
> -    Q_EVENT_SPICE_MIGRATE_COMPLETED,
> -    Q_EVENT_GUEST_PANICKED,
> -    Q_EVENT_BLOCK_IMAGE_CORRUPTED,
> -
> -    /* Add to 'monitor_event_names' array in monitor.c when
> -     * defining new events here */
> -
> -    Q_EVENT_MAX,
> -} QEvent;
> -
>  int monitor_cur_is_qmp(void);
>  
>  void monitor_protocol_event(QEvent event, QObject *data);
> diff --git a/qapi-schema.json b/qapi-schema.json
> index 60f3fd1..fbc1fab 100644
> --- a/qapi-schema.json
> +++ b/qapi-schema.json
> @@ -29,6 +29,43 @@
>              'DeviceNotActive', 'DeviceNotFound', 'KVMMissingCap' ] }
>  
>  ##
> +# @QEvent

Again, see my comment in 3/6 wondering wheter we should fix the code
generation python to special-case QEVENT when converting this enum into
C code, rather than adding lots of churn.

I see why you split the documentation patch into 6/6 - to let this one
focus on just minimal code motion.
diff mbox

Patch

diff --git a/include/monitor/monitor.h b/include/monitor/monitor.h
index b273c5b..cdbb5b2 100644
--- a/include/monitor/monitor.h
+++ b/include/monitor/monitor.h
@@ -19,43 +19,6 @@  extern Monitor *default_mon;
 /* flags for monitor commands */
 #define MONITOR_CMD_ASYNC       0x0001
 
-/* QMP events */
-typedef enum QEvent {
-    Q_EVENT_SHUTDOWN,
-    Q_EVENT_RESET,
-    Q_EVENT_POWERDOWN,
-    Q_EVENT_STOP,
-    Q_EVENT_RESUME,
-    Q_EVENT_VNC_CONNECTED,
-    Q_EVENT_VNC_INITIALIZED,
-    Q_EVENT_VNC_DISCONNECTED,
-    Q_EVENT_BLOCK_IO_ERROR,
-    Q_EVENT_RTC_CHANGE,
-    Q_EVENT_WATCHDOG,
-    Q_EVENT_SPICE_CONNECTED,
-    Q_EVENT_SPICE_INITIALIZED,
-    Q_EVENT_SPICE_DISCONNECTED,
-    Q_EVENT_BLOCK_JOB_COMPLETED,
-    Q_EVENT_BLOCK_JOB_CANCELLED,
-    Q_EVENT_BLOCK_JOB_ERROR,
-    Q_EVENT_BLOCK_JOB_READY,
-    Q_EVENT_DEVICE_DELETED,
-    Q_EVENT_DEVICE_TRAY_MOVED,
-    Q_EVENT_NIC_RX_FILTER_CHANGED,
-    Q_EVENT_SUSPEND,
-    Q_EVENT_SUSPEND_DISK,
-    Q_EVENT_WAKEUP,
-    Q_EVENT_BALLOON_CHANGE,
-    Q_EVENT_SPICE_MIGRATE_COMPLETED,
-    Q_EVENT_GUEST_PANICKED,
-    Q_EVENT_BLOCK_IMAGE_CORRUPTED,
-
-    /* Add to 'monitor_event_names' array in monitor.c when
-     * defining new events here */
-
-    Q_EVENT_MAX,
-} QEvent;
-
 int monitor_cur_is_qmp(void);
 
 void monitor_protocol_event(QEvent event, QObject *data);
diff --git a/qapi-schema.json b/qapi-schema.json
index 60f3fd1..fbc1fab 100644
--- a/qapi-schema.json
+++ b/qapi-schema.json
@@ -29,6 +29,43 @@ 
             'DeviceNotActive', 'DeviceNotFound', 'KVMMissingCap' ] }
 
 ##
+# @QEvent
+#
+# QEMU event types
+#
+# Since: 1.8
+##
+{ 'enum': 'QEvent',
+  'data': [ 'SHUTDOWN',
+            'RESET',
+            'POWERDOWN',
+            'STOP',
+            'RESUME',
+            'VNC_CONNECTED',
+            'VNC_INITIALIZED',
+            'VNC_DISCONNECTED',
+            'BLOCK_IO_ERROR',
+            'RTC_CHANGE',
+            'WATCHDOG',
+            'SPICE_CONNECTED',
+            'SPICE_INITIALIZED',
+            'SPICE_DISCONNECTED',
+            'BLOCK_JOB_COMPLETED',
+            'BLOCK_JOB_CANCELLED',
+            'BLOCK_JOB_ERROR',
+            'BLOCK_JOB_READY',
+            'DEVICE_DELETED',
+            'DEVICE_TRAY_MOVED',
+            'NIC_RX_FILTER_CHANGED',
+            'SUSPEND',
+            'SUSPEND_DISK',
+            'WAKEUP',
+            'BALLOON_CHANGE',
+            'SPICE_MIGRATE_COMPLETED',
+            'GUEST_PANICKED',
+            'BLOCK_IMAGE_CORRUPTED' ] }
+
+##
 # @add_client
 #
 # Allow client connections for VNC, Spice and socket based