[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-stable] [RFC for-2.8] machine: Convert abstract typename on co
From: |
Eduardo Habkost |
Subject: |
Re: [Qemu-stable] [RFC for-2.8] machine: Convert abstract typename on compat_props to subclass names |
Date: |
Mon, 12 Dec 2016 15:36:41 -0200 |
User-agent: |
Mutt/1.7.1 (2016-10-04) |
On Mon, Dec 12, 2016 at 01:25:09PM +0100, Cornelia Huck wrote:
> On Tue, 6 Dec 2016 17:31:59 -0200
> Eduardo Habkost <address@hidden> wrote:
>
> > What about this?
> >
> > (untested)
>
> Have not tested it either, but I think it looks good. Some nits below.
Thanks!
>
> >
> > Signed-off-by: Eduardo Habkost <address@hidden>
> > ---
> > hw/core/machine.c | 35 ++++++++++++++++++++++++++++++++---
> > 1 file changed, 32 insertions(+), 3 deletions(-)
> >
>
> > @@ -565,10 +584,20 @@ void machine_register_compat_props(MachineState
> > *machine)
> > }
> >
> > for (i = 0; i < mc->compat_props->len; i++) {
> > + ObjectClass *oc;
>
> Move the declaration out of the loop?
I will do it on v2.
>
> > p = g_array_index(mc->compat_props, GlobalProperty *, i);
> > - /* Machine compat_props must never cause errors: */
> > - p->errp = &error_abort;
> > - qdev_prop_register_global(p);
> > + oc = object_class_by_name(p->driver);
> > + if (oc && object_class_is_abstract(oc)) {
> > + /* temporary hack to make sure we will never override
> > + * globals set explicitly on -global: if an abstract class
> > + * is on compat_props, register globals for each of their
> > + * subclasses instead.
> > + */
>
> I think this should not just be a 'temporary hack'... rather document
> this behaviour for abstract classes?
I'm not sure. I believe the translation from abstract superclass
to subclasses just emulates the behavior implemented by Greg Kurz
at "qdev: fix the order compat and global properties are applied"
in a more complicated way (and only for compat_props, not for
-global).
This hack specifically would not be enough because it affects
only compat_props, and still behaves in a weird way when
non-abstract classes have subclasses.
>
> > + object_class_foreach(machine_register_compat_for_subclass,
> > + p->driver, false, p);
> > + } else {
> > + register_compat_prop(p->driver, p->property, p->value);
> > + }
> > }
> > }
> >
>
--
Eduardo
- Re: [Qemu-stable] [PATCH] virtio: fix HW_COMPAT_2_6 macro for virtio-*-pci drivers, (continued)
- Re: [Qemu-stable] [RFC for-2.8] machine: Convert abstract typename on compat_props to subclass names, Cornelia Huck, 2016/12/12
- Re: [Qemu-stable] [RFC for-2.8] machine: Convert abstract typename on compat_props to subclass names,
Eduardo Habkost <=
- Re: [Qemu-stable] [Qemu-devel] [RFC for-2.8] machine: Convert abstract typename on compat_props to subclass names, Halil Pasic, 2016/12/12
- Re: [Qemu-stable] [Qemu-devel] [RFC for-2.8] machine: Convert abstract typename on compat_props to subclass names, Eduardo Habkost, 2016/12/12
- Re: [Qemu-stable] [Qemu-devel] [RFC for-2.8] machine: Convert abstract typename on compat_props to subclass names, Halil Pasic, 2016/12/12
Re: [Qemu-stable] [PATCH] virtio: fix HW_COMPAT_2_6 macro for virtio-*-pci drivers, Michael S. Tsirkin, 2016/12/06
- Re: [Qemu-stable] [PATCH] virtio: fix HW_COMPAT_2_6 macro for virtio-*-pci drivers, Eduardo Habkost, 2016/12/06
- Re: [Qemu-stable] [PATCH] virtio: fix HW_COMPAT_2_6 macro for virtio-*-pci drivers, Michael S. Tsirkin, 2016/12/06
- Re: [Qemu-stable] [PATCH] virtio: fix HW_COMPAT_2_6 macro for virtio-*-pci drivers, Eduardo Habkost, 2016/12/06
- Re: [Qemu-stable] [PATCH] virtio: fix HW_COMPAT_2_6 macro for virtio-*-pci drivers, Michael S. Tsirkin, 2016/12/06
- Re: [Qemu-stable] [PATCH] virtio: fix HW_COMPAT_2_6 macro for virtio-*-pci drivers, Eduardo Habkost, 2016/12/06
- Re: [Qemu-stable] [Qemu-devel] [PATCH] virtio: fix HW_COMPAT_2_6 macro for virtio-*-pci drivers, Stefan Hajnoczi, 2016/12/06