From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:59289) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCAGE-0001DK-BH for qemu-devel@nongnu.org; Mon, 26 Mar 2012 09:47:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SCAGB-0003fe-TT for qemu-devel@nongnu.org; Mon, 26 Mar 2012 09:47:01 -0400 Received: from cantor2.suse.de ([195.135.220.15]:41050 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SCAGB-0003ct-ND for qemu-devel@nongnu.org; Mon, 26 Mar 2012 09:46:59 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Mon, 26 Mar 2012 15:46:51 +0200 Message-Id: <1332769612-4247-3-git-send-email-afaerber@suse.de> In-Reply-To: <1332769612-4247-1-git-send-email-afaerber@suse.de> References: <1332769612-4247-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH RFC 2/3] qom: Introduce object_realize() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Anthony Liguori Wrap setting of Object::realized property, error reporting and exit(1) into a helper function. Signed-off-by: Andreas F=C3=A4rber Cc: Anthony Liguori Cc: Paolo Bonzini --- 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 ty= pe); void object_initialize(void *obj, const char *typename); =20 /** + * 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 *typen= ame) object_initialize_with_type(data, type); } =20 +void object_realize(Object *obj) +{ + Error *err =3D 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)) { --=20 1.7.7