From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36738) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uyj1T-0003wk-A3 for qemu-devel@nongnu.org; Mon, 15 Jul 2013 09:41:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uyj1O-0006l1-EN for qemu-devel@nongnu.org; Mon, 15 Jul 2013 09:41:03 -0400 Received: from cantor2.suse.de ([195.135.220.15]:42104 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uyj1O-0006kt-5E for qemu-devel@nongnu.org; Mon, 15 Jul 2013 09:40:58 -0400 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Mon, 15 Jul 2013 15:40:39 +0200 Message-Id: <1373895639-21476-4-git-send-email-afaerber@suse.de> In-Reply-To: <1373895639-21476-1-git-send-email-afaerber@suse.de> References: <1373895639-21476-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 3/3] qdev: Assert no new devices get created during realization 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 This is safe because current devices are already realized at this point and busses are not devices. Signed-off-by: Andreas F=C3=A4rber --- hw/core/qdev.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/hw/core/qdev.c b/hw/core/qdev.c index ec621cd..e86e72d 100644 --- a/hw/core/qdev.c +++ b/hw/core/qdev.c @@ -33,6 +33,7 @@ #include "qapi/qmp/qjson.h" #include "monitor/monitor.h" =20 +static bool devices_realizing; int qdev_hotplug =3D 0; static bool qdev_hot_added =3D false; static bool qdev_hot_removed =3D false; @@ -354,7 +355,9 @@ void qdev_machine_creation_done(void) { Error *err =3D NULL; =20 + devices_realizing =3D true; object_child_foreach(qdev_get_machine(), object_realize_one, &err); + devices_realizing =3D false; if (err !=3D NULL) { qerror_report_err(err); error_free(err); @@ -808,6 +811,8 @@ static void device_initfn(Object *obj) Property *prop; Error *err =3D NULL; =20 + assert(!devices_realizing); + if (qdev_hotplug) { dev->hotplugged =3D 1; qdev_hot_added =3D true; --=20 1.8.1.4