From 69058076bd71e3b9e5ce0bb25e010ae2bf3e0948 Mon Sep 17 00:00:00 2001
From: Jeffrey Cody <jcody@redhat.com>
Date: Tue, 20 Mar 2012 14:07:21 -0300
Subject: [RHEL6 qemu-kvm PATCH 01/21] monitor: Establish cmd flags and convert the async tag

RH-Author: Jeffrey Cody <jcody@redhat.com>
Message-id: <feb12913ee853659f29af50b95fe04ba9730d07a.1332249823.git.jcody@redhat.com>
Patchwork-id: 38633
O-Subject: [RHEL6.3 qemu-kvm PATCH v3 01/21] monitor: Establish cmd flags and convert the async tag
Bugzilla: 784153
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Markus Armbruster <armbru@redhat.com>

From: Jan Kiszka <jan.kiszka@siemens.com>

As we want to add more flags to monitor commands, convert the only so
far existing one accordingly.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
(cherry picked from commit 8ac470c1f945601de9f1f577791c48e95d5340db)

Conflicts:

	monitor.h
Signed-off-by: Jeff Cody <jcody@redhat.com>
---
 monitor.c       |    6 +++---
 monitor.h       |    3 +++
 qemu-monitor.hx |    8 ++++----
 3 files changed, 10 insertions(+), 7 deletions(-)

Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
 monitor.c       |    6 +++---
 monitor.h       |    3 +++
 qemu-monitor.hx |    8 ++++----
 3 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/monitor.c b/monitor.c
index b8c394f..5489234 100644
--- a/monitor.c
+++ b/monitor.c
@@ -124,7 +124,7 @@ typedef struct mon_cmd_t {
         int  (*cmd_async)(Monitor *mon, const QDict *params,
                           MonitorCompletion *cb, void *opaque);
     } mhandler;
-    int async;
+    int flags;
 } mon_cmd_t;
 
 /* file descriptors passed via SCM_RIGHTS */
@@ -339,7 +339,7 @@ static inline int monitor_handler_ported(const mon_cmd_t *cmd)
 
 static inline bool monitor_handler_is_async(const mon_cmd_t *cmd)
 {
-    return cmd->async != 0;
+    return cmd->flags & MONITOR_CMD_ASYNC;
 }
 
 static inline int monitor_has_error(const Monitor *mon)
@@ -2950,7 +2950,7 @@ static const mon_cmd_t info_cmds[] = {
         .help       = "show balloon information",
         .user_print = monitor_print_balloon,
         .mhandler.info_async = do_info_balloon,
-        .async      = 1,
+        .flags      = MONITOR_CMD_ASYNC,
     },
     {
         .name       = "qtree",
diff --git a/monitor.h b/monitor.h
index 36846ba..83bac6a 100644
--- a/monitor.h
+++ b/monitor.h
@@ -18,6 +18,9 @@ extern Monitor *default_mon;
 /* Red Hat Monitor's prefix (reversed fully qualified domain) */
 #define RFQDN_REDHAT "__com.redhat_"
 
+/* flags for monitor commands */
+#define MONITOR_CMD_ASYNC       0x0001
+
 /* QMP events */
 typedef enum MonitorEvent {
     QEVENT_SHUTDOWN,
diff --git a/qemu-monitor.hx b/qemu-monitor.hx
index ca5dec9..94764d9 100644
--- a/qemu-monitor.hx
+++ b/qemu-monitor.hx
@@ -174,7 +174,7 @@ EQMP
         .help       = "Stop an active block streaming operation",
         .user_print = monitor_user_noop,
         .mhandler.cmd_async = do_block_job_cancel,
-        .async      = 1,
+        .flags      = MONITOR_CMD_ASYNC,
     },
 
 STEXI
@@ -1348,7 +1348,7 @@ EQMP
         .help       = "send migration info to spice/vnc client",
         .user_print = monitor_user_noop,
         .mhandler.cmd_async = client_migrate_info,
-        .async      = 1,
+        .flags      = MONITOR_CMD_ASYNC,
     },
 
 SQMP
@@ -1681,7 +1681,7 @@ EQMP
         .help       = "request VM to change its memory allocation (in MB)",
         .user_print = monitor_user_noop,
         .mhandler.cmd_async = do_balloon,
-        .async      = 1,
+        .flags      = MONITOR_CMD_ASYNC,
     },
 
 STEXI
@@ -2018,7 +2018,7 @@ EQMP
         .help       = "send migration info to spice client",
 	.user_print = monitor_user_noop,
         .mhandler.cmd_async = redhat_spice_migrate_info,
-        .async      = 1,
+        .flags      = MONITOR_CMD_ASYNC,
     },
 
 
-- 
1.7.3.2

