From: Gonglei <arei.gong...@huawei.com> In this way, we can use target object and get its qdev property legacy_name etc.
Cc: Stefan Hajnoczi <stefa...@redhat.com> Cc: Paolo Bonzini <pbonz...@redhat.com> Cc: Michael S. Tsirkin <m...@redhat.com> Signed-off-by: Gonglei <arei.gong...@huawei.com> --- include/qom/object.h | 8 ++++++++ qom/object.c | 7 ++----- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/include/qom/object.h b/include/qom/object.h index 8a05a81..e3bb52e 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -334,6 +334,11 @@ typedef void (ObjectPropertyRelease)(Object *obj, const char *name, void *opaque); +typedef struct { + Object *target_obj; + const char *target_name; +} AliasProperty; + typedef struct ObjectProperty { gchar *name; @@ -344,6 +349,9 @@ typedef struct ObjectProperty ObjectPropertyRelease *release; void *opaque; + bool is_alias; + AliasProperty *alias_property; + QTAILQ_ENTRY(ObjectProperty) node; } ObjectProperty; diff --git a/qom/object.c b/qom/object.c index a8c3065..9a0dd2e 100644 --- a/qom/object.c +++ b/qom/object.c @@ -1590,11 +1590,6 @@ void object_property_add_uint64_ptr(Object *obj, const char *name, NULL, NULL, (void *)v, errp); } -typedef struct { - Object *target_obj; - const char *target_name; -} AliasProperty; - static void property_get_alias(Object *obj, struct Visitor *v, void *opaque, const char *name, Error **errp) { @@ -1663,6 +1658,8 @@ void object_property_add_alias(Object *obj, const char *name, goto out; } op->resolve = property_resolve_alias; + op->is_alias = true; + op->alias_property = prop; out: g_free(prop_type); -- 1.7.12.4