hw: apply accel compat properties without touching globals

Instead of registering compat properties as globals, let's keep them
in their own array, to avoid mixing with user globals.

Introduce object_apply_global_props() function, to apply compatibility
properties from a GPtrArray.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Acked-by: Eduardo Habkost <ehabkost@redhat.com>
This commit is contained in:
Marc-André Lureau 2018-11-26 22:04:32 +04:00
parent e59dbbac03
commit ea9ce8934c
8 changed files with 54 additions and 19 deletions

View file

@ -267,6 +267,16 @@ typedef struct GlobalProperty {
Error **errp;
} GlobalProperty;
static inline void
compat_props_add(GPtrArray *arr,
GlobalProperty props[], size_t nelem)
{
int i;
for (i = 0; i < nelem; i++) {
g_ptr_array_add(arr, (void *)&props[i]);
}
}
/*** Board API. This should go away once we have a machine config file. ***/
DeviceState *qdev_create(BusState *bus, const char *name);