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.rak...@gmail.com> > Cc: Luiz Capitulino <lcapitul...@redhat.com> > Cc: Eric Blake <ebl...@redhat.com> > Cc: Markus Armbruster <arm...@redhat.com> > Cc: Andreas Färber <afaer...@suse.de> > Cc: Daniel P. Berrange <berra...@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 :|