From: Markus Armbruster <armbru@redhat.com>
To: qemu-devel@nongnu.org
Cc: pbonzini@redhat.com, lersek@redhat.com, kwolf@redhat.com,
mreitz@redhat.com, qemu-block@nongnu.org, pkrempa@redhat.com,
mst@redhat.com, marcel.apfelbaum@gmail.com
Subject: [Qemu-devel] [RFC PATCH 2/6] qom: Move compat_props machinery from qdev to QOM
Date: Mon, 25 Feb 2019 19:37:53 +0100 [thread overview]
Message-ID: <20190225183757.27378-3-armbru@redhat.com> (raw)
In-Reply-To: <20190225183757.27378-1-armbru@redhat.com>
See the previous commit for rationale.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
hw/core/qdev.c | 39 ---------------------------------------
include/hw/qdev-core.h | 4 ----
include/qom/object.h | 3 +++
qom/object.c | 39 +++++++++++++++++++++++++++++++++++++++
4 files changed, 42 insertions(+), 43 deletions(-)
diff --git a/hw/core/qdev.c b/hw/core/qdev.c
index 1a86c7990a..25dffad3ed 100644
--- a/hw/core/qdev.c
+++ b/hw/core/qdev.c
@@ -970,45 +970,6 @@ static void device_initfn(Object *obj)
QLIST_INIT(&dev->gpios);
}
-/*
- * Global property defaults
- * Slot 0: accelerator's global property defaults
- * Slot 1: machine's global property defaults
- * Each is a GPtrArray of of GlobalProperty.
- * Applied in order, later entries override earlier ones.
- */
-static GPtrArray *object_compat_props[2];
-
-/*
- * Set machine's global property defaults to @compat_props.
- * May be called at most once.
- */
-void object_set_machine_compat_props(GPtrArray *compat_props)
-{
- assert(!object_compat_props[1]);
- object_compat_props[1] = compat_props;
-}
-
-/*
- * Set accelerator's global property defaults to @compat_props.
- * May be called at most once.
- */
-void object_set_accelerator_compat_props(GPtrArray *compat_props)
-{
- assert(!object_compat_props[0]);
- object_compat_props[0] = compat_props;
-}
-
-void object_apply_compat_props(Object *obj)
-{
- int i;
-
- for (i = 0; i < ARRAY_SIZE(object_compat_props); i++) {
- object_apply_global_props(obj, object_compat_props[i],
- &error_abort);
- }
-}
-
static void device_post_init(Object *obj)
{
/*
diff --git a/include/hw/qdev-core.h b/include/hw/qdev-core.h
index bced1f2666..f2f0006234 100644
--- a/include/hw/qdev-core.h
+++ b/include/hw/qdev-core.h
@@ -418,10 +418,6 @@ const char *qdev_fw_name(DeviceState *dev);
Object *qdev_get_machine(void);
-void object_set_machine_compat_props(GPtrArray *compat_props);
-void object_set_accelerator_compat_props(GPtrArray *compat_props);
-void object_apply_compat_props(Object *obj);
-
/* FIXME: make this a link<> */
void qdev_set_parent_bus(DeviceState *dev, BusState *bus);
diff --git a/include/qom/object.h b/include/qom/object.h
index e0262962b5..288cdddf44 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -677,6 +677,9 @@ Object *object_new_with_propv(const char *typename,
void object_apply_global_props(Object *obj, const GPtrArray *props,
Error **errp);
+void object_set_machine_compat_props(GPtrArray *compat_props);
+void object_set_accelerator_compat_props(GPtrArray *compat_props);
+void object_apply_compat_props(Object *obj);
/**
* object_set_props:
diff --git a/qom/object.c b/qom/object.c
index b8c732063b..adb9b7fe91 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -408,6 +408,45 @@ void object_apply_global_props(Object *obj, const GPtrArray *props, Error **errp
}
}
+/*
+ * Global property defaults
+ * Slot 0: accelerator's global property defaults
+ * Slot 1: machine's global property defaults
+ * Each is a GPtrArray of of GlobalProperty.
+ * Applied in order, later entries override earlier ones.
+ */
+static GPtrArray *object_compat_props[2];
+
+/*
+ * Set machine's global property defaults to @compat_props.
+ * May be called at most once.
+ */
+void object_set_machine_compat_props(GPtrArray *compat_props)
+{
+ assert(!object_compat_props[1]);
+ object_compat_props[1] = compat_props;
+}
+
+/*
+ * Set accelerator's global property defaults to @compat_props.
+ * May be called at most once.
+ */
+void object_set_accelerator_compat_props(GPtrArray *compat_props)
+{
+ assert(!object_compat_props[0]);
+ object_compat_props[0] = compat_props;
+}
+
+void object_apply_compat_props(Object *obj)
+{
+ int i;
+
+ for (i = 0; i < ARRAY_SIZE(object_compat_props); i++) {
+ object_apply_global_props(obj, object_compat_props[i],
+ &error_abort);
+ }
+}
+
static void object_initialize_with_type(void *data, size_t size, TypeImpl *type)
{
Object *obj = data;
--
2.17.2
next prev parent reply other threads:[~2019-02-25 18:38 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-25 18:37 [Qemu-devel] [RFC PATCH 0/6] pc: Support firmware configuration with -blockdev Markus Armbruster
2019-02-25 18:37 ` [Qemu-devel] [RFC PATCH 1/6] qdev: Fix latent bug with compat_props and onboard devices Markus Armbruster
2019-02-26 12:28 ` Marc-André Lureau
2019-02-25 18:37 ` Markus Armbruster [this message]
2019-02-26 12:44 ` [Qemu-devel] [RFC PATCH 2/6] qom: Move compat_props machinery from qdev to QOM Marc-André Lureau
2019-03-04 15:57 ` Philippe Mathieu-Daudé
2019-03-05 6:52 ` Markus Armbruster
2019-02-25 18:37 ` [Qemu-devel] [RFC PATCH 3/6] vl: Fix latent bug with -global and onboard devices Markus Armbruster
2019-02-26 12:45 ` Marc-André Lureau
2019-02-25 18:37 ` [Qemu-devel] [RFC PATCH 4/6] sysbus: Fix latent bug with " Markus Armbruster
2019-02-26 12:48 ` Marc-André Lureau
2019-03-04 16:03 ` Philippe Mathieu-Daudé
2019-03-04 18:45 ` Thomas Huth
2019-03-05 6:54 ` Markus Armbruster
2019-03-05 7:17 ` Thomas Huth
2019-02-25 18:37 ` [Qemu-devel] [RFC PATCH 5/6] vl: Create block backends before setting machine properties Markus Armbruster
2019-03-04 16:14 ` Philippe Mathieu-Daudé
2019-03-05 10:38 ` Markus Armbruster
2019-03-05 11:34 ` Philippe Mathieu-Daudé
2019-03-05 14:07 ` Markus Armbruster
2019-02-25 18:37 ` [Qemu-devel] [RFC PATCH 6/6] pc: Support firmware configuration with -blockdev Markus Armbruster
2019-02-26 9:43 ` Laszlo Ersek
2019-02-26 12:35 ` Markus Armbruster
2019-02-26 16:21 ` Laszlo Ersek
2019-03-04 17:50 ` Markus Armbruster
2019-03-05 17:08 ` Laszlo Ersek
2019-03-06 6:12 ` Markus Armbruster
2019-03-04 19:14 ` Philippe Mathieu-Daudé
2019-03-04 19:52 ` Philippe Mathieu-Daudé
2019-03-05 11:31 ` Markus Armbruster
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=20190225183757.27378-3-armbru@redhat.com \
--to=armbru@redhat.com \
--cc=kwolf@redhat.com \
--cc=lersek@redhat.com \
--cc=marcel.apfelbaum@gmail.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=pkrempa@redhat.com \
--cc=qemu-block@nongnu.org \
--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).