Commit 2aa187346e for qemu.org
commit 2aa187346edf96f2944857fa53b62a0448b39586
Author: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Date: Mon Sep 21 12:35:08 2026 +0100
qom/object.c: introduce object_alias_get_targetp() lookup function
This will be used later to add support for alias class properties.
Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-ID: <20260921113559.1299740-3-mark.caveayland@nutanix.com>
diff --git a/qom/object.c b/qom/object.c
index 914d1228ca..eb5f74fc74 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -3056,13 +3056,20 @@ typedef struct {
char *target_name;
} AliasProperty;
+static Object **
+object_alias_get_targetp(Object *obj, AliasProperty *lprop)
+{
+ return &lprop->target_obj;
+}
+
static void property_get_alias(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
AliasProperty *prop = opaque;
+ Object **target_obj = object_alias_get_targetp(obj, prop);
Visitor *alias_v = visitor_forward_field(v, prop->target_name, name);
- object_property_get(prop->target_obj, prop->target_name, alias_v, errp);
+ object_property_get(*target_obj, prop->target_name, alias_v, errp);
visit_free(alias_v);
}
@@ -3070,9 +3077,10 @@ static void property_set_alias(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
AliasProperty *prop = opaque;
+ Object **target_obj = object_alias_get_targetp(obj, prop);
Visitor *alias_v = visitor_forward_field(v, prop->target_name, name);
- object_property_set(prop->target_obj, prop->target_name, alias_v, errp);
+ object_property_set(*target_obj, prop->target_name, alias_v, errp);
visit_free(alias_v);
}
@@ -3080,8 +3088,9 @@ static Object *property_resolve_alias(Object *obj, void *opaque,
const char *part)
{
AliasProperty *prop = opaque;
+ Object **target_obj = object_alias_get_targetp(obj, prop);
- return object_resolve_path_component(prop->target_obj, prop->target_name);
+ return object_resolve_path_component(*target_obj, prop->target_name);
}
static void property_release_alias(Object *obj, const char *name, void *opaque)