From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33708) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLvls-0003mm-IP for qemu-devel@nongnu.org; Wed, 20 Jan 2016 11:38:13 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aLvlp-00017s-CL for qemu-devel@nongnu.org; Wed, 20 Jan 2016 11:38:12 -0500 Received: from mx1.redhat.com ([209.132.183.28]:38301) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aLvlp-00017o-4w for qemu-devel@nongnu.org; Wed, 20 Jan 2016 11:38:09 -0500 References: <1453282958-385-1-git-send-email-valentin.rakush@gmail.com> From: Eric Blake Message-ID: <569FB7EF.405@redhat.com> Date: Wed, 20 Jan 2016 09:38:07 -0700 MIME-Version: 1.0 In-Reply-To: <1453282958-385-1-git-send-email-valentin.rakush@gmail.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="ETGndALkJSXsqMv6WwHrb8rWACtBSGgem" Subject: Re: [Qemu-devel] [PATCH] qom, qmp, hmp, qapi: create qom-type-list for class properties List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Valentin Rakush , qemu-devel@nongnu.org Cc: armbru@redhat.com, lcapitulino@redhat.com, asmetanin@virtuozzo.com, den@openvz.org, afaerber@suse.de This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --ETGndALkJSXsqMv6WwHrb8rWACtBSGgem Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/20/2016 02:42 AM, Valentin Rakush wrote: > This patch adds support for qom-type-list command that supposed to list= object class properties. Will use this functionality further to implemen= t x86_64 cpu properties. In addition to Dan's comments, s/that supposed// s/Will use/A later patch will use/ >=20 > Additionally object_class_property_iterator_init function is implemente= d for consistency. Starting a paragraph with "Also" or "Additionally" can be a sign that the patch may be worth splitting into two smaller pieces. It's not always the case, but worth thinking about. >=20 >=20 > Signed-off-by: Valentin Rakush > Cc: Luiz Capitulino > Cc: Eric Blake > Cc: Markus Armbruster > Cc: Andreas F=C3=A4rber > Cc: Daniel P. Berrange > --- > hmp.c | 26 ++++++++++++++++++++++++++ > hmp.h | 1 + > include/qom/object.h | 31 +++++++++++++++++++++++++++++++ > qapi-schema.json | 19 +++++++++++++++++++ > qmp-commands.hx | 6 ++++++ > qmp.c | 29 +++++++++++++++++++++++++++++ > qom/object.c | 8 ++++++++ > 7 files changed, 120 insertions(+) >=20 > diff --git a/hmp.c b/hmp.c > index 54f2620..64aa991 100644 > --- a/hmp.c > +++ b/hmp.c > @@ -2052,6 +2052,32 @@ void hmp_qom_list(Monitor *mon, const QDict *qdi= ct) > hmp_handle_error(mon, &err); > } > =20 > +void hmp_qom_type_list(Monitor *mon, const QDict *qdict) > +{ > + const char *path =3D qdict_get_try_str(qdict, "path"); > + ObjectPropertyInfoList *list; > + Error *err =3D NULL; > + > + if (path =3D=3D NULL) { I'd write '(!path)', but that's cosmetic. > + monitor_printf(mon, "/\n"); > + return; > + } > + > + list =3D qmp_qom_type_list(path, &err); > + if (err =3D=3D NULL) { > + ObjectPropertyInfoList *start =3D list; > + while (list !=3D NULL) { Again, this could be 'if (!err)' and 'while (list)'. > +++ b/include/qom/object.h > @@ -1013,6 +1013,37 @@ void object_property_iter_init(ObjectPropertyIte= rator *iter, > */ > ObjectProperty *object_property_iter_next(ObjectPropertyIterator *iter= ); > =20 > +/** > + * object_class_property_iter_init: > + * @klass: the klass to iter properties for Reads awkwardly; maybe: @klass: the class owning the properties to be iterated over > +++ b/qapi-schema.json > @@ -4081,3 +4081,22 @@ > ## > { 'enum': 'ReplayMode', > 'data': [ 'none', 'record', 'play' ] } > + > +## > +# @qom-type-list: > +# > +# This command will list any properties of a object class s/a object/an object/ > +# given a path in the object class model. If you change the parameter name to 'typename' as suggested by Dan, then this sentence needs tweaking as well. > +# > +# @path: the path within the object class model. See @qom-list-types > +# to check available object class names. > +# --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --ETGndALkJSXsqMv6WwHrb8rWACtBSGgem Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWn7fvAAoJEKeha0olJ0Nq47AIAKWwXyMOBSdCPsLg3jr3IMYR GkAoWOjyglvugFGE2byHqAi1gRK6bN3GGS4oIRO+C9uXTHi6+83ldEu+A/Wm4Igj nBytuSEPthtMyH7cyNB2DoNGBOx+OxQY2D6UChnhiK1DshM1caHWISiOTlXglT69 I1iHnVSpwJXk5QP+tZfTeGkCtWPEPkE7JeW9g8pxyL1aD0g33Wm/VkcNbInvpYMS VBHAJ+cKVUjJ8Rg3rqBwtPmCkdeMOlSNdyKuPj+Yd33zatkvnM7t8hGj41pReFt5 WcOphbm3REJbdvWkBwqg5evvNiYWqK5dlX5BkJILqo4gr67PkdQLvVVPPfAVsT8= =5JHN -----END PGP SIGNATURE----- --ETGndALkJSXsqMv6WwHrb8rWACtBSGgem--