qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH RFC 2/3] qom: Introduce object_realize()


From: Andreas Färber
Subject: [Qemu-devel] [PATCH RFC 2/3] qom: Introduce object_realize()
Date: Mon, 26 Mar 2012 15:46:51 +0200

Wrap setting of Object::realized property, error reporting and exit(1)
into a helper function.

Signed-off-by: Andreas Färber <address@hidden>
Cc: Anthony Liguori <address@hidden>
Cc: Paolo Bonzini <address@hidden>
---
 include/qemu/object.h |    9 +++++++++
 qom/object.c          |   11 +++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/include/qemu/object.h b/include/qemu/object.h
index 742b5b6..dc8ae0f 100644
--- a/include/qemu/object.h
+++ b/include/qemu/object.h
@@ -467,6 +467,15 @@ void object_initialize_with_type(void *data, Type type);
 void object_initialize(void *obj, const char *typename);
 
 /**
+ * object_realize:
+ * @obj: The object to realize.
+ *
+ * This function will complete the initialization of an object based on
+ * properties set by setting the "realized" property to true.
+ */
+void object_realize(Object *obj);
+
+/**
  * object_finalize:
  * @obj: The object to finalize.
  *
diff --git a/qom/object.c b/qom/object.c
index ec143ad..33f6efc 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -327,6 +327,17 @@ void object_initialize(void *data, const char *typename)
     object_initialize_with_type(data, type);
 }
 
+void object_realize(Object *obj)
+{
+    Error *err = NULL;
+
+    object_property_set_bool(obj, true, "realized", &err);
+    if (error_is_set(&err)) {
+        qerror_report_err(err);
+        exit(1);
+    }
+}
+
 static void object_property_del_all(Object *obj)
 {
     while (!QTAILQ_EMPTY(&obj->properties)) {
-- 
1.7.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]