diff options
author | Andreas Färber <afaerber@suse.de> | 2012-04-05 13:21:46 +0200 |
---|---|---|
committer | Anthony Liguori <aliguori@us.ibm.com> | 2012-04-24 09:50:31 -0500 |
commit | dfe47e7029e117f65a14c0948021654f7f7d5d05 (patch) | |
tree | 9831f047090bf7bb7c58959741aad546221cb862 /hw/qdev.c | |
parent | 7f3bf92fad79dff1edcb796a875b5c0d57666162 (diff) |
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.c | 7 |
1 files changed, 4 insertions, 3 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; |