summaryrefslogtreecommitdiffstats
path: root/hw/qdev.c
diff options
context:
space:
mode:
authorAndreas Färber2012-04-05 13:21:46 +0200
committerAnthony Liguori2012-04-24 16:50:31 +0200
commitdfe47e7029e117f65a14c0948021654f7f7d5d05 (patch)
tree9831f047090bf7bb7c58959741aad546221cb862 /hw/qdev.c
parentqtest: Fix tv_usec != long (diff)
downloadqemu-dfe47e7029e117f65a14c0948021654f7f7d5d05.tar.gz
qemu-dfe47e7029e117f65a14c0948021654f7f7d5d05.tar.xz
qemu-dfe47e7029e117f65a14c0948021654f7f7d5d05.zip
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>
Diffstat (limited to 'hw/qdev.c')
-rw-r--r--hw/qdev.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/hw/qdev.c b/hw/qdev.c
index afbc975b8f..0bcde20c92 100644
--- a/hw/qdev.c
+++ b/hw/qdev.c
@@ -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;