qdev: put all devices under /machine

Avoid cluttering too much the QOM root.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
Paolo Bonzini 2012-03-28 16:34:12 +02:00 committed by Anthony Liguori
parent da57febfed
commit f05f6b4adb
5 changed files with 18 additions and 5 deletions

View file

@ -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,