Commit 0a38021b85 for qemu.org
commit 0a38021b85044666079a995900d37f6d766cedd5
Author: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Date: Tue Aug 25 14:41:23 2026 +0100
qom/object.c: introduce OBJECT_CLASS_PROPERTY_SCALAR_SETTER(type) macro
This macro will be used to generate the boilerplate property_class_set_type_ptr()
QOM set function for the specified scalar type.
Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com>
Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Message-Id: <20260825134320.1039012-3-mark.caveayland@nutanix.com>
diff --git a/qom/object.c b/qom/object.c
index e32ae30bd5..fe4e552928 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -2722,7 +2722,24 @@ static void *object_class_prop_ptr(Object *obj, ptrdiff_t offset)
visit_type_##type(v, name, &value, errp); \
}
+#define OBJECT_CLASS_PROPERTY_SCALAR_SETTER(type) \
+ static void property_class_set_##type##_ptr(Object *obj, Visitor *v, \
+ const char *name, \
+ void *opaque, Error **errp) \
+ { \
+ type##_t *field = (type##_t *)object_class_prop_ptr(obj, \
+ (ptrdiff_t)opaque); \
+ type##_t value; \
+ \
+ if (!visit_type_##type(v, name, &value, errp)) { \
+ return; \
+ } \
+ \
+ *field = value; \
+ }
+
#undef OBJECT_CLASS_PROPERTY_SCALAR_GETTER
+#undef OBJECT_CLASS_PROPERTY_SCALAR_SETTER
ObjectProperty *