From patchwork Tue Nov 17 20:32:16 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 38692 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 43F35B6F1C for ; Wed, 18 Nov 2009 10:34:29 +1100 (EST) Received: from localhost ([127.0.0.1]:35162 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NAUyx-0003UT-Pd for incoming@patchwork.ozlabs.org; Tue, 17 Nov 2009 15:48:59 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NAUjS-0004UZ-Pv for qemu-devel@nongnu.org; Tue, 17 Nov 2009 15:32:58 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NAUjN-0004Ra-Hw for qemu-devel@nongnu.org; Tue, 17 Nov 2009 15:32:57 -0500 Received: from [199.232.76.173] (port=34687 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NAUjN-0004RG-87 for qemu-devel@nongnu.org; Tue, 17 Nov 2009 15:32:53 -0500 Received: from mx1.redhat.com ([209.132.183.28]:9540) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NAUjM-00088a-Kd for qemu-devel@nongnu.org; Tue, 17 Nov 2009 15:32:52 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nAHKWpGS018068 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 17 Nov 2009 15:32:52 -0500 Received: from localhost (vpn-11-203.rdu.redhat.com [10.11.11.203]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nAHKWoEV027272 for ; Tue, 17 Nov 2009 15:32:51 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Tue, 17 Nov 2009 18:32:16 -0200 Message-Id: <1258489944-12159-10-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1258489944-12159-1-git-send-email-lcapitulino@redhat.com> References: <1258489944-12159-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 09/17] monitor: Convert do_info_uuid() to QObject X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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 9ecf5ff..c86c7a5 100644 --- a/monitor.c +++ b/monitor.c @@ -385,13 +385,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 */ @@ -2216,7 +2224,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) {