From dfe47e7029e117f65a14c0948021654f7f7d5d05 Mon Sep 17 00:00:00 2001 From: Andreas Färber Date: Thu, 5 Apr 2012 13:21:46 +0200 Subject: qom: Refine container_get() to allow using a custom root MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Cc: Paolo Bonzini Cc: Anthony Liguori Signed-off-by: Anthony Liguori --- hw/qdev.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'hw/qdev.c') 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; -- cgit 1.4.1