qom/object.c: add object_class_property_add_uint64_ptr()
This adds a class property that references a uint8_t within the object instance and is intended to be a replacement for object_property_add_uint64_ptr(). Signed-off-by: Mark Cave-Ayland <mark.caveayland@nutanix.com> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> Message-Id: <20260825134320.1039012-6-mark.caveayland@nutanix.com>
Mark Cave-Ayland committed
Aug 25, 2026 at 14:41 UTC
6c4f6b5934a6ce99b25af36dabf932be1fcb58a5
2 files changed
+39
include/qom/object.h
+18
@@ -2168,6 +2168,24 @@ ObjectProperty *object_property_add_uint64_ptr(Object *obj, const char *name,
2168
const uint64_t *v,
2169
ObjectPropertyFlags flags);
2170
2171
+/**
2172
+ * object_class_property_add_uint64_ptr:
2173
+ * @klass: the object class to add a property to
2174
+ * @name: the name of the property
2175
+ * @offset: the offset from the object instance where the uint64 value is
2176
+ * stored
2177
+ * @flags: bitwise-or'd ObjectPropertyFlags
2178
+ *
2179
+ * Add an integer property in memory. This function will add a
2180
+ * property of type 'uint64'.
2181
+ *
2182
+ * Returns: The newly added property on success, or %NULL on failure.
2183
+ */
2184
+ObjectProperty *object_class_property_add_uint64_ptr(ObjectClass *klass,
2185
+ const char *name,
2186
+ ptrdiff_t offset,
2187
+ ObjectPropertyFlags flags);
2188
+
2189
/**
2190
* object_class_static_property_add_uint64_ptr:
2191
* @klass: the object class to add a static property to
qom/object.c
+21
@@ -2742,6 +2742,7 @@ static void *object_class_prop_ptr(Object *obj, ptrdiff_t offset)
2742
OBJECT_CLASS_PROPERTY_SCALAR_SETTER(type)
2743
2744
DEFINE_OBJECT_CLASS_PROPERTY_SCALAR_METHODS(uint8)
2745
+DEFINE_OBJECT_CLASS_PROPERTY_SCALAR_METHODS(uint64)
2746
2747
#undef OBJECT_CLASS_PROPERTY_SCALAR_GETTER
2748
#undef OBJECT_CLASS_PROPERTY_SCALAR_SETTER
@@ -2911,6 +2912,26 @@ object_property_add_uint64_ptr(Object *obj, const char *name,
2912
getter, setter, NULL, (void *)v);
2913
}
2914
2915
+ObjectProperty *
2916
+object_class_property_add_uint64_ptr(ObjectClass *klass, const char *name,
2917
+ ptrdiff_t offset,
2918
+ ObjectPropertyFlags flags)
2919
+{
2920
+ ObjectPropertyAccessor *getter = NULL;
2921
+ ObjectPropertyAccessor *setter = NULL;
2922
+
2923
+ if ((flags & OBJ_PROP_FLAG_READ) == OBJ_PROP_FLAG_READ) {
2924
+ getter = property_class_get_uint64_ptr;
2925
+ }
2926
+
2927
+ if ((flags & OBJ_PROP_FLAG_WRITE) == OBJ_PROP_FLAG_WRITE) {
2928
+ setter = property_class_set_uint64_ptr;
2929
+ }
2930
+
2931
+ return object_class_property_add(klass, name, "uint64",
2932
+ getter, setter, NULL, (void *)offset);
2933
+}
2934
+
2935
ObjectProperty *
2936
object_class_static_property_add_uint64_ptr(ObjectClass *klass,
2937
const char *name,