From patchwork Fri Dec 4 17:11:25 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 40346 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 3286DB6F01 for ; Sat, 5 Dec 2009 04:27:18 +1100 (EST) Received: from localhost ([127.0.0.1]:53277 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGbw2-0002Zt-FR for incoming@patchwork.ozlabs.org; Fri, 04 Dec 2009 12:27:14 -0500 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 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nB4HBwQ9031579 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 4 Dec 2009 12:11:58 -0500 Received: from localhost (vpn-11-221.rdu.redhat.com [10.11.11.221]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nB4HBvfH012658; Fri, 4 Dec 2009 12:11:58 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org 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> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: aliguori@us.ibm.com Subject: [Qemu-devel] [PATCH 07/17] monitor: Convert do_info_kvm() 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 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",