Patchwork [13/25] Monitor: Convert do_info_kvm_print() into do_info_kvm()

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

Comments

Luiz Capitulino - Dec. 6, 2010, 6:24 p.m.
The new handler directly calls qmp_query_kvm() 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 |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

Patch

diff --git a/monitor.c b/monitor.c
index e8f0562..4286375 100644
--- a/monitor.c
+++ b/monitor.c
@@ -2004,10 +2004,12 @@  static void qmp_query_kvm(Monitor *mon, QObject **ret_data)
 #endif
 }
 
-static void do_info_kvm_print(Monitor *mon, const QObject *data)
+static void do_info_kvm(Monitor *mon)
 {
+    QObject *data;
     QDict *qdict;
 
+    qmp_query_kvm(NULL, &data);
     qdict = qobject_to_qdict(data);
 
     monitor_printf(mon, "kvm support: ");
@@ -2017,6 +2019,8 @@  static void do_info_kvm_print(Monitor *mon, const QObject *data)
     } else {
         monitor_printf(mon, "not compiled\n");
     }
+
+    qobject_decref(data);
 }
 
 static void do_info_numa(Monitor *mon)
@@ -2490,8 +2494,7 @@  static const mon_cmd_t info_cmds[] = {
         .args_type  = "",
         .params     = "",
         .help       = "show KVM information",
-        .user_print = do_info_kvm_print,
-        .mhandler.info_new = qmp_query_kvm,
+        .mhandler.info = do_info_kvm,
     },
     {
         .name       = "numa",