aboutsummaryrefslogtreecommitdiff
path: root/qom/object.c
diff options
context:
space:
mode:
authorMarc-André Lureau <marcandre.lureau@redhat.com>2018-11-26 22:04:32 +0400
committerMarc-André Lureau <marcandre.lureau@redhat.com>2019-01-07 16:18:41 +0400
commitea9ce8934c5d2cc8925359a6d8d45eb829a9f27f (patch)
tree927bdc1c7297f53a40ea456884ebde99e60c39c3 /qom/object.c
parente59dbbac0364344a3ad84c3497a98c56003d3fb8 (diff)
downloadqemu-ea9ce8934c5d2cc8925359a6d8d45eb829a9f27f.zip
qemu-ea9ce8934c5d2cc8925359a6d8d45eb829a9f27f.tar.gz
qemu-ea9ce8934c5d2cc8925359a6d8d45eb829a9f27f.tar.bz2
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>
Diffstat (limited to 'qom/object.c')
-rw-r--r--qom/object.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/qom/object.c b/qom/object.c
index 17921c0..dbdab0a 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -370,6 +370,31 @@ static void object_post_init_with_type(Object *obj, TypeImpl *ti)
}
}
+void object_apply_global_props(Object *obj, const GPtrArray *props, Error **errp)
+{
+ Error *err = NULL;
+ int i;
+
+ if (!props) {
+ return;
+ }
+
+ for (i = 0; i < props->len; i++) {
+ GlobalProperty *p = g_ptr_array_index(props, i);
+
+ if (object_dynamic_cast(obj, p->driver) == NULL) {
+ continue;
+ }
+ p->used = true;
+ object_property_parse(obj, p->value, p->property, &err);
+ if (err != NULL) {
+ error_prepend(&err, "can't apply global %s.%s=%s: ",
+ p->driver, p->property, p->value);
+ error_propagate(errp, err);
+ }
+ }
+}
+
static void object_initialize_with_type(void *data, size_t size, TypeImpl *type)
{
Object *obj = data;