[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 10/21] qdev: do not propagate properties to subc
From: |
Andreas Färber |
Subject: |
Re: [Qemu-devel] [PATCH 10/21] qdev: do not propagate properties to subclasses |
Date: |
Thu, 24 May 2012 01:46:36 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120421 Thunderbird/12.0 |
Am 02.05.2012 13:31, schrieb Paolo Bonzini:
> As soon as we'll look up properties along the inheritance chain, we
> will have duplicates if class A defines some properties and its
> subclass B does not define any, because class_b->props will be
> left equal to class_a->props.
>
> The solution here is to reintroduce the class_base_init TypeInfo
> callback, that was present in one of the early QOM versions but
> removed (on my request...) before committing.
>
> Signed-off-by: Paolo Bonzini <address@hidden>
This breaks `make check` once again:
GTESTER check-qtest-i386
qemu-system-i386: Property '.id' not found
Andreas
> ---
> hw/qdev.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
>
> diff --git a/hw/qdev.c b/hw/qdev.c
> index 94fb32e..67d7770 100644
> --- a/hw/qdev.c
> +++ b/hw/qdev.c
> @@ -658,6 +658,16 @@ static void device_finalize(Object *obj)
> QTAILQ_REMOVE(&dev->parent_bus->children, dev, sibling);
> }
>
> +static void device_class_base_init(ObjectClass *class, void *data)
> +{
> + DeviceClass *klass = DEVICE_CLASS(class);
> +
> + /* We explicitly look up properties in the superclasses,
> + * so do not propagate them to the subclasses.
> + */
> + klass->props = NULL;
> +}
> +
> void device_reset(DeviceState *dev)
> {
> DeviceClass *klass = DEVICE_GET_CLASS(dev);
> @@ -684,6 +694,7 @@ static TypeInfo device_type_info = {
> .instance_size = sizeof(DeviceState),
> .instance_init = device_initfn,
> .instance_finalize = device_finalize,
> + .class_base_init = device_class_base_init,
> .abstract = true,
> .class_size = sizeof(DeviceClass),
> };
--
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
- Re: [Qemu-devel] [PATCH 05/21] qom: assert that public types have a non-NULL parent field, (continued)
- [Qemu-devel] [PATCH 10/21] qdev: do not propagate properties to subclasses, Paolo Bonzini, 2012/05/02
- Re: [Qemu-devel] [PATCH 10/21] qdev: do not propagate properties to subclasses,
Andreas Färber <=
- [Qemu-devel] [PATCH 09/21] qdev: move bus properties to a separate global, Paolo Bonzini, 2012/05/02
- [Qemu-devel] [PATCH 13/21] qdev: clean up global properties, Paolo Bonzini, 2012/05/02
- [Qemu-devel] [PATCH 15/21] qdev: fix adding of ptr properties, Paolo Bonzini, 2012/05/02
- [Qemu-devel] [PATCH 14/21] qdev: remove qdev_prop_set_defaults, Paolo Bonzini, 2012/05/02