]> Git Repo - qemu.git/commitdiff
Revert "Revert "globals: Allow global properties to be optional""
authorDr. David Alan Gilbert <[email protected]>
Mon, 29 Jul 2019 16:29:02 +0000 (17:29 +0100)
committerMichael S. Tsirkin <[email protected]>
Mon, 29 Jul 2019 20:57:27 +0000 (16:57 -0400)
This reverts commit 8fa70dbd8bb478d9483c1da3e9976a2d86b3f9a0.

Because we're about to revert it's neighbour and thus uses an optional
again.

Signed-off-by: Dr. David Alan Gilbert <[email protected]>
Message-Id: <20190729162903[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
Reviewed-by: Cornelia Huck <[email protected]>
include/hw/qdev-core.h
qom/object.c

index e157fc4acd2d7e1dd93802f09d53e16bf6756f09..136df7774ca34361a610bff273a590ff8add8984 100644 (file)
@@ -252,6 +252,8 @@ struct PropertyInfo {
 /**
  * GlobalProperty:
  * @used: Set to true if property was used when initializing a device.
+ * @optional: If set to true, GlobalProperty will be skipped without errors
+ *            if the property doesn't exist.
  *
  * An error is fatal for non-hotplugged devices, when the global is applied.
  */
@@ -260,6 +262,7 @@ typedef struct GlobalProperty {
     const char *property;
     const char *value;
     bool used;
+    bool optional;
 } GlobalProperty;
 
 static inline void
index 3966a3d461c40179f560f3f7d49851a9f9726e3b..1555547727c4aa77b8a837343dee2fa7c3df3859 100644 (file)
@@ -386,6 +386,9 @@ void object_apply_global_props(Object *obj, const GPtrArray *props, Error **errp
         if (object_dynamic_cast(obj, p->driver) == NULL) {
             continue;
         }
+        if (p->optional && !object_property_find(obj, p->property, NULL)) {
+            continue;
+        }
         p->used = true;
         object_property_parse(obj, p->value, p->property, &err);
         if (err != NULL) {
This page took 0.029862 seconds and 4 git commands to generate.