From patchwork Mon Nov 23 20:06:12 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 39085 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 157F5B7F83 for ; Tue, 24 Nov 2009 07:16:33 +1100 (EST) Received: from localhost ([127.0.0.1]:46803 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCfKo-0002tI-10 for incoming@patchwork.ozlabs.org; Mon, 23 Nov 2009 15:16:30 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NCfBO-0008OJ-5S for qemu-devel@nongnu.org; Mon, 23 Nov 2009 15:06:46 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NCfBJ-0008LD-3U for qemu-devel@nongnu.org; Mon, 23 Nov 2009 15:06:45 -0500 Received: from [199.232.76.173] (port=42675 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NCfBI-0008L1-TU for qemu-devel@nongnu.org; Mon, 23 Nov 2009 15:06:40 -0500 Received: from mx1.redhat.com ([209.132.183.28]:23680) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NCfBI-0001a4-EQ for qemu-devel@nongnu.org; Mon, 23 Nov 2009 15:06:40 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id nANK6drj002897 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 23 Nov 2009 15:06:39 -0500 Received: from localhost (vpn-9-248.rdu.redhat.com [10.11.9.248]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nANK6cG2029076 for ; Mon, 23 Nov 2009 15:06:39 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Mon, 23 Nov 2009 18:06:12 -0200 Message-Id: <1259006783-945-7-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1259006783-945-1-git-send-email-lcapitulino@redhat.com> References: <1259006783-945-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 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_status() 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 status information. Signed-off-by: Luiz Capitulino --- monitor.c | 33 +++++++++++++++++++++++++++------ 1 files changed, 27 insertions(+), 6 deletions(-) diff --git a/monitor.c b/monitor.c index e3368c8..c9104c3 100644 --- a/monitor.c +++ b/monitor.c @@ -1678,16 +1678,36 @@ static void do_inject_nmi(Monitor *mon, const QDict *qdict) } #endif -static void do_info_status(Monitor *mon) +static void do_info_status_print(Monitor *mon, const QObject *data) { + monitor_printf(mon, "VM status: %s\n", + qstring_get_str(qobject_to_qstring(data))); +} + +/** + * do_info_status(): VM status + * + * Return a QString with status information, which can be: + * + * - "running" + * - "running (single step mode)" + * - "paused" + */ +static void do_info_status(Monitor *mon, QObject **ret_data) +{ + QString *qs; + if (vm_running) { if (singlestep) { - monitor_printf(mon, "VM status: running (single step mode)\n"); + qs = qstring_from_str("running (single step mode)"); } else { - monitor_printf(mon, "VM status: running\n"); + qs = qstring_from_str("running"); } - } else - monitor_printf(mon, "VM status: paused\n"); + } else { + qs = qstring_from_str("paused"); + } + + *ret_data = QOBJECT(qs); } /** @@ -2123,7 +2143,8 @@ static const mon_cmd_t info_cmds[] = { .args_type = "", .params = "", .help = "show the current VM status (running|paused)", - .mhandler.info = do_info_status, + .user_print = do_info_status_print, + .mhandler.info_new = do_info_status, }, { .name = "pcmcia",