mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-02 15:23:53 -06:00
qom: Refine container_get() to allow using a custom root
Specify the root to search from as argument. This avoids hardcoding "/machine" in some places and makes it more flexible. Signed-off-by: Andreas Färber <afaerber@suse.de> Cc: Paolo Bonzini <pbonzini@redhat.com> Cc: Anthony Liguori <anthony@codemonkey.ws> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
7f3bf92fad
commit
dfe47e7029
4 changed files with 10 additions and 8 deletions
|
@ -158,8 +158,9 @@ 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("/machine/unattached"), name,
|
||||
OBJECT(dev), NULL);
|
||||
object_property_add_child(container_get(qdev_get_machine(),
|
||||
"/unattached"),
|
||||
name, OBJECT(dev), NULL);
|
||||
g_free(name);
|
||||
}
|
||||
|
||||
|
@ -677,7 +678,7 @@ Object *qdev_get_machine(void)
|
|||
static Object *dev;
|
||||
|
||||
if (dev == NULL) {
|
||||
dev = container_get("/machine");
|
||||
dev = container_get(object_get_root(), "/machine");
|
||||
}
|
||||
|
||||
return dev;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue