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 <lcapitul...@redhat.com> --- monitor.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) 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) { -- 1.7.3.3.398.g0b0cd