From patchwork Fri Dec 4 17:11: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: 40348 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 83BA6B7BFA for ; Sat, 5 Dec 2009 04:31:31 +1100 (EST) Received: from localhost ([127.0.0.1]:55630 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGc08-0005sc-PS for incoming@patchwork.ozlabs.org; Fri, 04 Dec 2009 12:31:28 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NGbhR-00019H-CK for qemu-devel@nongnu.org; Fri, 04 Dec 2009 12:12:09 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NGbhM-000132-H0 for qemu-devel@nongnu.org; Fri, 04 Dec 2009 12:12:08 -0500 Received: from [199.232.76.173] (port=44833 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NGbhM-00012l-7s for qemu-devel@nongnu.org; Fri, 04 Dec 2009 12:12:04 -0500 Received: from mx1.redhat.com ([209.132.183.28]:4804) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NGbhM-0008Of-59 for qemu-devel@nongnu.org; Fri, 04 Dec 2009 12:12:04 -0500 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nB4HC3lq031589 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 4 Dec 2009 12:12:03 -0500 Received: from localhost (vpn-11-221.rdu.redhat.com [10.11.11.221]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nB4HC1W0003843; Fri, 4 Dec 2009 12:12:02 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Fri, 4 Dec 2009 15:11:27 -0200 Message-Id: <1259946695-15784-10-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.16 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: aliguori@us.ibm.com Subject: [Qemu-devel] [PATCH 09/17] 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 Return a QString with HPET information. Signed-off-by: Luiz Capitulino --- monitor.c | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-) diff --git a/monitor.c b/monitor.c index 96fde16..f9a698f 100644 --- a/monitor.c +++ b/monitor.c @@ -548,10 +548,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"); + qstring_get_str(qobject_to_qstring(data))); +} + +/** + * do_info_hpet(): Show HPET state + * + * Return a QString with HPET information, which can be: + * + * - "enabled" + * - "disabled" + */ +static void do_info_hpet(Monitor *mon, QObject **ret_data) +{ + if (no_hpet) { + *ret_data = QOBJECT(qstring_from_str("disabled")); + } else { + *ret_data = QOBJECT(qstring_from_str("enabled")); + } } #endif @@ -2296,7 +2313,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 {