[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
- [Qemu-devel] [RFC PATCH 0/5] expose negotiated virtio features in r/o properties, Roman Kagan, 2018/12/14
- [Qemu-devel] [RFC PATCH 3/5] qdev-properties: add r/o 64bit bitfield property, Roman Kagan, 2018/12/14
- [Qemu-devel] [RFC PATCH 4/5] virtio: drop DEFINE_VIRTIO_COMMON_FEATURES, Roman Kagan, 2018/12/14
- [Qemu-devel] [RFC PATCH 1/5] qom: preserve get/set presence in aliased properties,
Roman Kagan <=
- [Qemu-devel] [RFC PATCH 2/5] qmp: further consolidate listing of device and object properties, Roman Kagan, 2018/12/14
- [Qemu-devel] [RFC PATCH 5/5] virtio: expose negotiated features in r/o properties, Roman Kagan, 2018/12/14
- Re: [Qemu-devel] [RFC PATCH 0/5] expose negotiated virtio features in r/o properties, no-reply, 2018/12/23