From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NHjSP-0001tE-TW for qemu-devel@nongnu.org; Mon, 07 Dec 2009 14:41:17 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NHjSK-0001mK-PO for qemu-devel@nongnu.org; Mon, 07 Dec 2009 14:41:17 -0500 Received: from [199.232.76.173] (port=58618 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NHjSK-0001m4-I3 for qemu-devel@nongnu.org; Mon, 07 Dec 2009 14:41:12 -0500 Received: from qw-out-1920.google.com ([74.125.92.149]:16810) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NHjSK-0003K8-Dd for qemu-devel@nongnu.org; Mon, 07 Dec 2009 14:41:12 -0500 Received: by qw-out-1920.google.com with SMTP id 14so664715qwa.4 for ; Mon, 07 Dec 2009 11:41:11 -0800 (PST) Message-ID: <4B1D5A54.2010805@codemonkey.ws> Date: Mon, 07 Dec 2009 13:41:08 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 05/17] monitor: Fix do_info_balloon() output References: <1259946695-15784-1-git-send-email-lcapitulino@redhat.com> <1259946695-15784-6-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1259946695-15784-6-git-send-email-lcapitulino@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Luiz Capitulino Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org Luiz Capitulino wrote: > New monitor commands should always return values in bytes. > > Signed-off-by: Luiz Capitulino > --- > monitor.c | 12 +++++++++--- > 1 files changed, 9 insertions(+), 3 deletions(-) > > diff --git a/monitor.c b/monitor.c > index 5bf32f0..8cedfa9 100644 > --- a/monitor.c > +++ b/monitor.c > @@ -1889,12 +1889,18 @@ 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))); > + monitor_printf(mon, "balloon: actual=%" PRId64 "\n", > + qint_get_int(qobject_to_qint(data)) >> 20); > } > > /** > * do_info_balloon(): Balloon information > + * > + * Return a QInt with current ballooning value. > + * > + * Example: > + * > + * 1073741824 > */ > static void do_info_balloon(Monitor *mon, QObject **ret_data) > { > @@ -1906,7 +1912,7 @@ 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(qint_from_int(actual)); > } > Returning a dictionary would allow us to extend this information more easily. Regards, Anthony Liguori