From patchwork Wed Dec 9 16:27:44 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 40740 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 0337FB6EFE for ; Thu, 10 Dec 2009 03:48:28 +1100 (EST) Received: from localhost ([127.0.0.1]:40307 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NIPiD-0003bI-9s for incoming@patchwork.ozlabs.org; Wed, 09 Dec 2009 11:48:25 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NIPZP-0008KX-9v for qemu-devel@nongnu.org; Wed, 09 Dec 2009 11:39:19 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NIPZK-0008G1-8o for qemu-devel@nongnu.org; Wed, 09 Dec 2009 11:39:18 -0500 Received: from [199.232.76.173] (port=48817 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NIPZJ-0008Fu-OC for qemu-devel@nongnu.org; Wed, 09 Dec 2009 11:39:13 -0500 Received: from mx1.redhat.com ([209.132.183.28]:64383) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NIPZJ-0007K3-AU for qemu-devel@nongnu.org; Wed, 09 Dec 2009 11:39:13 -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 nB9GdCCZ024257 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 9 Dec 2009 11:39:12 -0500 Received: from localhost (vpn-9-2.rdu.redhat.com [10.11.9.2]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id nB9GdAk1013900; Wed, 9 Dec 2009 11:39:11 -0500 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Wed, 9 Dec 2009 14:27:44 -0200 Message-Id: <1260376078-8694-6-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> 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. Cc: aliguori@us.ibm.com Subject: [Qemu-devel] [PATCH 05/19] monitor: Fix do_info_balloon() output 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 Monitor commands should always return values in bytes and info commands should always return a QDict. Signed-off-by: Luiz Capitulino --- monitor.c | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-) diff --git a/monitor.c b/monitor.c index a38a103..aa56ec7 100644 --- a/monitor.c +++ b/monitor.c @@ -1919,12 +1919,24 @@ static void do_balloon(Monitor *mon, const QDict *qdict, QObject **ret_data) static void monitor_print_balloon(Monitor *mon, const QObject *data) { - monitor_printf(mon, "balloon: actual=%d\n", - (int)qint_get_int(qobject_to_qint(data))); + QDict *qdict; + + qdict = qobject_to_qdict(data); + + monitor_printf(mon, "balloon: actual=%" PRId64 "\n", + qdict_get_int(qdict, "balloon") >> 20); } /** * do_info_balloon(): Balloon information + * + * Return a QDict with the following information: + * + * - "balloon": current balloon value in bytes + * + * Example: + * + * { "balloon": 1073741824 } */ static void do_info_balloon(Monitor *mon, QObject **ret_data) { @@ -1936,7 +1948,8 @@ static void do_info_balloon(Monitor *mon, QObject **ret_data) else if (actual == 0) qemu_error_new(QERR_DEVICE_NOT_ACTIVE, "balloon"); else - *ret_data = QOBJECT(qint_from_int((int)(actual >> 20))); + *ret_data = qobject_from_jsonf("{ 'balloon': %" PRId64 "}", + (int64_t) actual); } static qemu_acl *find_acl(Monitor *mon, const char *name)