]> 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 946cbff90f4d456551276601e07d55c90924207c..67e9e8a6f8923978a53c332ca71eeda572f0efb6 100644 (file)
@@ -12,6 +12,7 @@
 
 #include "qemu/object.h"
 #include "module.h"
+#include <assert.h>
 
 static TypeInfo container_info = {
     .name          = "container",
@@ -19,9 +20,31 @@ static TypeInfo container_info = {
     .parent        = TYPE_OBJECT,
 };
 
-static void container_init(void)
+static void container_register_types(void)
 {
     type_register_static(&container_info);
 }
 
-device_init(container_init);
+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.026079 seconds and 4 git commands to generate.