Patchwork [15/25] Monitor: Convert do_info_status_print() into do_info_status()

login
register
mail settings
Submitter Luiz Capitulino
Date Dec. 6, 2010, 6:24 p.m.
Message ID <1291659852-23028-16-git-send-email-lcapitulino@redhat.com>
Download mbox | patch
Permalink /patch/74443/
State New
Headers show

Comments

Luiz Capitulino - Dec. 6, 2010, 6:24 p.m.
The new handler directly calls qmp_query_status() to gather
data and then prints it. This change allows us to drop the
user_print callback.

Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
---
 monitor.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

Patch

diff --git a/monitor.c b/monitor.c
index 731cb35..445c73a 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2143,10 +2143,12 @@  static void qmp_query_status(Monitor *mon, QObject **ret_data)
                                     vm_running, singlestep);
 }
 
-static void do_info_status_print(Monitor *mon, const QObject *data)
+static void do_info_status(Monitor *mon)
 {
     QDict *qdict;
+    QObject *data;
 
+    qmp_query_status(NULL, &data);
     qdict = qobject_to_qdict(data);
 
     monitor_printf(mon, "VM status: ");
@@ -2160,6 +2162,7 @@  static void do_info_status_print(Monitor *mon, const QObject *data)
     }
 
     monitor_printf(mon, "\n");
+    qobject_decref(data);
 }
 
 static qemu_acl *find_acl(Monitor *mon, const char *name)
@@ -2543,8 +2546,7 @@  static const mon_cmd_t info_cmds[] = {
         .args_type  = "",
         .params     = "",
         .help       = "show the current VM status (running|paused)",
-        .user_print = do_info_status_print,
-        .mhandler.info_new = qmp_query_status,
+        .mhandler.info = do_info_status,
     },
     {
         .name       = "pcmcia",