[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[RFC PATCH 03/12] qom: Make object_configure() public
From: |
Kevin Wolf |
Subject: |
[RFC PATCH 03/12] qom: Make object_configure() public |
Date: |
Wed, 3 Nov 2021 18:29:53 +0100 |
This makes object_configure() public and moves it to qom/object.c
because it will need to access TypeImpl in the future.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
include/qom/object.h | 3 +++
qom/object.c | 17 +++++++++++++++++
qom/object_interfaces.c | 17 -----------------
3 files changed, 20 insertions(+), 17 deletions(-)
diff --git a/include/qom/object.h b/include/qom/object.h
index faae0d841f..d67ba2411d 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -770,6 +770,9 @@ void object_initialize_child_internal(Object *parent, const
char *propname,
void *child, size_t size,
const char *type);
+/** TODO */
+void object_configure(Object *obj, Visitor *v, Error **errp);
+
/**
* object_dynamic_cast:
* @obj: The object to cast.
diff --git a/qom/object.c b/qom/object.c
index 6be710bc40..d8da362987 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -605,6 +605,23 @@ void object_initialize_child_internal(Object *parent,
&error_abort, NULL);
}
+void object_configure(Object *obj, Visitor *v, Error **errp)
+{
+ const char *key;
+
+ if (!visit_start_struct(v, NULL, NULL, 0, errp)) {
+ return;
+ }
+ while ((key = visit_next_struct_member(v))) {
+ if (!object_property_set(obj, key, v, errp)) {
+ goto out;
+ }
+ }
+ visit_check_struct(v, errp);
+out:
+ visit_end_struct(v, NULL);
+}
+
static inline bool object_property_is_child(ObjectProperty *prop)
{
return strstart(prop->type, "child<", NULL);
diff --git a/qom/object_interfaces.c b/qom/object_interfaces.c
index f9f5608194..0e8875bf04 100644
--- a/qom/object_interfaces.c
+++ b/qom/object_interfaces.c
@@ -42,23 +42,6 @@ bool user_creatable_can_be_deleted(UserCreatable *uc)
}
}
-static void object_configure(Object *obj, Visitor *v, Error **errp)
-{
- const char *key;
-
- if (!visit_start_struct(v, NULL, NULL, 0, errp)) {
- return;
- }
- while ((key = visit_next_struct_member(v))) {
- if (!object_property_set(obj, key, v, errp)) {
- goto out;
- }
- }
- visit_check_struct(v, errp);
-out:
- visit_end_struct(v, NULL);
-}
-
void object_set_properties_from_keyval(Object *obj, const QDict *qdict,
bool from_json, Error **errp)
{
--
2.31.1
- [RFC PATCH 00/12] QOM/QAPI integration part 1, Kevin Wolf, 2021/11/03
- [RFC PATCH 02/12] qom: Create object_configure(), Kevin Wolf, 2021/11/03
- [RFC PATCH 01/12] qapi: Add visit_next_struct_member(), Kevin Wolf, 2021/11/03
- [RFC PATCH 03/12] qom: Make object_configure() public,
Kevin Wolf <=
- [RFC PATCH 04/12] qom: Add instance_config() to TypeInfo, Kevin Wolf, 2021/11/03
- [RFC PATCH 05/12] rng-random: Implement .instance_config, Kevin Wolf, 2021/11/03
- [RFC PATCH 06/12] rng-backend: Implement .instance_config, Kevin Wolf, 2021/11/03
- [RFC PATCH 07/12] qapi: Allow defining QOM classes, Kevin Wolf, 2021/11/03
- [RFC PATCH 08/12] qapi: Create qom-config:... type for classes, Kevin Wolf, 2021/11/03
- [RFC PATCH 09/12] qapi/qom: Convert rng-backend/random to class, Kevin Wolf, 2021/11/03
- [RFC PATCH 12/12] qapi/qom: Add class definition for rng-egd, Kevin Wolf, 2021/11/03