From ea9ce8934c5d2cc8925359a6d8d45eb829a9f27f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Lureau?= Date: Mon, 26 Nov 2018 22:04:32 +0400 Subject: hw: apply accel compat properties without touching globals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Igor Mammedov Reviewed-by: Cornelia Huck Acked-by: Eduardo Habkost --- include/hw/qdev-core.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/hw/qdev-core.h') diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h index 92851e55df..84e612f473 100644 --- a/include/hw/qdev-core.h +++ b/include/hw/qdev-core.h @@ -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); -- cgit v1.2.3