From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MvZbT-0002Wr-Fy for qemu-devel@nongnu.org; Wed, 07 Oct 2009 12:43:03 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MvZbO-0002Uj-Ds for qemu-devel@nongnu.org; Wed, 07 Oct 2009 12:43:02 -0400 Received: from [199.232.76.173] (port=49994 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MvZbN-0002UV-Uo for qemu-devel@nongnu.org; Wed, 07 Oct 2009 12:42:58 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26384) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MvZbN-0005Ws-B7 for qemu-devel@nongnu.org; Wed, 07 Oct 2009 12:42:57 -0400 From: Luiz Capitulino Date: Wed, 7 Oct 2009 13:42:03 -0300 Message-Id: <1254933724-22485-18-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1254933724-22485-1-git-send-email-lcapitulino@redhat.com> References: <1254933724-22485-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PATCH 17/18] monitor: Convert do_info_balloon() 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, avi@redhat.com 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 | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/monitor.c b/monitor.c index 8c9cc9b..9983f34 100644 --- a/monitor.c +++ b/monitor.c @@ -1633,7 +1633,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; @@ -1644,7 +1653,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) @@ -2107,7 +2116,8 @@ static const mon_cmd_t info_cmds[] = { .args_type = "", .params = "", .help = "show balloon information", - .mhandler.info = do_info_balloon, + .user_print = monitor_print_balloon, + .mhandler.info_new = do_info_balloon, }, { .name = "qtree", -- 1.6.5.rc2.17.gdbc1b