[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObjec
From: |
Luiz Capitulino |
Subject: |
Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject |
Date: |
Thu, 10 Dec 2009 09:52:37 -0200 |
On Thu, 10 Dec 2009 11:09:53 +0100
Markus Armbruster <address@hidden> wrote:
> Luiz Capitulino <address@hidden> writes:
>
> > Signed-off-by: Luiz Capitulino <address@hidden>
> > ---
> > monitor.c | 29 +++++++++++++++++++++++++----
> > 1 files changed, 25 insertions(+), 4 deletions(-)
> >
> > diff --git a/monitor.c b/monitor.c
> > index 47f794d..3d33bd8 100644
> > --- a/monitor.c
> > +++ b/monitor.c
> > @@ -514,10 +514,30 @@ static void do_info_version(Monitor *mon, QObject
> > **ret_data)
> > QEMU_VERSION, QEMU_PKGVERSION);
> > }
> >
> > -static void do_info_name(Monitor *mon)
> > +static void do_info_name_print(Monitor *mon, const QObject *data)
> > {
> > - if (qemu_name)
> > - monitor_printf(mon, "%s\n", qemu_name);
> > + const char *str;
> > +
> > + str = qdict_get_str(qobject_to_qdict(data), "name");
> > + if (strlen(str) > 0) {
> > + monitor_printf(mon, "%s\n", str);
> > + }
> > +}
> > +
> > +/**
> > + * do_info_name(): Show VM name
> > + *
> > + * Return a QDict with the following information:
> > + *
> > + * - "name": VM's name. If the VM has no name, the string will be empty
>
> So you can't distinguish name "" from unnamed. Do we care?
I don't think so, but if we do the best way to deal with the fact
that qemu_name can be NULL would be to return null, like:
{ "name": null }
But we don't support json-null yet... There are other two
ways to solve this, but they seem workarounds for not supporting
null: return an empty dict or return { "name": false }.
> Monitor output for unnamed guests changes from
>
> (qemu) info name
> (qemu)
>
> to
>
> (qemu) info name
>
> (qemu)
The strlen() call doesn't let this happen. Although the
other way around does happen: if you call qemu with -name '',
then output would be:
(qemu) info name
(qemu)
This won't happen anymore, goto do_we_care.
- Re: [Qemu-devel] [PATCH 06/19] monitor: do_info_cpus(): Use QBool, (continued)
- Re: [Qemu-devel] [PATCH 06/19] monitor: do_info_cpus(): Use QBool, Luiz Capitulino, 2009/12/10
- Re: [Qemu-devel] [PATCH 06/19] monitor: do_info_cpus(): Use QBool, Anthony Liguori, 2009/12/10
- Re: [Qemu-devel] [PATCH 06/19] monitor: do_info_cpus(): Use QBool, Luiz Capitulino, 2009/12/10
- Re: [Qemu-devel] [PATCH 06/19] monitor: do_info_cpus(): Use QBool, Anthony Liguori, 2009/12/10
- Re: [Qemu-devel] [PATCH 06/19] monitor: do_info_cpus(): Use QBool, Anthony Liguori, 2009/12/10
- Re: [Qemu-devel] [PATCH 06/19] monitor: do_info_cpus(): Use QBool, Markus Armbruster, 2009/12/10
[Qemu-devel] [PATCH 07/19] monitor: do_info_version(): Use QDict, Luiz Capitulino, 2009/12/09
[Qemu-devel] [PATCH 08/19] monitor: Convert do_info_status() to QObject, Luiz Capitulino, 2009/12/09
[Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Luiz Capitulino, 2009/12/09
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Markus Armbruster, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject,
Luiz Capitulino <=
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Anthony Liguori, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Avi Kivity, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Avi Kivity, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Anthony Liguori, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Avi Kivity, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Anthony Liguori, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Avi Kivity, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Luiz Capitulino, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Avi Kivity, 2009/12/10
- Re: [Qemu-devel] [PATCH 10/19] monitor: Convert do_info_name() to QObject, Luiz Capitulino, 2009/12/10