Patchwork [21/25] Monitor: Convert do_info_uuid_print() into do_info_uuid()

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

Comments

Luiz Capitulino - Dec. 6, 2010, 6:24 p.m.
The new handler directly calls qmp_query_uuid() 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 e9b07f3..3b6137e 100644
--- a/monitor.c
+++ b/monitor.c
@@ -818,9 +818,13 @@  static void qmp_query_uuid(Monitor *mon, QObject **ret_data)
     *ret_data = qobject_from_jsonf("{ 'UUID': %s }", uuid);
 }
 
-static void do_info_uuid_print(Monitor *mon, const QObject *data)
+static void do_info_uuid(Monitor *mon)
 {
+    QObject *data;
+
+    qmp_query_uuid(NULL, &data);
     monitor_printf(mon, "%s\n", qdict_get_str(qobject_to_qdict(data), "UUID"));
+    qobject_decref(data);
 }
 
 /* get the current CPU defined by the user */
@@ -2586,8 +2590,7 @@  static const mon_cmd_t info_cmds[] = {
         .args_type  = "",
         .params     = "",
         .help       = "show the current VM UUID",
-        .user_print = do_info_uuid_print,
-        .mhandler.info_new = qmp_query_uuid,
+        .mhandler.info = do_info_uuid,
     },
 #if defined(TARGET_PPC)
     {