[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH v3 5/5] qom: allow properties to be registered a
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH v3 5/5] qom: allow properties to be registered against classes |
Date: |
Thu, 8 Oct 2015 13:35:10 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 |
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.
>
> 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.
>
> 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.
>
> There is no equivalent to object_property_del provided, since
> classes must be immutable once they are defined.
>
> Signed-off-by: Daniel P. Berrange <address@hidden>
> ---
> include/qom/object.h | 47 +++++++++-
> qom/object.c | 242
> ++++++++++++++++++++++++++++++++++++++++++++++++---
> 2 files changed, 275 insertions(+), 14 deletions(-)
>
> @@ -898,10 +903,11 @@ object_property_add(Object *obj, const char *name,
> const char *type,
> return ret;
> }
>
> - if (g_hash_table_contains(obj->properties, name)) {
> +
> + if (object_property_find(obj, name, NULL) != 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 <address@hidden>
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- [Qemu-devel] [PATCH v3 3/5] vl: convert machine help to use object_property_foreach, (continued)
[Qemu-devel] [PATCH v3 5/5] qom: allow properties to be registered against classes, Daniel P. Berrange, 2015/10/08
- Re: [Qemu-devel] [PATCH v3 5/5] qom: allow properties to be registered against classes,
Eric Blake <=
[Qemu-devel] [PATCH v3 2/5] qmp: convert to use object_property_foreach iterators, Daniel P. Berrange, 2015/10/09
[Qemu-devel] [PATCH v3 4/5] qom: replace object property list with GHashTable, Daniel P. Berrange, 2015/10/09
Re: [Qemu-devel] [PATCH v3 0/5] qom: more efficient object property handling, Eric Blake, 2015/10/09
Re: [Qemu-devel] [PATCH v3 0/5] qom: more efficient object property handling, Pavel Fedin, 2015/10/09