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: Anthony Liguori <aliguori@us.ibm.com>
if (target) {
gchar *target_type;
- target_type = g_strdup_printf("link<%s>",
- object_get_typename(OBJECT(target)));
- if (strcmp(target_type, type) == 0) {
- *child = target;
+ target_type = g_strdup(&type[5]);
+ target_type[strlen(target_type) - 2] = 0;
+
+ if (object_dynamic_cast(target, target_type)) {
object_ref(target);
+ *child = target;
} else {
error_set(errp, QERR_INVALID_PARAMETER_TYPE, name, type);
}