[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH RFC 3/3] qdev: Assert no new devices get created dur
From: |
Andreas Färber |
Subject: |
[Qemu-devel] [PATCH RFC 3/3] qdev: Assert no new devices get created during realization |
Date: |
Mon, 15 Jul 2013 15:40:39 +0200 |
This is safe because current devices are already realized at this point
and busses are not devices.
Signed-off-by: Andreas Färber <address@hidden>
---
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"
+static bool devices_realizing;
int qdev_hotplug = 0;
static bool qdev_hot_added = false;
static bool qdev_hot_removed = false;
@@ -354,7 +355,9 @@ void qdev_machine_creation_done(void)
{
Error *err = NULL;
+ devices_realizing = true;
object_child_foreach(qdev_get_machine(), object_realize_one, &err);
+ devices_realizing = false;
if (err != NULL) {
qerror_report_err(err);
error_free(err);
@@ -808,6 +811,8 @@ static void device_initfn(Object *obj)
Property *prop;
Error *err = NULL;
+ assert(!devices_realizing);
+
if (qdev_hotplug) {
dev->hotplugged = 1;
qdev_hot_added = true;
--
1.8.1.4