From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NHjMV-0001vX-VR for qemu-devel@nongnu.org; Mon, 07 Dec 2009 14:35:12 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NHjMQ-0001nv-Tk for qemu-devel@nongnu.org; Mon, 07 Dec 2009 14:35:11 -0500 Received: from [199.232.76.173] (port=42589 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NHjMQ-0001nO-NA for qemu-devel@nongnu.org; Mon, 07 Dec 2009 14:35:06 -0500 Received: from mail-ew0-f218.google.com ([209.85.219.218]:49710) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NHjMQ-0002d7-Fe for qemu-devel@nongnu.org; Mon, 07 Dec 2009 14:35:06 -0500 Received: by ewy10 with SMTP id 10so1442095ewy.10 for ; Mon, 07 Dec 2009 11:35:05 -0800 (PST) Message-ID: <4B1D58E3.1030405@codemonkey.ws> Date: Mon, 07 Dec 2009 13:34:59 -0600 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 07/17] monitor: Convert do_info_kvm() to QObject References: <1259946695-15784-1-git-send-email-lcapitulino@redhat.com> <1259946695-15784-8-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1259946695-15784-8-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: > Return a QString with kvm status information. > > Signed-off-by: Luiz Capitulino > --- > monitor.c | 31 +++++++++++++++++++++++++------ > 1 files changed, 25 insertions(+), 6 deletions(-) > > diff --git a/monitor.c b/monitor.c > index 03f5d7a..d3ab2ab 100644 > --- a/monitor.c > +++ b/monitor.c > @@ -1738,17 +1738,35 @@ static void tlb_info(Monitor *mon) > > #endif > > -static void do_info_kvm(Monitor *mon) > +static void do_info_kvm_print(Monitor *mon, const QObject *data) > { > + monitor_printf(mon, "kvm support: %s\n", > + qstring_get_str(qobject_to_qstring(data))); > +} > + > +/** > + * do_info_kvm(): Show KVM information > + * > + * Return a QString with KVM information, which can be: > + * > + * - "enabled" > + * - "disabled" > + * - "not compiled" > + */ > +static void do_info_kvm(Monitor *mon, QObject **ret_data) > +{ > + QString *qs; > + > #ifdef CONFIG_KVM > - monitor_printf(mon, "kvm support: "); > if (kvm_enabled()) > - monitor_printf(mon, "enabled\n"); > + qs = qstring_from_str("enabled"); > else > - monitor_printf(mon, "disabled\n"); > + qs = qstring_from_str("disabled"); > #else > - monitor_printf(mon, "kvm support: not compiled\n"); > + qs = qstring_from_str("not compiled"); > #endif > + > + *ret_data = QOBJECT(qs); > } > > "{'enabled': true, 'present': false}" Using a dictionary here is important as then we can extend it with more information (like the supported KVM features). Regards, Anthony Liguori