Revision dfe47e70
b/hw/qdev-monitor.c | ||
---|---|---|
181 | 181 |
static Object *dev; |
182 | 182 |
|
183 | 183 |
if (dev == NULL) { |
184 |
dev = container_get("/machine/peripheral");
|
|
184 |
dev = container_get(qdev_get_machine(), "/peripheral");
|
|
185 | 185 |
} |
186 | 186 |
|
187 | 187 |
return dev; |
... | ... | |
192 | 192 |
static Object *dev; |
193 | 193 |
|
194 | 194 |
if (dev == NULL) { |
195 |
dev = container_get("/machine/peripheral-anon");
|
|
195 |
dev = container_get(qdev_get_machine(), "/peripheral-anon");
|
|
196 | 196 |
} |
197 | 197 |
|
198 | 198 |
return dev; |
b/hw/qdev.c | ||
---|---|---|
158 | 158 |
static int unattached_count = 0; |
159 | 159 |
gchar *name = g_strdup_printf("device[%d]", unattached_count++); |
160 | 160 |
|
161 |
object_property_add_child(container_get("/machine/unattached"), name, |
|
162 |
OBJECT(dev), NULL); |
|
161 |
object_property_add_child(container_get(qdev_get_machine(), |
|
162 |
"/unattached"), |
|
163 |
name, OBJECT(dev), NULL); |
|
163 | 164 |
g_free(name); |
164 | 165 |
} |
165 | 166 |
|
... | ... | |
677 | 678 |
static Object *dev; |
678 | 679 |
|
679 | 680 |
if (dev == NULL) { |
680 |
dev = container_get("/machine"); |
|
681 |
dev = container_get(object_get_root(), "/machine");
|
|
681 | 682 |
} |
682 | 683 |
|
683 | 684 |
return dev; |
b/include/qemu/object.h | ||
---|---|---|
905 | 905 |
|
906 | 906 |
/** |
907 | 907 |
* container_get: |
908 |
* @root: root of the #path, e.g., object_get_root() |
|
908 | 909 |
* @path: path to the container |
909 | 910 |
* |
910 | 911 |
* Return a container object whose path is @path. Create more containers |
... | ... | |
912 | 913 |
* |
913 | 914 |
* Returns: the container object. |
914 | 915 |
*/ |
915 |
Object *container_get(const char *path); |
|
916 |
Object *container_get(Object *root, const char *path);
|
|
916 | 917 |
|
917 | 918 |
|
918 | 919 |
#endif |
b/qom/container.c | ||
---|---|---|
25 | 25 |
type_register_static(&container_info); |
26 | 26 |
} |
27 | 27 |
|
28 |
Object *container_get(const char *path) |
|
28 |
Object *container_get(Object *root, const char *path)
|
|
29 | 29 |
{ |
30 | 30 |
Object *obj, *child; |
31 | 31 |
gchar **parts; |
... | ... | |
33 | 33 |
|
34 | 34 |
parts = g_strsplit(path, "/", 0); |
35 | 35 |
assert(parts != NULL && parts[0] != NULL && !parts[0][0]); |
36 |
obj = object_get_root();
|
|
36 |
obj = root;
|
|
37 | 37 |
|
38 | 38 |
for (i = 1; parts[i] != NULL; i++, obj = child) { |
39 | 39 |
child = object_resolve_path_component(obj, parts[i]); |
Also available in: Unified diff