From patchwork Wed Oct 7 00:27:11 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 35186 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 813B2B7B83 for ; Wed, 7 Oct 2009 11:52:24 +1100 (EST) Received: from localhost ([127.0.0.1]:57298 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvKlQ-0002lk-T9 for incoming@patchwork.ozlabs.org; Tue, 06 Oct 2009 20:52:20 -0400 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MvKNv-0001mu-In for qemu-devel@nongnu.org; Tue, 06 Oct 2009 20:28:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MvKNr-0001kn-Qg for qemu-devel@nongnu.org; Tue, 06 Oct 2009 20:28:03 -0400 Received: from [199.232.76.173] (port=45754 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvKNr-0001kh-Kb for qemu-devel@nongnu.org; Tue, 06 Oct 2009 20:27:59 -0400 Received: from mx1.redhat.com ([209.132.183.28]:55928) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MvKNr-00076c-82 for qemu-devel@nongnu.org; Tue, 06 Oct 2009 20:27:59 -0400 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n970RwxS007413; Tue, 6 Oct 2009 20:27:58 -0400 Received: from localhost (vpn-12-79.rdu.redhat.com [10.11.12.79]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n970RuVi012080; Tue, 6 Oct 2009 20:27:57 -0400 From: Luiz Capitulino To: qemu-devel@nongnu.org Date: Tue, 6 Oct 2009 21:27:11 -0300 Message-Id: <1254875232-25012-15-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1254875232-25012-1-git-send-email-lcapitulino@redhat.com> References: <1254875232-25012-1-git-send-email-lcapitulino@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.18 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: aliguori@us.ibm.com, avi@redhat.com Subject: [Qemu-devel] [PATCH 14/15] monitor: Convert do_info_balloon() 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 On success return a QInt with the balloon's value. This also introduces monitor_print_balloon() to print the balloon information in the user protocol. Please, note that errors are not being converted yet. Signed-off-by: Luiz Capitulino --- monitor.c | 15 ++++++++++++--- 1 files changed, 12 insertions(+), 3 deletions(-) diff --git a/monitor.c b/monitor.c index 2a1e4d7..0dcf478 100644 --- a/monitor.c +++ b/monitor.c @@ -1634,7 +1634,16 @@ static void do_balloon(Monitor *mon, const QDict *qdict, QObject **ret_data) qemu_balloon(target << 20); } -static void do_info_balloon(Monitor *mon) +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))); +} + +/** + * do_info_balloon(): Balloon information + */ +static void do_info_balloon(Monitor *mon, QObject **ret_data) { ram_addr_t actual; @@ -1645,7 +1654,7 @@ static void do_info_balloon(Monitor *mon) else if (actual == 0) monitor_printf(mon, "Ballooning not activated in VM\n"); else - monitor_printf(mon, "balloon: actual=%d\n", (int)(actual >> 20)); + *ret_data = QOBJECT(qint_from_int((int)(actual >> 20))); } static qemu_acl *find_acl(Monitor *mon, const char *name) @@ -2137,7 +2146,7 @@ static const mon_cmd_t info_cmds[] = { .name = "balloon", .args_type = "", .handler = do_info_balloon, - .user_print = NULL, + .user_print = monitor_print_balloon, .params = "", .help = "show balloon information" },