All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrange" <berrange@redhat.com>
To: Valentin Rakush <valentin.rakush@gmail.com>
Cc: armbru@redhat.com, qemu-devel@nongnu.org, lcapitulino@redhat.com,
	asmetanin@virtuozzo.com, den@openvz.org, afaerber@suse.de
Subject: Re: [Qemu-devel] [PATCH v3] qom, qmp, hmp, qapi: create qom-type-prop-list for class properties
Date: Fri, 22 Jan 2016 10:05:48 +0000	[thread overview]
Message-ID: <20160122100548.GC14825@redhat.com> (raw)
In-Reply-To: <1453454812-29232-1-git-send-email-valentin.rakush@gmail.com>

On Fri, Jan 22, 2016 at 12:26:52PM +0300, Valentin Rakush wrote:
> This patch adds support for qom-type-prop-list command to list object
> class properties. A later patch will use this functionality to
> implement x86_64-cpu properties.
> 
> Signed-off-by: Valentin Rakush <valentin.rakush@gmail.com>
> Cc: Luiz Capitulino <lcapitulino@redhat.com>
> Cc: Eric Blake <eblake@redhat.com>
> Cc: Markus Armbruster <armbru@redhat.com>
> Cc: Andreas Färber <afaerber@suse.de>
> Cc: Daniel P. Berrange <berrange@redhat.com>
> ---
> V2: Fixes after first review
>  - changed command name from qom-type-list to qom-type-prop-list
>  - changed memory allocation from g_malloc0 to g_new0
>  - changed parameter name from path to typename
>  - fixed wordings and comments
>  - fixed source code formatting
>  - registered the command in monitor
> V3: commit message fix 
>  - commit message changed to reflect actual command name
> 
> 
>  hmp-commands.hx      | 13 +++++++++++++
>  hmp.c                | 26 ++++++++++++++++++++++++++
>  hmp.h                |  1 +
>  include/qom/object.h | 31 +++++++++++++++++++++++++++++++
>  qapi-schema.json     | 19 +++++++++++++++++++
>  qmp-commands.hx      |  6 ++++++
>  qmp.c                | 32 ++++++++++++++++++++++++++++++++
>  qom/object.c         |  7 +++++++
>  8 files changed, 135 insertions(+)
> 
> diff --git a/hmp-commands.hx b/hmp-commands.hx
> index bb52e4d..0aca653 100644
> --- a/hmp-commands.hx
> +++ b/hmp-commands.hx
> @@ -1734,6 +1734,19 @@ Print QOM properties of object at location @var{path}
>  ETEXI
>  
>      {
> +        .name       = "qom-type-prop-list",
> +        .args_type  = "typename:s?",

The typename should be mandatory so remove the '?' here, then.....

> +        .params     = "typename",
> +        .help       = "list QOM class properties",
> +        .mhandler.cmd  = hmp_qom_type_prop_list,
> +    },
> +
> +STEXI
> +@item qom-type-prop-list [@var{typename}]
> +Print QOM properties of the type @var{typename}
> +ETEXI
> +
> +    {
>          .name       = "qom-set",
>          .args_type  = "path:s,property:s,value:s",
>          .params     = "path property value",
> diff --git a/hmp.c b/hmp.c
> index 54f2620..4bad6a1 100644
> --- a/hmp.c
> +++ b/hmp.c
> @@ -2052,6 +2052,32 @@ void hmp_qom_list(Monitor *mon, const QDict *qdict)
>      hmp_handle_error(mon, &err);
>  }
>  
> +void hmp_qom_type_prop_list(Monitor *mon, const QDict *qdict)
> +{
> +    const char *path = qdict_get_try_str(qdict, "path");
> +    ObjectPropertyInfoList *list;
> +    Error *err = NULL;
> +
> +    if (!path) {
> +        monitor_printf(mon, "/\n");
> +        return;
> +    }

...you don't need this check for path being NULL, you can assume
it is non-NULL

> +
> +    list = qmp_qom_type_prop_list(path, &err);
> +    if (!err) {
> +        ObjectPropertyInfoList *start = list;
> +        while (list) {
> +            ObjectPropertyInfo *value = list->value;
> +
> +            monitor_printf(mon, "%s (%s)\n",
> +                           value->name, value->type);
> +            list = list->next;
> +        }
> +        qapi_free_ObjectPropertyInfoList(start);
> +    }
> +    hmp_handle_error(mon, &err);
> +}
> +

Aside from that I think this change looks good.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|

      reply	other threads:[~2016-01-22 10:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-22  9:26 [Qemu-devel] [PATCH v3] qom, qmp, hmp, qapi: create qom-type-prop-list for class properties Valentin Rakush
2016-01-22 10:05 ` Daniel P. Berrange [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160122100548.GC14825@redhat.com \
    --to=berrange@redhat.com \
    --cc=afaerber@suse.de \
    --cc=armbru@redhat.com \
    --cc=asmetanin@virtuozzo.com \
    --cc=den@openvz.org \
    --cc=lcapitulino@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=valentin.rakush@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.