From: Eduardo Habkost <ehabkost@redhat.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: Greg Kurz <groug@kaod.org>,
qemu-devel@nongnu.org, Halil Pasic <pasic@linux.vnet.ibm.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
qemu-stable@nongnu.org, Stefan Hajnoczi <stefanha@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [RFC for-2.8] machine: Convert abstract typename on compat_props to subclass names
Date: Mon, 12 Dec 2016 15:36:41 -0200 [thread overview]
Message-ID: <20161212173641.GD3808@thinpad.lan.raisama.net> (raw)
In-Reply-To: <20161212132509.6a031fb6.cornelia.huck@de.ibm.com>
On Mon, Dec 12, 2016 at 01:25:09PM +0100, Cornelia Huck wrote:
> On Tue, 6 Dec 2016 17:31:59 -0200
> Eduardo Habkost <ehabkost@redhat.com> 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 <ehabkost@redhat.com>
> > ---
> > 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
next prev parent reply other threads:[~2016-12-12 17:36 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-06 17:50 [Qemu-devel] [PATCH] virtio: fix HW_COMPAT_2_6 macro for virtio-*-pci drivers Greg Kurz
2016-12-06 18:02 ` Cornelia Huck
2016-12-06 18:46 ` Eduardo Habkost
2016-12-06 19:19 ` Eduardo Habkost
2016-12-06 19:31 ` [Qemu-devel] [RFC for-2.8] machine: Convert abstract typename on compat_props to subclass names Eduardo Habkost
2016-12-07 13:39 ` Greg Kurz
2016-12-07 13:59 ` Eduardo Habkost
2016-12-07 14:58 ` Greg Kurz
2016-12-09 20:06 ` Eduardo Habkost
2016-12-12 11:26 ` Cornelia Huck
2016-12-12 11:39 ` Greg Kurz
2016-12-12 12:25 ` Cornelia Huck
2016-12-12 17:13 ` Halil Pasic
2016-12-12 17:47 ` Eduardo Habkost
2016-12-12 18:00 ` Halil Pasic
2016-12-12 17:36 ` Eduardo Habkost [this message]
2016-12-06 19:31 ` [Qemu-devel] [PATCH] virtio: fix HW_COMPAT_2_6 macro for virtio-*-pci drivers Michael S. Tsirkin
2016-12-06 19:33 ` Eduardo Habkost
2016-12-06 19:36 ` Michael S. Tsirkin
2016-12-06 19:40 ` Eduardo Habkost
2016-12-06 19:44 ` Michael S. Tsirkin
2016-12-06 19:48 ` Eduardo Habkost
2016-12-06 20:30 ` Stefan Hajnoczi
2016-12-07 8:36 ` Greg Kurz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161212173641.GD3808@thinpad.lan.raisama.net \
--to=ehabkost@redhat.com \
--cc=cornelia.huck@de.ibm.com \
--cc=groug@kaod.org \
--cc=mst@redhat.com \
--cc=pasic@linux.vnet.ibm.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=qemu-stable@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.