From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NIPZe-0008UM-LE for qemu-devel@nongnu.org; Wed, 09 Dec 2009 11:39:34 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NIPZZ-0008QQ-DF for qemu-devel@nongnu.org; Wed, 09 Dec 2009 11:39:33 -0500 Received: from [199.232.76.173] (port=48829 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NIPZY-0008QF-Kd for qemu-devel@nongnu.org; Wed, 09 Dec 2009 11:39:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:23689) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NIPZY-0007Ml-5w for qemu-devel@nongnu.org; Wed, 09 Dec 2009 11:39:28 -0500 From: Luiz Capitulino Date: Wed, 9 Dec 2009 14:27:50 -0200 Message-Id: <1260376078-8694-12-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1260376078-8694-1-git-send-email-lcapitulino@redhat.com> References: <1260376078-8694-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 11/19] monitor: Convert do_info_hpet() 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 Signed-off-by: Luiz Capitulino --- monitor.c | 24 +++++++++++++++++++++--- 1 files changed, 21 insertions(+), 3 deletions(-) diff --git a/monitor.c b/monitor.c index 3d33bd8..72fd573 100644 --- a/monitor.c +++ b/monitor.c @@ -570,10 +570,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 @@ -2375,7 +2392,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 { -- 1.6.6.rc1.39.g9a42