summaryrefslogtreecommitdiffstats
path: root/qom/object.c
diff options
context:
space:
mode:
authorPeter Maydell2019-01-07 16:32:24 +0100
committerPeter Maydell2019-01-07 16:32:24 +0100
commit31ed41889e6e13699871040fe089a2884dca46cb (patch)
treec045cb2dfafade1ee80ae448f2ebaaf2a90d6cc8 /qom/object.c
parentMerge remote-tracking branch 'remotes/ericb/tags/pull-nbd-2019-01-05' into st... (diff)
parenthostmem: use object id for memory region name with >= 4.0 (diff)
downloadqemu-31ed41889e6e13699871040fe089a2884dca46cb.tar.gz
qemu-31ed41889e6e13699871040fe089a2884dca46cb.tar.xz
qemu-31ed41889e6e13699871040fe089a2884dca46cb.zip
Merge remote-tracking branch 'remotes/elmarco/tags/machine-props-pull-request' into staging
Generalize machine compatibility properties During "[PATCH v2 05/10] qom/globals: generalize object_property_set_globals()" review, Eduardo suggested to rework the GlobalProperty handling, so that -global is limited to QDev only and we avoid mixing the machine compats and the user-provided -global properties (instead of generalizing -global to various object kinds, like I proposed in v2). "qdev: do not mix compat props with global props" patch decouples a bit user-provided -global from machine compat properties. This allows to get rid of "user_provided" and "errp" fields in following patches. A new compat property "x-use-canonical-path-for-ramblock-id" is added to hostmem for legacy canonical path names, set to true for -file and -memfd with qemu < 4.0. (this series was initially titled "[PATCH v2 00/10] hostmem: use object "id" for memory region name with >= 3.1", but its focus is more in refactoring the global and compatilibity properties handling now) # gpg: Signature made Mon 07 Jan 2019 12:22:43 GMT # gpg: using RSA key DAE8E10975969CE5 # gpg: Good signature from "Marc-André Lureau <marcandre.lureau@redhat.com>" # gpg: aka "Marc-André Lureau <marcandre.lureau@gmail.com>" # Primary key fingerprint: 87A9 BD93 3F87 C606 D276 F62D DAE8 E109 7596 9CE5 * remotes/elmarco/tags/machine-props-pull-request: (28 commits) hostmem: use object id for memory region name with >= 4.0 arm: replace instance_post_init() qdev-props: call object_apply_global_props() qdev-props: remove errp from GlobalProperty qdev-props: convert global_props to GPtrArray qdev: all globals are now user-provided qdev: make a separate helper function to apply compat properties compat: remove remaining PC_COMPAT macros include: remove compat.h compat: replace PC_COMPAT_2_1 & HW_COMPAT_2_1 macros compat: replace PC_COMPAT_2_2 & HW_COMPAT_2_2 macros compat: replace PC_COMPAT_2_3 & HW_COMPAT_2_3 macros compat: replace PC_COMPAT_2_4 & HW_COMPAT_2_4 macros compat: replace PC_COMPAT_2_5 & HW_COMPAT_2_5 macros compat: replace PC_COMPAT_2_6 & HW_COMPAT_2_6 macros compat: replace PC_COMPAT_2_7 & HW_COMPAT_2_7 macros compat: replace PC_COMPAT_2_8 & HW_COMPAT_2_8 macros compat: replace PC_COMPAT_2_9 & HW_COMPAT_2_9 macros compat: replace PC_COMPAT_2_10 & HW_COMPAT_2_10 macros compat: replace PC_COMPAT_2_11 & HW_COMPAT_2_11 macros ... Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'qom/object.c')
-rw-r--r--qom/object.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/qom/object.c b/qom/object.c
index 17921c0a71..aa6f3a2a71 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -370,6 +370,41 @@ 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);
+ /*
+ * If errp != NULL, propagate error and return.
+ * If errp == NULL, report a warning, but keep going
+ * with the remaining globals.
+ */
+ if (errp) {
+ error_propagate(errp, err);
+ return;
+ } else {
+ warn_report_err(err);
+ }
+ }
+ }
+}
+
static void object_initialize_with_type(void *data, size_t size, TypeImpl *type)
{
Object *obj = data;