qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH 1/5] qom: preserve get/set presence in aliased p


From: Roman Kagan
Subject: [Qemu-devel] [RFC PATCH 1/5] qom: preserve get/set presence in aliased properties
Date: Fri, 14 Dec 2018 16:57:06 +0000

Usually in order to tell if a property is read-only, write-only, or
read-write, one has to look at whether it has .get or .set methods.

However, property aliases are always defined with both, and it's not
until the call to the getter or setter when the support for the
corresponding operation can be found out.

To make it easier to determine if an operation is supported for an alias
property, only assign it getter and setter if the target property has
the corresponding method.

Signed-off-by: Roman Kagan <address@hidden>
---
 qom/object.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/qom/object.c b/qom/object.c
index 17921c0a71..b362ebab19 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -2382,8 +2382,8 @@ void object_property_add_alias(Object *obj, const char 
*name,
     prop->target_name = g_strdup(target_name);
 
     op = object_property_add(obj, name, prop_type,
-                             property_get_alias,
-                             property_set_alias,
+                             target_prop->get ? property_get_alias : NULL,
+                             target_prop->set ? property_set_alias : NULL,
                              property_release_alias,
                              prop, &local_err);
     if (local_err) {
-- 
2.19.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]