From patchwork Tue Nov 17 20:32:13 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 38703 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 62306B6F1C for ; Wed, 18 Nov 2009 10:35:55 +1100 (EST) Received: from localhost ([127.0.0.1]:49524 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NAUtm-0000zp-Ia for incoming@patchwork.ozlabs.org; Tue, 17 Nov 2009 15:43:38 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NAUjL-0004Pr-3X for qemu-devel@nongnu.org; Tue, 17 Nov 2009 15:32:51 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NAUjG-0004MU-Fa for qemu-devel@nongnu.org; Tue, 17 Nov 2009 15:32:50 -0500 Received: from [199.232.76.173] (port=34681 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NAUjF-0004MR-TR for qemu-devel@nongnu.org; Tue, 17 Nov 2009 15:32:45 -0500 Received: from mx1.redhat.com ([209.132.183.28]:22794) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NAUjF-00087W-Bq for qemu-devel@nongnu.org; Tue, 17 Nov 2009 15:32:45 -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 nAHKWixY027741 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Tue, 17 Nov 2009 15:32:44 -0500 Received: from localhost (vpn-11-203.rdu.redhat.com [10.11.11.203]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nAHKWh0e024410 for ; Tue, 17 Nov 2009 15:32:44 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Tue, 17 Nov 2009 18:32:13 -0200 Message-Id: <1258489944-12159-7-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.11 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 06/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 The returned QObject is 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 72de320..1a37be3 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) @@ -2088,7 +2106,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",