[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2] qom: Introduce object_realize_nofail()
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH v2] qom: Introduce object_realize_nofail() |
Date: |
Thu, 12 Apr 2012 15:44:23 +0200 |
Wrap setting of Object::realized property, error reporting and exit(1)
into a helper function. It is the equivalent of qdev_init_nofail().
Signed-off-by: Andreas Färber <address@hidden>
Cc: Anthony Liguori <address@hidden>
Cc: Paolo Bonzini <address@hidden>
Cc: Peter Maydell <address@hidden>
---
Hi Paolo, please consider appending this patch to your push-push series.
It then provides equivalent second-stage init functionality for non-qdev
objects, as desired for ARMCPU and SH7750 SoC.
include/qemu/object.h | 10 ++++++++++
qom/object.c | 11 +++++++++++
2 files changed, 21 insertions(+), 0 deletions(-)
diff --git a/include/qemu/object.h b/include/qemu/object.h
index 360181d..524d3b0 100644
--- a/include/qemu/object.h
+++ b/include/qemu/object.h
@@ -504,6 +504,16 @@ void object_initialize_with_type(void *data, Type type);
void object_initialize(void *obj, const char *typename);
/**
+ * object_realize_nofail:
+ * @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.
+ * Like #qdev_init_nofail it will terminate the process in case of errors.
+ */
+void object_realize_nofail(Object *obj);
+
+/**
* object_finalize:
* @obj: The object to finalize.
*
diff --git a/qom/object.c b/qom/object.c
index f4f29ab..1ef0b9b 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -381,6 +381,17 @@ void object_initialize(void *data, const char *typename)
object_initialize_with_type(data, type);
}
+void object_realize_nofail(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
- Re: [Qemu-devel] [PATCH v2 17/24] qdev: remove qdev_prop_exists, (continued)
- [Qemu-devel] [PATCH v2 16/24] qdev: remove PropertyInfo range checking, Paolo Bonzini, 2012/04/11
- [Qemu-devel] [PATCH v2 18/24] qdev: push state up to Object, Paolo Bonzini, 2012/04/11
- [Qemu-devel] [PATCH v2 23/24] qdev: implement qdev_init on top of realize, Paolo Bonzini, 2012/04/11
- [Qemu-devel] [PATCH v2 24/24] qdev: split part of device_finalize to device_unrealize, Paolo Bonzini, 2012/04/11
- [Qemu-devel] [PATCH v2 21/24] qom: push static properties to Object, Paolo Bonzini, 2012/04/11
- [Qemu-devel] [PATCH v2 20/24] qdev: move bulk of qdev-properties.c to qom/object.c, Paolo Bonzini, 2012/04/11
- [Qemu-devel] [PATCH v2 22/24] qom: add realized property, Paolo Bonzini, 2012/04/11
- [Qemu-devel] [PATCH v2 19/24] qdev: generalize properties to Objects, Paolo Bonzini, 2012/04/11
- [Qemu-devel] [PATCH v2] qom: Introduce object_realize_nofail(),
Andreas Färber <=
- Re: [Qemu-devel] [PATCH v2] qom: Introduce object_realize_nofail(), Anthony Liguori, 2012/04/12
- Re: [Qemu-devel] [PATCH v2] qom: Introduce object_realize_nofail(), Andreas Färber, 2012/04/12
- Re: [Qemu-devel] [PATCH v2] qom: Introduce object_realize_nofail(), Paolo Bonzini, 2012/04/12
- Re: [Qemu-devel] [PATCH v2] qom: Introduce object_realize_nofail(), Anthony Liguori, 2012/04/12
- Re: [Qemu-devel] [PATCH v2] qom: Introduce object_realize_nofail(), Peter Maydell, 2012/04/12
- Re: [Qemu-devel] [PATCH v2] qom: Introduce object_realize_nofail(), Anthony Liguori, 2012/04/12
- Re: [Qemu-devel] [PATCH v2] qom: Introduce object_realize_nofail(), Peter Maydell, 2012/04/12
- Re: [Qemu-devel] [PATCH v2] qom: Introduce object_realize_nofail(), Paolo Bonzini, 2012/04/12
- Re: [Qemu-devel] [PATCH v2] qom: Introduce object_realize_nofail(), Anthony Liguori, 2012/04/12
- Re: [Qemu-devel] [PATCH v2] qom: Introduce object_realize_nofail(), Andreas Färber, 2012/04/12