From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44875) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkGyJ-0004ac-Hx for qemu-devel@nongnu.org; Thu, 08 Oct 2015 15:35:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZkGyF-0006CQ-CC for qemu-devel@nongnu.org; Thu, 08 Oct 2015 15:35:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57708) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZkGyF-0006CJ-4T for qemu-devel@nongnu.org; Thu, 08 Oct 2015 15:35:19 -0400 References: <1444313344-16196-1-git-send-email-berrange@redhat.com> <1444313344-16196-6-git-send-email-berrange@redhat.com> From: Eric Blake Message-ID: <5616C56E.7030305@redhat.com> Date: Thu, 8 Oct 2015 13:35:10 -0600 MIME-Version: 1.0 In-Reply-To: <1444313344-16196-6-git-send-email-berrange@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="NlIj0QU08kLeuokXD1I9fNnLM0LOAtFwv" Subject: Re: [Qemu-devel] [PATCH v3 5/5] qom: allow properties to be registered against classes List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Daniel P. Berrange" , qemu-devel@nongnu.org Cc: Pavel Fedin , =?UTF-8?Q?Andreas_F=c3=a4rber?= This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --NlIj0QU08kLeuokXD1I9fNnLM0LOAtFwv Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/08/2015 08:09 AM, Daniel P. Berrange wrote: > When there are many instances of a given class, registering > properties against the instance is wasteful of resources. The > majority of objects have a statically defined list of possible > properties, so most of the properties are easily registerable > against the class. Only those properties which are conditionally > registered at runtime need be recorded against the klass. >=20 > Registering properties against classes also makes it possible > to provide static introspection of QOM - currently introspection > is only possible after creating an instance of a class, which > severely limits its usefulness. >=20 > This impl only supports simple scalar properties. It does not > attempt to allow child object / link object properties against > the class. There are ways to support those too, but it would > make this patch more complicated, so it is left as an exercise > for the future. >=20 > There is no equivalent to object_property_del provided, since > classes must be immutable once they are defined. >=20 > Signed-off-by: Daniel P. Berrange > --- > include/qom/object.h | 47 +++++++++- > qom/object.c | 242 +++++++++++++++++++++++++++++++++++++++++++= +++++--- > 2 files changed, 275 insertions(+), 14 deletions(-) >=20 > @@ -898,10 +903,11 @@ object_property_add(Object *obj, const char *name= , const char *type, > return ret; > } > =20 > - if (g_hash_table_contains(obj->properties, name)) { > + > + if (object_property_find(obj, name, NULL) !=3D NULL) { > error_setg(errp, "attempt to add duplicate property '%s'" > - " to object (type '%s')", name, > - object_get_typename(obj)); > + " to object (type '%s')", name, > + object_get_typename(obj)); Ah, the indentation hunk I noticed in 4/5. Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --NlIj0QU08kLeuokXD1I9fNnLM0LOAtFwv 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/ iQEcBAEBCAAGBQJWFsVuAAoJEKeha0olJ0NqXR8H/RvHKE5v71BdnkL6mRF0KY51 3njMZpJBE0wckCYtGkWqwEutrYCfa1Ss1WrWIdp5OIYCEezc4TWy99MkywxUOlyv vZyPVMukJ8WzJfLBgs5+oOzEXtXLxnGw3Ggm7P1d8fx+F8J0rKYTvSQzu4N7iXLb c6G/8KKlWa3xBMhHarkCW6AePqKHN9UAFjN+ZhJQ58nA/yR9wMeqkGinpCb+ql1m OzRCp/hhGlcbrr4hcn8XQvrntn4G+q/6VHssQ/l9Be0s6kwW7RY48I0Eb/01GhgH Ld1NukzpUwTXIGATs0pArtpD99kMK+97reapb9UA5Ec6IzHJVUyV3M9VrmWh8fc= =lhQo -----END PGP SIGNATURE----- --NlIj0QU08kLeuokXD1I9fNnLM0LOAtFwv--