[PATCH v2 05/21] qom/object: rename object_{class_}property_try_add() to object_{class_}property_add_full()

Zhao Liu posted 21 patches 14 hours ago
Maintainers: Pierrick Bouvier <pierrick.bouvier@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, "Daniel P. Berrangé" <berrange@redhat.com>, Eduardo Habkost <eduardo@habkost.net>, "Michael S. Tsirkin" <mst@redhat.com>, Marcel Apfelbaum <marcel.apfelbaum@gmail.com>, Richard Henderson <richard.henderson@linaro.org>, Zhao Liu <zhao1.liu@intel.com>
[PATCH v2 05/21] qom/object: rename object_{class_}property_try_add() to object_{class_}property_add_full()
Posted by Zhao Liu 14 hours ago
The suffixes "_try_add" and "_add" typically distinguish functions based
solely on their error-handling behavior.

However, the object_{class_}property_try_add() variants now support the
additional 'flags' argument. Consequently, naming them based only on
error handling no longer accurately reflects the distinction between the
two interface variants.

Rename object_{class_}property_try_add() to
object_{class_}property_add_full() to indicate that these interfaces
offer comprehensive argument support, including the new flags.

Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
---
 include/qom/object.h | 38 ++++++++++++++++++------------------
 qom/object.c         | 46 ++++++++++++++++++++++----------------------
 2 files changed, 42 insertions(+), 42 deletions(-)

diff --git a/include/qom/object.h b/include/qom/object.h
index 7d8a7be1bad3..30c9f20b1d18 100644
--- a/include/qom/object.h
+++ b/include/qom/object.h
@@ -1087,7 +1087,7 @@ Object *object_ref(void *obj);
 void object_unref(void *obj);
 
 /**
- * object_property_try_add:
+ * object_property_add_full:
  * @obj: the object to add a property to
  * @name: the name of the property.  This can contain any character except for
  *  a forward slash.  In general, you should use hyphens '-' instead of
@@ -1114,17 +1114,17 @@ void object_unref(void *obj);
  * Returns: The #ObjectProperty; this can be used to set the @resolve
  * callback for child and link properties.
  */
-ObjectProperty *object_property_try_add(Object *obj, const char *name,
-                                        const char *type,
-                                        ObjectPropertyAccessor *get,
-                                        ObjectPropertyAccessor *set,
-                                        ObjectPropertyRelease *release,
-                                        ObjectPropertyFlags flags,
-                                        void *opaque, Error **errp);
+ObjectProperty *object_property_add_full(Object *obj, const char *name,
+                                         const char *type,
+                                         ObjectPropertyAccessor *get,
+                                         ObjectPropertyAccessor *set,
+                                         ObjectPropertyRelease *release,
+                                         ObjectPropertyFlags flags,
+                                         void *opaque, Error **errp);
 
 /**
  * object_property_add:
- * Same as object_property_try_add() with @flags hardcoded to 0 and @errp
+ * Same as object_property_add_full() with @flags hardcoded to 0 and @errp
  * hardcoded to &error_abort.
  *
  * @obj: the object to add a property to
@@ -1154,7 +1154,7 @@ ObjectProperty *object_property_add(Object *obj, const char *name,
 void object_property_del(Object *obj, const char *name);
 
 /**
- * object_class_property_try_add:
+ * object_class_property_add_full:
  * @klass: the object class to add a property to
  * @name: the name of the property.  This can contain any character except for
  *  a forward slash.  In general, you should use hyphens '-' instead of
@@ -1181,18 +1181,18 @@ void object_property_del(Object *obj, const char *name);
  * Returns: The #ObjectProperty; this can be used to set the @resolve
  * callback for child and link properties.
  */
-ObjectProperty *object_class_property_try_add(ObjectClass *klass, const char *name,
-                                              const char *type,
-                                              ObjectPropertyAccessor *get,
-                                              ObjectPropertyAccessor *set,
-                                              ObjectPropertyRelease *release,
-                                              ObjectPropertyFlags flags,
-                                              void *opaque, Error **errp);
+ObjectProperty *object_class_property_add_full(ObjectClass *klass, const char *name,
+                                               const char *type,
+                                               ObjectPropertyAccessor *get,
+                                               ObjectPropertyAccessor *set,
+                                               ObjectPropertyRelease *release,
+                                               ObjectPropertyFlags flags,
+                                               void *opaque, Error **errp);
 
 /**
  * object_class_property_add:
- * Same as object_class_property_try_add() with @flags hardcoded to 0 and @errp
- * hardcoded to &error_abort.
+ * Same as object_class_property_add_full() with @flags hardcoded to 0 and
+ * @errp hardcoded to &error_abort.
  *
  * @klass: the object class to add a property to
  * @name: the name of the property.  This can contain any character except for
diff --git a/qom/object.c b/qom/object.c
index 543e42cd6f16..c1a1e5ff3fbe 100644
--- a/qom/object.c
+++ b/qom/object.c
@@ -1246,12 +1246,12 @@ static inline void object_property_flags_init(ObjectProperty *prop,
 }
 
 ObjectProperty *
-object_property_try_add(Object *obj, const char *name, const char *type,
-                        ObjectPropertyAccessor *get,
-                        ObjectPropertyAccessor *set,
-                        ObjectPropertyRelease *release,
-                        ObjectPropertyFlags flags,
-                        void *opaque, Error **errp)
+object_property_add_full(Object *obj, const char *name, const char *type,
+                         ObjectPropertyAccessor *get,
+                         ObjectPropertyAccessor *set,
+                         ObjectPropertyRelease *release,
+                         ObjectPropertyFlags flags,
+                         void *opaque, Error **errp)
 {
     ObjectProperty *prop;
     size_t name_len = strlen(name);
@@ -1265,8 +1265,8 @@ object_property_try_add(Object *obj, const char *name, const char *type,
         for (i = 0; i < INT16_MAX; ++i) {
             char *full_name = g_strdup_printf("%s[%d]", name_no_array, i);
 
-            ret = object_property_try_add(obj, full_name, type, get, set,
-                                          release, flags, opaque, NULL);
+            ret = object_property_add_full(obj, full_name, type, get, set,
+                                           release, flags, opaque, NULL);
             g_free(full_name);
             if (ret) {
                 break;
@@ -1305,19 +1305,19 @@ object_property_add(Object *obj, const char *name, const char *type,
                     ObjectPropertyRelease *release,
                     void *opaque)
 {
-    return object_property_try_add(obj, name, type, get, set, release,
-                                   0, opaque, &error_abort);
+    return object_property_add_full(obj, name, type, get, set, release,
+                                    0, opaque, &error_abort);
 }
 
 ObjectProperty *
-object_class_property_try_add(ObjectClass *klass,
-                              const char *name,
-                              const char *type,
-                              ObjectPropertyAccessor *get,
-                              ObjectPropertyAccessor *set,
-                              ObjectPropertyRelease *release,
-                              ObjectPropertyFlags flags,
-                              void *opaque, Error **errp)
+object_class_property_add_full(ObjectClass *klass,
+                               const char *name,
+                               const char *type,
+                               ObjectPropertyAccessor *get,
+                               ObjectPropertyAccessor *set,
+                               ObjectPropertyRelease *release,
+                               ObjectPropertyFlags flags,
+                               void *opaque, Error **errp)
 {
     ObjectProperty *prop;
 
@@ -1352,8 +1352,8 @@ object_class_property_add(ObjectClass *klass,
                           ObjectPropertyRelease *release,
                           void *opaque)
 {
-    return object_class_property_try_add(klass, name, type, get, set, release,
-                                         0, opaque, &error_abort);
+    return object_class_property_add_full(klass, name, type, get, set, release,
+                                          0, opaque, &error_abort);
 }
 
 ObjectProperty *object_property_find(Object *obj, const char *name)
@@ -1863,9 +1863,9 @@ object_property_try_add_child(Object *obj, const char *name,
 
     type = g_strdup_printf("child<%s>", object_get_typename(child));
 
-    op = object_property_try_add(obj, name, type, object_get_child_property,
-                                 NULL, object_finalize_child_property, 0,
-                                 child, errp);
+    op = object_property_add_full(obj, name, type, object_get_child_property,
+                                  NULL, object_finalize_child_property, 0,
+                                  child, errp);
     if (!op) {
         return NULL;
     }
-- 
2.34.1