At present, ObjectPropertyFlags is used to select accessors and such
flags won't be stored in ObjectProperty itself.
So it's not proper to extend this ObjectPropertyFlags for "deprecated"
or "internal" flags.
Therefore, rename ObjectPropertyFlags to ObjectPropertyAccessorFlags,
and then the original name ObjectPropertyFlags can be used for other
cases.
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
include/qom/object.h | 28 ++++++++++++++--------------
qom/object.c | 16 ++++++++--------
2 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/include/qom/object.h b/include/qom/object.h
index 26df6137b911..3f807a03f5aa 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -1846,14 +1846,14 @@ typedef enum {
OBJ_PROP_FLAG_WRITE = 1 << 1,
/* Automatically add a getter and a setter to the property */
OBJ_PROP_FLAG_READWRITE = (OBJ_PROP_FLAG_READ | OBJ_PROP_FLAG_WRITE),
-} ObjectPropertyFlags;
+} ObjectPropertyAccessorFlags;
/**
* object_property_add_uint8_ptr:
* @obj: the object to add a property to
* @name: the name of the property
* @v: pointer to value
- * @flags: bitwise-or'd ObjectPropertyFlags
+ * @flags: bitwise-or'd ObjectPropertyAccessorFlags
*
* Add an integer property in memory. This function will add a
* property of type 'uint8'.
@@ -1861,20 +1861,20 @@ typedef enum {
* Returns: The newly added property on success, or %NULL on failure.
*/
ObjectProperty *object_property_add_uint8_ptr(Object *obj, const char *name,
- const uint8_t *v,
- ObjectPropertyFlags flags);
+ const uint8_t *v,
+ ObjectPropertyAccessorFlags flags);
ObjectProperty *object_class_property_add_uint8_ptr(ObjectClass *klass,
const char *name,
const uint8_t *v,
- ObjectPropertyFlags flags);
+ ObjectPropertyAccessorFlags flags);
/**
* object_property_add_uint16_ptr:
* @obj: the object to add a property to
* @name: the name of the property
* @v: pointer to value
- * @flags: bitwise-or'd ObjectPropertyFlags
+ * @flags: bitwise-or'd ObjectPropertyAccessorFlags
*
* Add an integer property in memory. This function will add a
* property of type 'uint16'.
@@ -1883,19 +1883,19 @@ ObjectProperty *object_class_property_add_uint8_ptr(ObjectClass *klass,
*/
ObjectProperty *object_property_add_uint16_ptr(Object *obj, const char *name,
const uint16_t *v,
- ObjectPropertyFlags flags);
+ ObjectPropertyAccessorFlags flags);
ObjectProperty *object_class_property_add_uint16_ptr(ObjectClass *klass,
const char *name,
const uint16_t *v,
- ObjectPropertyFlags flags);
+ ObjectPropertyAccessorFlags flags);
/**
* object_property_add_uint32_ptr:
* @obj: the object to add a property to
* @name: the name of the property
* @v: pointer to value
- * @flags: bitwise-or'd ObjectPropertyFlags
+ * @flags: bitwise-or'd ObjectPropertyAccessorFlags
*
* Add an integer property in memory. This function will add a
* property of type 'uint32'.
@@ -1904,19 +1904,19 @@ ObjectProperty *object_class_property_add_uint16_ptr(ObjectClass *klass,
*/
ObjectProperty *object_property_add_uint32_ptr(Object *obj, const char *name,
const uint32_t *v,
- ObjectPropertyFlags flags);
+ ObjectPropertyAccessorFlags flags);
ObjectProperty *object_class_property_add_uint32_ptr(ObjectClass *klass,
const char *name,
const uint32_t *v,
- ObjectPropertyFlags flags);
+ ObjectPropertyAccessorFlags flags);
/**
* object_property_add_uint64_ptr:
* @obj: the object to add a property to
* @name: the name of the property
* @v: pointer to value
- * @flags: bitwise-or'd ObjectPropertyFlags
+ * @flags: bitwise-or'd ObjectPropertyAccessorFlags
*
* Add an integer property in memory. This function will add a
* property of type 'uint64'.
@@ -1925,12 +1925,12 @@ ObjectProperty *object_class_property_add_uint32_ptr(ObjectClass *klass,
*/
ObjectProperty *object_property_add_uint64_ptr(Object *obj, const char *name,
const uint64_t *v,
- ObjectPropertyFlags flags);
+ ObjectPropertyAccessorFlags flags);
ObjectProperty *object_class_property_add_uint64_ptr(ObjectClass *klass,
const char *name,
const uint64_t *v,
- ObjectPropertyFlags flags);
+ ObjectPropertyAccessorFlags flags);
/**
* object_property_add_alias:
diff --git a/qom/object.c b/qom/object.c
index 4f32c1aba7d7..85d31bb64b36 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -2636,7 +2636,7 @@ static void property_set_uint64_ptr(Object *obj, Visitor *v, const char *name,
ObjectProperty *
object_property_add_uint8_ptr(Object *obj, const char *name,
const uint8_t *v,
- ObjectPropertyFlags flags)
+ ObjectPropertyAccessorFlags flags)
{
ObjectPropertyAccessor *getter = NULL;
ObjectPropertyAccessor *setter = NULL;
@@ -2656,7 +2656,7 @@ object_property_add_uint8_ptr(Object *obj, const char *name,
ObjectProperty *
object_class_property_add_uint8_ptr(ObjectClass *klass, const char *name,
const uint8_t *v,
- ObjectPropertyFlags flags)
+ ObjectPropertyAccessorFlags flags)
{
ObjectPropertyAccessor *getter = NULL;
ObjectPropertyAccessor *setter = NULL;
@@ -2676,7 +2676,7 @@ object_class_property_add_uint8_ptr(ObjectClass *klass, const char *name,
ObjectProperty *
object_property_add_uint16_ptr(Object *obj, const char *name,
const uint16_t *v,
- ObjectPropertyFlags flags)
+ ObjectPropertyAccessorFlags flags)
{
ObjectPropertyAccessor *getter = NULL;
ObjectPropertyAccessor *setter = NULL;
@@ -2696,7 +2696,7 @@ object_property_add_uint16_ptr(Object *obj, const char *name,
ObjectProperty *
object_class_property_add_uint16_ptr(ObjectClass *klass, const char *name,
const uint16_t *v,
- ObjectPropertyFlags flags)
+ ObjectPropertyAccessorFlags flags)
{
ObjectPropertyAccessor *getter = NULL;
ObjectPropertyAccessor *setter = NULL;
@@ -2716,7 +2716,7 @@ object_class_property_add_uint16_ptr(ObjectClass *klass, const char *name,
ObjectProperty *
object_property_add_uint32_ptr(Object *obj, const char *name,
const uint32_t *v,
- ObjectPropertyFlags flags)
+ ObjectPropertyAccessorFlags flags)
{
ObjectPropertyAccessor *getter = NULL;
ObjectPropertyAccessor *setter = NULL;
@@ -2736,7 +2736,7 @@ object_property_add_uint32_ptr(Object *obj, const char *name,
ObjectProperty *
object_class_property_add_uint32_ptr(ObjectClass *klass, const char *name,
const uint32_t *v,
- ObjectPropertyFlags flags)
+ ObjectPropertyAccessorFlags flags)
{
ObjectPropertyAccessor *getter = NULL;
ObjectPropertyAccessor *setter = NULL;
@@ -2756,7 +2756,7 @@ object_class_property_add_uint32_ptr(ObjectClass *klass, const char *name,
ObjectProperty *
object_property_add_uint64_ptr(Object *obj, const char *name,
const uint64_t *v,
- ObjectPropertyFlags flags)
+ ObjectPropertyAccessorFlags flags)
{
ObjectPropertyAccessor *getter = NULL;
ObjectPropertyAccessor *setter = NULL;
@@ -2776,7 +2776,7 @@ object_property_add_uint64_ptr(Object *obj, const char *name,
ObjectProperty *
object_class_property_add_uint64_ptr(ObjectClass *klass, const char *name,
const uint64_t *v,
- ObjectPropertyFlags flags)
+ ObjectPropertyAccessorFlags flags)
{
ObjectPropertyAccessor *getter = NULL;
ObjectPropertyAccessor *setter = NULL;
--
2.34.1
On Wed, 3 Dec 2025 01:04:53 +0800
Zhao Liu <zhao1.liu@intel.com> wrote:
> At present, ObjectPropertyFlags is used to select accessors and such
> flags won't be stored in ObjectProperty itself.
>
> So it's not proper to extend this ObjectPropertyFlags for "deprecated"
> or "internal" flags.
>
> Therefore, rename ObjectPropertyFlags to ObjectPropertyAccessorFlags,
> and then the original name ObjectPropertyFlags can be used for other
> cases.
I wonder if we can just make existing ObjectPropertyFlags per object as you are planing
and still continue using it for accessor flags.
That basically will lets you use new flags everywhere without rewriting call sites
everywhere.
>
> Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
> ---
> include/qom/object.h | 28 ++++++++++++++--------------
> qom/object.c | 16 ++++++++--------
> 2 files changed, 22 insertions(+), 22 deletions(-)
>
> diff --git a/include/qom/object.h b/include/qom/object.h
> index 26df6137b911..3f807a03f5aa 100644
> --- a/include/qom/object.h
> +++ b/include/qom/object.h
> @@ -1846,14 +1846,14 @@ typedef enum {
> OBJ_PROP_FLAG_WRITE = 1 << 1,
> /* Automatically add a getter and a setter to the property */
> OBJ_PROP_FLAG_READWRITE = (OBJ_PROP_FLAG_READ | OBJ_PROP_FLAG_WRITE),
> -} ObjectPropertyFlags;
> +} ObjectPropertyAccessorFlags;
>
> /**
> * object_property_add_uint8_ptr:
> * @obj: the object to add a property to
> * @name: the name of the property
> * @v: pointer to value
> - * @flags: bitwise-or'd ObjectPropertyFlags
> + * @flags: bitwise-or'd ObjectPropertyAccessorFlags
> *
> * Add an integer property in memory. This function will add a
> * property of type 'uint8'.
> @@ -1861,20 +1861,20 @@ typedef enum {
> * Returns: The newly added property on success, or %NULL on failure.
> */
> ObjectProperty *object_property_add_uint8_ptr(Object *obj, const char *name,
> - const uint8_t *v,
> - ObjectPropertyFlags flags);
> + const uint8_t *v,
> + ObjectPropertyAccessorFlags flags);
>
> ObjectProperty *object_class_property_add_uint8_ptr(ObjectClass *klass,
> const char *name,
> const uint8_t *v,
> - ObjectPropertyFlags flags);
> + ObjectPropertyAccessorFlags flags);
>
> /**
> * object_property_add_uint16_ptr:
> * @obj: the object to add a property to
> * @name: the name of the property
> * @v: pointer to value
> - * @flags: bitwise-or'd ObjectPropertyFlags
> + * @flags: bitwise-or'd ObjectPropertyAccessorFlags
> *
> * Add an integer property in memory. This function will add a
> * property of type 'uint16'.
> @@ -1883,19 +1883,19 @@ ObjectProperty *object_class_property_add_uint8_ptr(ObjectClass *klass,
> */
> ObjectProperty *object_property_add_uint16_ptr(Object *obj, const char *name,
> const uint16_t *v,
> - ObjectPropertyFlags flags);
> + ObjectPropertyAccessorFlags flags);
>
> ObjectProperty *object_class_property_add_uint16_ptr(ObjectClass *klass,
> const char *name,
> const uint16_t *v,
> - ObjectPropertyFlags flags);
> + ObjectPropertyAccessorFlags flags);
>
> /**
> * object_property_add_uint32_ptr:
> * @obj: the object to add a property to
> * @name: the name of the property
> * @v: pointer to value
> - * @flags: bitwise-or'd ObjectPropertyFlags
> + * @flags: bitwise-or'd ObjectPropertyAccessorFlags
> *
> * Add an integer property in memory. This function will add a
> * property of type 'uint32'.
> @@ -1904,19 +1904,19 @@ ObjectProperty *object_class_property_add_uint16_ptr(ObjectClass *klass,
> */
> ObjectProperty *object_property_add_uint32_ptr(Object *obj, const char *name,
> const uint32_t *v,
> - ObjectPropertyFlags flags);
> + ObjectPropertyAccessorFlags flags);
>
> ObjectProperty *object_class_property_add_uint32_ptr(ObjectClass *klass,
> const char *name,
> const uint32_t *v,
> - ObjectPropertyFlags flags);
> + ObjectPropertyAccessorFlags flags);
>
> /**
> * object_property_add_uint64_ptr:
> * @obj: the object to add a property to
> * @name: the name of the property
> * @v: pointer to value
> - * @flags: bitwise-or'd ObjectPropertyFlags
> + * @flags: bitwise-or'd ObjectPropertyAccessorFlags
> *
> * Add an integer property in memory. This function will add a
> * property of type 'uint64'.
> @@ -1925,12 +1925,12 @@ ObjectProperty *object_class_property_add_uint32_ptr(ObjectClass *klass,
> */
> ObjectProperty *object_property_add_uint64_ptr(Object *obj, const char *name,
> const uint64_t *v,
> - ObjectPropertyFlags flags);
> + ObjectPropertyAccessorFlags flags);
>
> ObjectProperty *object_class_property_add_uint64_ptr(ObjectClass *klass,
> const char *name,
> const uint64_t *v,
> - ObjectPropertyFlags flags);
> + ObjectPropertyAccessorFlags flags);
>
> /**
> * object_property_add_alias:
> diff --git a/qom/object.c b/qom/object.c
> index 4f32c1aba7d7..85d31bb64b36 100644
> --- a/qom/object.c
> +++ b/qom/object.c
> @@ -2636,7 +2636,7 @@ static void property_set_uint64_ptr(Object *obj, Visitor *v, const char *name,
> ObjectProperty *
> object_property_add_uint8_ptr(Object *obj, const char *name,
> const uint8_t *v,
> - ObjectPropertyFlags flags)
> + ObjectPropertyAccessorFlags flags)
> {
> ObjectPropertyAccessor *getter = NULL;
> ObjectPropertyAccessor *setter = NULL;
> @@ -2656,7 +2656,7 @@ object_property_add_uint8_ptr(Object *obj, const char *name,
> ObjectProperty *
> object_class_property_add_uint8_ptr(ObjectClass *klass, const char *name,
> const uint8_t *v,
> - ObjectPropertyFlags flags)
> + ObjectPropertyAccessorFlags flags)
> {
> ObjectPropertyAccessor *getter = NULL;
> ObjectPropertyAccessor *setter = NULL;
> @@ -2676,7 +2676,7 @@ object_class_property_add_uint8_ptr(ObjectClass *klass, const char *name,
> ObjectProperty *
> object_property_add_uint16_ptr(Object *obj, const char *name,
> const uint16_t *v,
> - ObjectPropertyFlags flags)
> + ObjectPropertyAccessorFlags flags)
> {
> ObjectPropertyAccessor *getter = NULL;
> ObjectPropertyAccessor *setter = NULL;
> @@ -2696,7 +2696,7 @@ object_property_add_uint16_ptr(Object *obj, const char *name,
> ObjectProperty *
> object_class_property_add_uint16_ptr(ObjectClass *klass, const char *name,
> const uint16_t *v,
> - ObjectPropertyFlags flags)
> + ObjectPropertyAccessorFlags flags)
> {
> ObjectPropertyAccessor *getter = NULL;
> ObjectPropertyAccessor *setter = NULL;
> @@ -2716,7 +2716,7 @@ object_class_property_add_uint16_ptr(ObjectClass *klass, const char *name,
> ObjectProperty *
> object_property_add_uint32_ptr(Object *obj, const char *name,
> const uint32_t *v,
> - ObjectPropertyFlags flags)
> + ObjectPropertyAccessorFlags flags)
> {
> ObjectPropertyAccessor *getter = NULL;
> ObjectPropertyAccessor *setter = NULL;
> @@ -2736,7 +2736,7 @@ object_property_add_uint32_ptr(Object *obj, const char *name,
> ObjectProperty *
> object_class_property_add_uint32_ptr(ObjectClass *klass, const char *name,
> const uint32_t *v,
> - ObjectPropertyFlags flags)
> + ObjectPropertyAccessorFlags flags)
> {
> ObjectPropertyAccessor *getter = NULL;
> ObjectPropertyAccessor *setter = NULL;
> @@ -2756,7 +2756,7 @@ object_class_property_add_uint32_ptr(ObjectClass *klass, const char *name,
> ObjectProperty *
> object_property_add_uint64_ptr(Object *obj, const char *name,
> const uint64_t *v,
> - ObjectPropertyFlags flags)
> + ObjectPropertyAccessorFlags flags)
> {
> ObjectPropertyAccessor *getter = NULL;
> ObjectPropertyAccessor *setter = NULL;
> @@ -2776,7 +2776,7 @@ object_property_add_uint64_ptr(Object *obj, const char *name,
> ObjectProperty *
> object_class_property_add_uint64_ptr(ObjectClass *klass, const char *name,
> const uint64_t *v,
> - ObjectPropertyFlags flags)
> + ObjectPropertyAccessorFlags flags)
> {
> ObjectPropertyAccessor *getter = NULL;
> ObjectPropertyAccessor *setter = NULL;
Thanks for looking at this! > > Therefore, rename ObjectPropertyFlags to ObjectPropertyAccessorFlags, > > and then the original name ObjectPropertyFlags can be used for other > > cases. > > I wonder if we can just make existing ObjectPropertyFlags per object as you are planing > and still continue using it for accessor flags. > > That basically will lets you use new flags everywhere without rewriting call sites > everywhere. I'm not sure about this. Currently, these read/write flags are actually specific to pointer properties (as showed by the changes in this patch, which all involve object_property_add_*_ptr() / object_class_property_add_*_ptr()). Other property types doesn't yet support flag parameters, so additional interface modifications are still needed. And for now other property types either need to explicitly specify get/set accessors (e.g., object_property_add_bool()) or directly use the default get/set methods (e.g., object_property_add_link()). If we extend read/write flags to other property types, such as adding "flags" argument to object_property_add_bool(), we must ensure the OBJ_PROP_FLAG_READ flag align with "get" argument and OBJ_PROP_FLAG_WRITE flag align with "set" parameters. This would introduces additional complexity. Thanks, Zhao
On Mon, 5 Jan 2026 15:54:32 +0800 Zhao Liu <zhao1.liu@intel.com> wrote: > Thanks for looking at this! > > > > Therefore, rename ObjectPropertyFlags to ObjectPropertyAccessorFlags, > > > and then the original name ObjectPropertyFlags can be used for other > > > cases. > > > > I wonder if we can just make existing ObjectPropertyFlags per object as you are planing > > and still continue using it for accessor flags. > > > > That basically will lets you use new flags everywhere without rewriting call sites > > everywhere. > > I'm not sure about this. Currently, these read/write flags are actually > specific to pointer properties (as showed by the changes in this patch, > which all involve object_property_add_*_ptr() / object_class_property_add_*_ptr()). > > Other property types doesn't yet support flag parameters, so additional > interface modifications are still needed. > > And for now other property types either need to explicitly specify get/set > accessors (e.g., object_property_add_bool()) or directly use the default > get/set methods (e.g., object_property_add_link()). > > If we extend read/write flags to other property types, such as adding > "flags" argument to object_property_add_bool(), we must ensure the > OBJ_PROP_FLAG_READ flag align with "get" argument and OBJ_PROP_FLAG_WRITE > flag align with "set" parameters. Ain't thouse accessors callbacks? /I mean to you still can check flags inside of generic object property code without touching setter/getter./ >This would introduces additional complexity. it still might be woth considering to compare this series with alternative approach. > > Thanks, > Zhao >
> > I'm not sure about this. Currently, these read/write flags are actually > > specific to pointer properties (as showed by the changes in this patch, > > which all involve object_property_add_*_ptr() / object_class_property_add_*_ptr()). > > > > Other property types doesn't yet support flag parameters, so additional > > interface modifications are still needed. > > > > And for now other property types either need to explicitly specify get/set > > accessors (e.g., object_property_add_bool()) or directly use the default > > get/set methods (e.g., object_property_add_link()). > > > > If we extend read/write flags to other property types, such as adding > > "flags" argument to object_property_add_bool(), we must ensure the > > OBJ_PROP_FLAG_READ flag align with "get" argument and OBJ_PROP_FLAG_WRITE > > flag align with "set" parameters. > > Ain't thouse accessors callbacks? > /I mean to you still can check flags inside of generic object property code > without touching setter/getter./ Ah, I see, the default flags is OBJ_PROP_FLAG_READWRITE and I can check them before calling setter/getter. > >This would introduces additional complexity. > > it still might be woth considering to compare this series with alternative approach. Yes, will try to reuse current ObjectPropertyFlags. Thanks, Zhao
© 2016 - 2026 Red Hat, Inc.