aboutsummaryrefslogtreecommitdiff
path: root/qom/container.c
diff options
context:
space:
mode:
Diffstat (limited to 'qom/container.c')
-rw-r--r--qom/container.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/qom/container.c b/qom/container.c
index f107208867..67e9e8a6f8 100644
--- a/qom/container.c
+++ b/qom/container.c
@@ -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)