mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 23:33:54 -06:00
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:
parent
da57febfed
commit
f05f6b4adb
5 changed files with 18 additions and 5 deletions
13
hw/qdev.c
13
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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue