summaryrefslogtreecommitdiffstats
path: root/qom
diff options
context:
space:
mode:
authorPaolo Bonzini2015-05-05 18:29:00 +0200
committerPaolo Bonzini2015-06-05 17:36:39 +0200
commitfb9e7e334b54350e8e3b62bd7892b78f63a9d848 (patch)
treebadff9234c77d6ee7e0355b4c65bea2f4d742de6 /qom
parentvl: allow full-blown QemuOpts syntax for -global (diff)
downloadqemu-fb9e7e334b54350e8e3b62bd7892b78f63a9d848.tar.gz
qemu-fb9e7e334b54350e8e3b62bd7892b78f63a9d848.tar.xz
qemu-fb9e7e334b54350e8e3b62bd7892b78f63a9d848.zip
qom: add object_property_add_const_link
Suggested-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'qom')
-rw-r--r--qom/object.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/qom/object.c b/qom/object.c
index b8dff43297..96abd347b1 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1266,6 +1266,22 @@ out:
g_free(full_type);
}
+void object_property_add_const_link(Object *obj, const char *name,
+ Object *target, Error **errp)
+{
+ char *link_type;
+ ObjectProperty *op;
+
+ link_type = g_strdup_printf("link<%s>", object_get_typename(target));
+ op = object_property_add(obj, name, link_type,
+ object_get_child_property, NULL,
+ NULL, target, errp);
+ if (op != NULL) {
+ op->resolve = object_resolve_child_property;
+ }
+ g_free(link_type);
+}
+
gchar *object_get_canonical_path_component(Object *obj)
{
ObjectProperty *prop = NULL;