]> Git Repo - qemu.git/blobdiff - qom/container.c
coroutine-gthread.c: Avoid threading APIs deprecated in GLib 2.31
[qemu.git] / qom / container.c
index f107208867081d1d929838f56fbd0f352218702f..67e9e8a6f8923978a53c332ca71eeda572f0efb6 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "qemu/object.h"
 #include "module.h"
+#include <assert.h>
 
 static TypeInfo container_info = {
     .name          = "container",
@@ -24,4 +25,26 @@ static void container_register_types(void)
     type_register_static(&container_info);
 }
 
+Object *container_get(const char *path)
+{
+    Object *obj, *child;
+    gchar **parts;
+    int i;
+
+    parts = g_strsplit(path, "/", 0);
+    assert(parts != NULL && parts[0] != NULL && !parts[0][0]);
+    obj = object_get_root();
+
+    for (i = 1; parts[i] != NULL; i++, obj = child) {
+        child = object_resolve_path_component(obj, parts[i]);
+        if (!child) {
+            child = object_new("container");
+            object_property_add_child(obj, parts[i], child, NULL);
+        }
+    }
+
+    return obj;
+}
+
+
 type_init(container_register_types)
This page took 0.022117 seconds and 4 git commands to generate.