diff options
author | Markus Armbruster <armbru@redhat.com> | 2020-07-07 18:05:55 +0200 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2020-07-10 15:18:08 +0200 |
commit | 6fd5bef10b8f0bf64df4e800bfda1da5fe17ca82 (patch) | |
tree | 40f3471de7e651e1325a733dc056c330f9552ef4 /include | |
parent | 5325cc34a2ca985283134c7e264be7851b112d4e (diff) |
qom: Make functions taking Error ** return bool, not void
See recent commit "error: Document Error API usage rules" for
rationale.
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-Id: <20200707160613.848843-28-armbru@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/qom/object.h | 42 | ||||
-rw-r--r-- | include/qom/object_interfaces.h | 12 | ||||
-rw-r--r-- | include/qom/qom-qobject.h | 4 |
3 files changed, 43 insertions, 15 deletions
diff --git a/include/qom/object.h b/include/qom/object.h index 7c2c6791a4..1088e5a34d 100644 --- a/include/qom/object.h +++ b/include/qom/object.h @@ -703,7 +703,7 @@ Object *object_new_with_propv(const char *typename, Error **errp, va_list vargs); -void object_apply_global_props(Object *obj, const GPtrArray *props, +bool object_apply_global_props(Object *obj, const GPtrArray *props, Error **errp); void object_set_machine_compat_props(GPtrArray *compat_props); void object_set_accelerator_compat_props(GPtrArray *compat_props); @@ -798,8 +798,10 @@ void object_initialize(void *obj, size_t size, const char *typename); * strings. The propname of %NULL indicates the end of the property list. * If the object implements the user creatable interface, the object will * be marked complete once all the properties have been processed. + * + * Returns: %true on success, %false on failure. */ -void object_initialize_child_with_props(Object *parentobj, +bool object_initialize_child_with_props(Object *parentobj, const char *propname, void *childobj, size_t size, const char *type, Error **errp, ...) QEMU_SENTINEL; @@ -815,8 +817,10 @@ void object_initialize_child_with_props(Object *parentobj, * @vargs: list of property names and values * * See object_initialize_child() for documentation. + * + * Returns: %true on success, %false on failure. */ -void object_initialize_child_with_propsv(Object *parentobj, +bool object_initialize_child_with_propsv(Object *parentobj, const char *propname, void *childobj, size_t size, const char *type, Error **errp, va_list vargs); @@ -1209,8 +1213,10 @@ void object_unparent(Object *obj); * @errp: returns an error if this function fails * * Reads a property from a object. + * + * Returns: %true on success, %false on failure. */ -void object_property_get(Object *obj, const char *name, Visitor *v, +bool object_property_get(Object *obj, const char *name, Visitor *v, Error **errp); /** @@ -1220,8 +1226,10 @@ void object_property_get(Object *obj, const char *name, Visitor *v, * @errp: returns an error if this function fails * * Writes a string value to a property. + * + * Returns: %true on success, %false on failure. */ -void object_property_set_str(Object *obj, const char *name, +bool object_property_set_str(Object *obj, const char *name, const char *value, Error **errp); /** @@ -1249,8 +1257,9 @@ char *object_property_get_str(Object *obj, const char *name, * <code>OBJ_PROP_LINK_STRONG</code> bit, the old target object is * unreferenced, and a reference is added to the new target object. * + * Returns: %true on success, %false on failure. */ -void object_property_set_link(Object *obj, const char *name, +bool object_property_set_link(Object *obj, const char *name, Object *value, Error **errp); /** @@ -1273,8 +1282,10 @@ Object *object_property_get_link(Object *obj, const char *name, * @errp: returns an error if this function fails * * Writes a bool value to a property. + * + * Returns: %true on success, %false on failure. */ -void object_property_set_bool(Object *obj, const char *name, +bool object_property_set_bool(Object *obj, const char *name, bool value, Error **errp); /** @@ -1296,8 +1307,10 @@ bool object_property_get_bool(Object *obj, const char *name, * @errp: returns an error if this function fails * * Writes an integer value to a property. + * + * Returns: %true on success, %false on failure. */ -void object_property_set_int(Object *obj, const char *name, +bool object_property_set_int(Object *obj, const char *name, int64_t value, Error **errp); /** @@ -1319,8 +1332,10 @@ int64_t object_property_get_int(Object *obj, const char *name, * @errp: returns an error if this function fails * * Writes an unsigned integer value to a property. + * + * Returns: %true on success, %false on failure. */ -void object_property_set_uint(Object *obj, const char *name, +bool object_property_set_uint(Object *obj, const char *name, uint64_t value, Error **errp); /** @@ -1359,8 +1374,10 @@ int object_property_get_enum(Object *obj, const char *name, * @errp: returns an error if this function fails * * Writes a property to a object. + * + * Returns: %true on success, %false on failure. */ -void object_property_set(Object *obj, const char *name, Visitor *v, +bool object_property_set(Object *obj, const char *name, Visitor *v, Error **errp); /** @@ -1371,8 +1388,10 @@ void object_property_set(Object *obj, const char *name, Visitor *v, * @errp: returns an error if this function fails * * Parses a string and writes the result into a property of an object. + * + * Returns: %true on success, %false on failure. */ -void object_property_parse(Object *obj, const char *name, +bool object_property_parse(Object *obj, const char *name, const char *string, Error **errp); /** @@ -1815,6 +1834,7 @@ ObjectProperty *object_property_add_const_link(Object *obj, const char *name, * * Set an object property's description. * + * Returns: %true on success, %false on failure. */ void object_property_set_description(Object *obj, const char *name, const char *description); diff --git a/include/qom/object_interfaces.h b/include/qom/object_interfaces.h index 65172120fa..7035829337 100644 --- a/include/qom/object_interfaces.h +++ b/include/qom/object_interfaces.h @@ -57,8 +57,10 @@ typedef struct UserCreatableClass { * Wrapper to call complete() method if one of types it's inherited * from implements USER_CREATABLE interface, otherwise the call does * nothing. + * + * Returns: %true on success, %false on failure. */ -void user_creatable_complete(UserCreatable *uc, Error **errp); +bool user_creatable_complete(UserCreatable *uc, Error **errp); /** * user_creatable_can_be_deleted: @@ -100,8 +102,10 @@ Object *user_creatable_add_type(const char *type, const char *id, * @qdict. The object type is taken from the QDict key 'qom-type', its * ID from the key 'id'. The remaining entries in @qdict are used to * initialize the object properties. + * + * Returns: %true on success, %false on failure. */ -void user_creatable_add_dict(QDict *qdict, bool keyval, Error **errp); +bool user_creatable_add_dict(QDict *qdict, bool keyval, Error **errp); /** * user_creatable_add_opts: @@ -167,8 +171,10 @@ bool user_creatable_print_help(const char *type, QemuOpts *opts); * * Delete an instance of the user creatable object identified * by @id. + * + * Returns: %true on success, %false on failure. */ -void user_creatable_del(const char *id, Error **errp); +bool user_creatable_del(const char *id, Error **errp); /** * user_creatable_cleanup: diff --git a/include/qom/qom-qobject.h b/include/qom/qom-qobject.h index ad9a98dd62..73e4e0e474 100644 --- a/include/qom/qom-qobject.h +++ b/include/qom/qom-qobject.h @@ -33,8 +33,10 @@ struct QObject *object_property_get_qobject(Object *obj, const char *name, * @errp: returns an error if this function fails * * Writes a property to a object. + * + * Returns: %true on success, %false on failure. */ -void object_property_set_qobject(Object *obj, +bool object_property_set_qobject(Object *obj, const char *name, struct QObject *value, struct Error **errp); |