From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NCfBQ-0008PX-Br for qemu-devel@nongnu.org; Mon, 23 Nov 2009 15:06:48 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NCfBL-0008Ma-GR for qemu-devel@nongnu.org; Mon, 23 Nov 2009 15:06:47 -0500 Received: from [199.232.76.173] (port=42676 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCfBL-0008MQ-4Y for qemu-devel@nongnu.org; Mon, 23 Nov 2009 15:06:43 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43231) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NCfBK-0001aO-Jj for qemu-devel@nongnu.org; Mon, 23 Nov 2009 15:06:42 -0500 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nANK6frF013520 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 23 Nov 2009 15:06:42 -0500 Received: from localhost (vpn-9-248.rdu.redhat.com [10.11.9.248]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nANK6eJS005851 for ; Mon, 23 Nov 2009 15:06:41 -0500 From: Luiz Capitulino Date: Mon, 23 Nov 2009 18:06:13 -0200 Message-Id: <1259006783-945-8-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1259006783-945-1-git-send-email-lcapitulino@redhat.com> References: <1259006783-945-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 07/17] monitor: Convert do_info_kvm() to QObject List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Return a QString with kvm status information. Signed-off-by: Luiz Capitulino --- monitor.c | 31 +++++++++++++++++++++++++------ 1 files changed, 25 insertions(+), 6 deletions(-) diff --git a/monitor.c b/monitor.c index c9104c3..c2e82c8 100644 --- a/monitor.c +++ b/monitor.c @@ -1551,17 +1551,35 @@ static void tlb_info(Monitor *mon) #endif -static void do_info_kvm(Monitor *mon) +static void do_info_kvm_print(Monitor *mon, const QObject *data) { + monitor_printf(mon, "kvm support: %s\n", + qstring_get_str(qobject_to_qstring(data))); +} + +/** + * do_info_kvm(): Show KVM information + * + * Return a QString with KVM information, which can be: + * + * - "enabled" + * - "disabled" + * - "not compiled" + */ +static void do_info_kvm(Monitor *mon, QObject **ret_data) +{ + QString *qs; + #ifdef CONFIG_KVM - monitor_printf(mon, "kvm support: "); if (kvm_enabled()) - monitor_printf(mon, "enabled\n"); + qs = qstring_from_str("enabled"); else - monitor_printf(mon, "disabled\n"); + qs = qstring_from_str("disabled"); #else - monitor_printf(mon, "kvm support: not compiled\n"); + qs = qstring_from_str("not compiled"); #endif + + *ret_data = QOBJECT(qs); } static void do_info_numa(Monitor *mon) @@ -2094,7 +2112,8 @@ static const mon_cmd_t info_cmds[] = { .args_type = "", .params = "", .help = "show KVM information", - .mhandler.info = do_info_kvm, + .user_print = do_info_kvm_print, + .mhandler.info_new = do_info_kvm, }, { .name = "numa", -- 1.6.5.3.148.g785c5