From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGbhT-0001Bl-G4 for qemu-devel@nongnu.org; Fri, 04 Dec 2009 12:12:11 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGbhO-00015n-NQ for qemu-devel@nongnu.org; Fri, 04 Dec 2009 12:12:10 -0500 Received: from [199.232.76.173] (port=44834 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGbhO-00015c-EL for qemu-devel@nongnu.org; Fri, 04 Dec 2009 12:12:06 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55502) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NGbhO-0008On-9l for qemu-devel@nongnu.org; Fri, 04 Dec 2009 12:12:06 -0500 From: Luiz Capitulino Date: Fri, 4 Dec 2009 15:11:28 -0200 Message-Id: <1259946695-15784-11-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1259946695-15784-1-git-send-email-lcapitulino@redhat.com> References: <1259946695-15784-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 10/17] monitor: Convert do_info_uuid() to QObject List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com The returned QObject is a QString, snprintf() is used because the UUID_FMT is too complex for qobject_from_jsonf(). Signed-off-by: Luiz Capitulino --- monitor.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/monitor.c b/monitor.c index f9a698f..961f6e1 100644 --- a/monitor.c +++ b/monitor.c @@ -572,13 +572,21 @@ static void do_info_hpet(Monitor *mon, QObject **ret_data) } #endif -static void do_info_uuid(Monitor *mon) +/** + * do_info_uuid(): Show VM UUID + * + * Return a QString with the current VM UUID. + */ +static void do_info_uuid(Monitor *mon, QObject **ret_data) { - monitor_printf(mon, UUID_FMT "\n", qemu_uuid[0], qemu_uuid[1], + char uuid[64]; + + snprintf(uuid, sizeof(uuid), UUID_FMT, qemu_uuid[0], qemu_uuid[1], qemu_uuid[2], qemu_uuid[3], qemu_uuid[4], qemu_uuid[5], qemu_uuid[6], qemu_uuid[7], qemu_uuid[8], qemu_uuid[9], qemu_uuid[10], qemu_uuid[11], qemu_uuid[12], qemu_uuid[13], qemu_uuid[14], qemu_uuid[15]); + *ret_data = QOBJECT(qstring_from_str(uuid)); } /* get the current CPU defined by the user */ @@ -2416,7 +2424,8 @@ static const mon_cmd_t info_cmds[] = { .args_type = "", .params = "", .help = "show the current VM UUID", - .mhandler.info = do_info_uuid, + .user_print = monitor_print_qobject, + .mhandler.info_new = do_info_uuid, }, #if defined(TARGET_PPC) { -- 1.6.6.rc1.5.ge21a85