From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGbhN-00014M-Bb for qemu-devel@nongnu.org; Fri, 04 Dec 2009 12:12:05 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGbhI-0000xc-Mh for qemu-devel@nongnu.org; Fri, 04 Dec 2009 12:12:05 -0500 Received: from [199.232.76.173] (port=44830 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGbhI-0000xL-EW for qemu-devel@nongnu.org; Fri, 04 Dec 2009 12:12:00 -0500 Received: from mx1.redhat.com ([209.132.183.28]:28120) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NGbhH-0008OD-U8 for qemu-devel@nongnu.org; Fri, 04 Dec 2009 12:12:00 -0500 From: Luiz Capitulino Date: Fri, 4 Dec 2009 15:11:25 -0200 Message-Id: <1259946695-15784-8-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 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 Cc: aliguori@us.ibm.com 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 03f5d7a..d3ab2ab 100644 --- a/monitor.c +++ b/monitor.c @@ -1738,17 +1738,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) @@ -2288,7 +2306,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.6.rc1.5.ge21a85