提交 fe40e627 编写于 作者: A Anthony Liguori

qom: accept any compatible type when setting a link property

Links had limited utility before as they only allowed a concrete type to be
specified.  Now we can support abstract types and interfaces which means it's
now possible to have a link<PCIDevice>.
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 57c9fafe
...@@ -735,11 +735,12 @@ static void object_set_link_property(Object *obj, Visitor *v, void *opaque, ...@@ -735,11 +735,12 @@ static void object_set_link_property(Object *obj, Visitor *v, void *opaque,
if (target) { if (target) {
gchar *target_type; gchar *target_type;
target_type = g_strdup_printf("link<%s>", target_type = g_strdup(&type[5]);
object_get_typename(OBJECT(target))); target_type[strlen(target_type) - 2] = 0;
if (strcmp(target_type, type) == 0) {
*child = target; if (object_dynamic_cast(target, target_type)) {
object_ref(target); object_ref(target);
*child = target;
} else { } else {
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, type); error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, type);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册