qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Dr. David Alan Gilbert (git)" <dgilbert@redhat.com>
To: qemu-devel@nongnu.org, berrange@redhat.com, cohuck@redhat.com,
	mst@redhat.com
Subject: [Qemu-devel] [PATCH v2 1/2] Revert "Revert "globals: Allow global properties to be optional""
Date: Mon, 29 Jul 2019 17:29:02 +0100	[thread overview]
Message-ID: <20190729162903.4489-2-dgilbert@redhat.com> (raw)
In-Reply-To: <20190729162903.4489-1-dgilbert@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

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 <dgilbert@redhat.com>
---
 include/hw/qdev-core.h | 3 +++
 qom/object.c           | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index e157fc4acd..136df7774c 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -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
diff --git a/qom/object.c b/qom/object.c
index 3966a3d461..1555547727 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -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) {
-- 
2.21.0



WARNING: multiple messages have this Message-ID (diff)
From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Peter Maydell" <peter.maydell@linaro.org>,
	"Daniel P. Berrangé" <berrange@redhat.com>,
	"Eduardo Habkost" <ehabkost@redhat.com>,
	"Cornelia Huck" <cohuck@redhat.com>,
	"Dr. David Alan Gilbert" <dgilbert@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: [Qemu-devel] [PULL 1/3] Revert "Revert "globals: Allow global properties to be optional""
Date: Mon, 29 Jul 2019 17:16:03 -0400	[thread overview]
Message-ID: <20190729162903.4489-2-dgilbert@redhat.com> (raw)
Message-ID: <20190729211603.TWAn8DUF8pFfWg9RwqzBnmx9axYgHpaXYomPGlIqhNY@z> (raw)
In-Reply-To: <20190729211404.1533-1-mst@redhat.com>

From: "Dr. David Alan Gilbert" <dgilbert@redhat.com>

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 <dgilbert@redhat.com>
Message-Id: <20190729162903.4489-2-dgilbert@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
---
 include/hw/qdev-core.h | 3 +++
 qom/object.c           | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index e157fc4acd..136df7774c 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -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
diff --git a/qom/object.c b/qom/object.c
index 3966a3d461..1555547727 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -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) {
-- 
MST



  reply	other threads:[~2019-07-29 16:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-29 16:29 [Qemu-devel] [For 4.1 PATCH v2 0/2] Reversions to fix PCIe in virtio Dr. David Alan Gilbert (git)
2019-07-29 16:29 ` Dr. David Alan Gilbert (git) [this message]
2019-07-29 16:30   ` [Qemu-devel] [PATCH v2 1/2] Revert "Revert "globals: Allow global properties to be optional"" Daniel P. Berrangé
2019-07-29 16:46   ` Cornelia Huck
2019-07-29 21:16   ` [Qemu-devel] [PULL 1/3] " Michael S. Tsirkin
2019-07-29 16:29 ` [Qemu-devel] [PATCH v2 2/2] Revert "hw: report invalid disable-legacy|modern usage for virtio-1-only devs" Dr. David Alan Gilbert (git)
2019-07-29 16:31   ` Daniel P. Berrangé
2019-07-29 16:46   ` Cornelia Huck
2019-07-29 21:16   ` [Qemu-devel] [PULL 2/3] " Michael S. Tsirkin
2019-07-29 16:32 ` [Qemu-devel] [For 4.1 PATCH v2 0/2] Reversions to fix PCIe in virtio Cornelia Huck
2019-07-29 16:35   ` Dr. David Alan Gilbert
2019-07-29 16:43     ` Peter Maydell
2019-07-29 16:45       ` Daniel P. Berrangé
  -- strict thread matches above, loose matches on Subject: below --
2019-07-29 21:15 [Qemu-devel] [PULL 0/3] virtio, pc: fixes Michael S. Tsirkin
2019-07-23 16:08 ` [Qemu-devel] [PATCH] pc-dimm: fix crash when invalid slot number is used Igor Mammedov
2019-07-24  3:18   ` David Gibson
2019-07-24  6:13   ` Li Qiang
2019-07-24  6:39   ` Pankaj Gupta
2019-07-29 21:16   ` [Qemu-devel] [PULL 3/3] " Michael S. Tsirkin
2019-07-30 12:36   ` Igor Mammedov
2019-07-30 15:50     ` Michael S. Tsirkin
2019-07-30  9:44 ` [Qemu-devel] [PULL 0/3] virtio, pc: fixes Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190729162903.4489-2-dgilbert@redhat.com \
    --to=dgilbert@redhat.com \
    --cc=berrange@redhat.com \
    --cc=cohuck@redhat.com \
    --cc=mst@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).