qom: Move compat_props machinery from qdev to QOM

See the previous commit for rationale.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20190308131445.17502-3-armbru@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
Markus Armbruster 2019-03-08 14:14:35 +01:00
parent 1a3ec8c156
commit 617902af2c
4 changed files with 42 additions and 43 deletions

View file

@ -978,45 +978,6 @@ static void device_initfn(Object *obj)
QLIST_INIT(&dev->gpios);
}
/*
* Global property defaults
* Slot 0: accelerator's global property defaults
* Slot 1: machine's global property defaults
* Each is a GPtrArray of of GlobalProperty.
* Applied in order, later entries override earlier ones.
*/
static GPtrArray *object_compat_props[2];
/*
* Set machine's global property defaults to @compat_props.
* May be called at most once.
*/
void object_set_machine_compat_props(GPtrArray *compat_props)
{
assert(!object_compat_props[1]);
object_compat_props[1] = compat_props;
}
/*
* Set accelerator's global property defaults to @compat_props.
* May be called at most once.
*/
void object_set_accelerator_compat_props(GPtrArray *compat_props)
{
assert(!object_compat_props[0]);
object_compat_props[0] = compat_props;
}
void object_apply_compat_props(Object *obj)
{
int i;
for (i = 0; i < ARRAY_SIZE(object_compat_props); i++) {
object_apply_global_props(obj, object_compat_props[i],
&error_abort);
}
}
static void device_post_init(Object *obj)
{
/*