From f05f6b4adb4db3affb0cdd17383b0a7e905e66e1 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Wed, 28 Mar 2012 16:34:12 +0200 Subject: qdev: put all devices under /machine Avoid cluttering too much the QOM root. Signed-off-by: Paolo Bonzini Signed-off-by: Anthony Liguori --- hw/qdev.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'hw/qdev.c') diff --git a/hw/qdev.c b/hw/qdev.c index f5c716e87a..0d3c0fc49c 100644 --- a/hw/qdev.c +++ b/hw/qdev.c @@ -157,7 +157,7 @@ int qdev_init(DeviceState *dev) static int unattached_count = 0; gchar *name = g_strdup_printf("device[%d]", unattached_count++); - object_property_add_child(container_get("/unattached"), name, + object_property_add_child(container_get("/machine/unattached"), name, OBJECT(dev), NULL); g_free(name); } @@ -668,6 +668,17 @@ void device_reset(DeviceState *dev) } } +Object *qdev_get_machine(void) +{ + static Object *dev; + + if (dev == NULL) { + dev = container_get("/machine"); + } + + return dev; +} + static TypeInfo device_type_info = { .name = TYPE_DEVICE, .parent = TYPE_OBJECT, -- cgit v1.2.3