[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 18/23] qom: accept any compatible type when setting
From: |
Anthony Liguori |
Subject: |
[Qemu-devel] [PATCH 18/23] qom: accept any compatible type when setting a link property |
Date: |
Mon, 30 Jan 2012 15:08:56 -0600 |
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 <address@hidden>
---
qom/object.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/qom/object.c b/qom/object.c
index 3133a62..4c3ff83 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -724,11 +724,12 @@ static void object_set_link_property(Object *obj, Visitor
*v, void *opaque,
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);
}
--
1.7.4.1
- [Qemu-devel] [PATCH 01/23] usb-hid: simplify class initialization a bit, Anthony Liguori, 2012/01/30
- [Qemu-devel] [PATCH 03/23] qdev: make DeviceInfo private, Anthony Liguori, 2012/01/30
- [Qemu-devel] [PATCH 04/23] qdev: remove info from class, Anthony Liguori, 2012/01/30
- [Qemu-devel] [PATCH 06/23] qdev: refactor device creation to allow bus_info to be set only in class, Anthony Liguori, 2012/01/30
- [Qemu-devel] [PATCH 07/23] qdev: kill off DeviceInfo list, Anthony Liguori, 2012/01/30
- [Qemu-devel] [PATCH 05/23] qdev: allow classes to overload qdev functions, Anthony Liguori, 2012/01/30
- [Qemu-devel] [PATCH 18/23] qom: accept any compatible type when setting a link property,
Anthony Liguori <=
- [Qemu-devel] [PATCH 08/23] qdev: register all types natively through QEMU Object Model, Anthony Liguori, 2012/01/30
- [Qemu-devel] [PATCH 00/23] qom: use Type system to register all devices, Anthony Liguori, 2012/01/30
- [Qemu-devel] [PATCH 11/23] qom: allow object_class_foreach to take additional parameters to refine search, Anthony Liguori, 2012/01/30
- [Qemu-devel] [PATCH 15/23] qdev: split out UI portions into a new function, Anthony Liguori, 2012/01/30
- [Qemu-devel] [PATCH 21/23] object: sure up reference counting, Anthony Liguori, 2012/01/30