diff mbox series

[2/2] dbus: add l_dbus_object_set_data()

Message ID 20240807175943.170002-2-prestwoj@gmail.com (mailing list archive)
State New
Headers show
Series [1/2] dbus: add _dbus_object_tree_set_interface_data | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success

Commit Message

James Prestwood Aug. 7, 2024, 5:59 p.m. UTC
Modifies the user data of an existing DBus object.
---
 ell/dbus.c  | 13 +++++++++++++
 ell/dbus.h  |  2 ++
 ell/ell.sym |  1 +
 3 files changed, 16 insertions(+)

Comments

Denis Kenzior Aug. 8, 2024, 2:19 p.m. UTC | #1
Hi James,

On 8/7/24 12:59 PM, James Prestwood wrote:
> Modifies the user data of an existing DBus object.
> ---
>   ell/dbus.c  | 13 +++++++++++++
>   ell/dbus.h  |  2 ++
>   ell/ell.sym |  1 +
>   3 files changed, 16 insertions(+)
> 

<snip>

> diff --git a/ell/ell.sym b/ell/ell.sym
> index 0dad73f..aafc0a4 100644
> --- a/ell/ell.sym
> +++ b/ell/ell.sym
> @@ -225,6 +225,7 @@ global:
>   	l_dbus_object_add_interface;
>   	l_dbus_object_remove_interface;
>   	l_dbus_object_get_data;
> +        l_dbus_object_set_data;
>   	l_dbus_object_manager_enable;
>   	l_dbus_add_disconnect_watch;
>   	l_dbus_add_service_watch;

Seems we use tabs here, not spaces.  I fixed that and applied both.  Thanks.

Regards,
-Denis
diff mbox series

Patch

diff --git a/ell/dbus.c b/ell/dbus.c
index a1ce09e..cd14eef 100644
--- a/ell/dbus.c
+++ b/ell/dbus.c
@@ -1694,6 +1694,19 @@  LIB_EXPORT void *l_dbus_object_get_data(struct l_dbus *dbus, const char *object,
 							interface);
 }
 
+LIB_EXPORT bool l_dbus_object_set_data(struct l_dbus *dbus, const char *object,
+				const char *interface, void *user_data)
+{
+	if (unlikely(!dbus))
+		return false;
+
+	if (unlikely(!dbus->tree))
+		return false;
+
+	return _dbus_object_tree_set_interface_data(dbus->tree, object,
+							interface, user_data);
+}
+
 LIB_EXPORT bool l_dbus_object_manager_enable(struct l_dbus *dbus,
 						const char *root)
 {
diff --git a/ell/dbus.h b/ell/dbus.h
index 21bd4bf..6ec9c83 100644
--- a/ell/dbus.h
+++ b/ell/dbus.h
@@ -227,6 +227,8 @@  bool l_dbus_object_remove_interface(struct l_dbus *dbus, const char *object,
 					const char *interface);
 void *l_dbus_object_get_data(struct l_dbus *dbus, const char *object,
 				const char *interface);
+bool l_dbus_object_set_data(struct l_dbus *dbus, const char *object,
+				const char *interface, void *user_data);
 
 bool l_dbus_object_manager_enable(struct l_dbus *dbus, const char *root);
 
diff --git a/ell/ell.sym b/ell/ell.sym
index 0dad73f..aafc0a4 100644
--- a/ell/ell.sym
+++ b/ell/ell.sym
@@ -225,6 +225,7 @@  global:
 	l_dbus_object_add_interface;
 	l_dbus_object_remove_interface;
 	l_dbus_object_get_data;
+        l_dbus_object_set_data;
 	l_dbus_object_manager_enable;
 	l_dbus_add_disconnect_watch;
 	l_dbus_add_service_watch;