From patchwork Thu Dec 10 14:43:27 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 40818 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 B98BBB6EEE for ; Fri, 11 Dec 2009 02:07:22 +1100 (EST) Received: from localhost ([127.0.0.1]:54268 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NIkbu-0006H2-VB for incoming@patchwork.ozlabs.org; Thu, 10 Dec 2009 10:07:19 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NIkFb-0001S4-HO for qemu-devel@nongnu.org; Thu, 10 Dec 2009 09:44:15 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NIkFY-0001QD-LK for qemu-devel@nongnu.org; Thu, 10 Dec 2009 09:44:14 -0500 Received: from [199.232.76.173] (port=45381 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NIkFY-0001Q1-8p for qemu-devel@nongnu.org; Thu, 10 Dec 2009 09:44:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:15653) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NIkFX-0004EY-Vs for qemu-devel@nongnu.org; Thu, 10 Dec 2009 09:44:12 -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 nBAEiANo000830 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 10 Dec 2009 09:44:10 -0500 Received: from localhost (vpn-11-77.rdu.redhat.com [10.11.11.77]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nBAEi9lv010429; Thu, 10 Dec 2009 09:44:10 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Thu, 10 Dec 2009 12:43:27 -0200 Message-Id: <1260456215-31022-13-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1260456215-31022-1-git-send-email-lcapitulino@redhat.com> References: <1260456215-31022-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 12/20] monitor: Convert do_info_hpet() 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 Signed-off-by: Luiz Capitulino --- monitor.c | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-) diff --git a/monitor.c b/monitor.c index a2433e9..a824648 100644 --- a/monitor.c +++ b/monitor.c @@ -597,10 +597,27 @@ static void do_info_commands(Monitor *mon, QObject **ret_data) } #if defined(TARGET_I386) -static void do_info_hpet(Monitor *mon) +static void do_info_hpet_print(Monitor *mon, const QObject *data) { monitor_printf(mon, "HPET is %s by QEMU\n", - (no_hpet) ? "disabled" : "enabled"); + qdict_get_bool(qobject_to_qdict(data), "enabled") ? + "enabled" : "disabled"); +} + +/** + * do_info_hpet(): Show HPET state + * + * Return a QDict with the following information: + * + * - "enabled": true if hpet if enabled, false otherwise + * + * Example: + * + * { "enabled": true } + */ +static void do_info_hpet(Monitor *mon, QObject **ret_data) +{ + *ret_data = qobject_from_jsonf("{ 'enabled': %i }", !no_hpet); } #endif @@ -2401,7 +2418,8 @@ static const mon_cmd_t info_cmds[] = { .args_type = "", .params = "", .help = "show state of HPET", - .mhandler.info = do_info_hpet, + .user_print = do_info_hpet_print, + .mhandler.info_new = do_info_hpet, }, #endif {