From bd545612614a88b0f4edfdaea3750c3fdd5811af Mon Sep 17 00:00:00 2001 From: Dongwoo Lee Date: Mon, 15 Jul 2019 17:07:00 +0900 Subject: [PATCH] core: Add name acquired event handler parameter to dbus name own API. To register handler for name acquired event for dbus name own process, this patch adds it as parameter. Change-Id: I91ffaf85100e49a80e9654a039ff544b37e210b4 Signed-off-by: Dongwoo Lee --- include/pass/gdbus-util.h | 3 ++- src/core/gdbus-util.c | 5 +++-- src/core/main.c | 2 +- src/thermal/thermal.c | 3 ++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/include/pass/gdbus-util.h b/include/pass/gdbus-util.h index 2f8e078..0efbd68 100644 --- a/include/pass/gdbus-util.h +++ b/include/pass/gdbus-util.h @@ -42,7 +42,8 @@ int pass_gdbus_unregister_systemd_startup_callback(guint id); int pass_gdbus_get_systemd_dbus_property_string(const char *iface, const char *prop, const char **value); int pass_gdbus_export_interface(passdbus idx, gpointer instance, const char *obj_path); -int pass_gdbus_get_name(passdbus idx, const char *name); +int pass_gdbus_get_name(passdbus idx, const char *name, + GBusNameAcquiredCallback gdbus_name_cb); int pass_gdbus_connect_signal(gpointer instance, int num_signals, struct pass_gdbus_signal_info *signal_infos); void pass_gdbus_disconnect_signal(gpointer instance, int num_signals, diff --git a/src/core/gdbus-util.c b/src/core/gdbus-util.c index 410f8a6..147e508 100644 --- a/src/core/gdbus-util.c +++ b/src/core/gdbus-util.c @@ -51,7 +51,8 @@ int pass_gdbus_export_interface(passdbus idx, gpointer instance, return -1; } -int pass_gdbus_get_name(passdbus idx, const char *name) +int pass_gdbus_get_name(passdbus idx, const char *name, + GBusNameAcquiredCallback gdbus_name_cb) { guint id; @@ -62,7 +63,7 @@ int pass_gdbus_get_name(passdbus idx, const char *name) id = g_bus_own_name_on_connection(g_dbus_sys_conn[idx], name, G_BUS_NAME_OWNER_FLAGS_NONE, - NULL, NULL, NULL, NULL); + gdbus_name_cb, NULL, NULL, NULL); if (id == 0) return -ENOSYS; diff --git a/src/core/main.c b/src/core/main.c index 15475e2..7d8176e 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -50,7 +50,7 @@ static int late_init(void) signal(SIGTERM, sig_quit); signal(SIGUSR1, sig_usr1); - ret = pass_gdbus_get_name(PASS_DBUS_CORE, DBUS_PASS_BUS_NAME); + ret = pass_gdbus_get_name(PASS_DBUS_CORE, DBUS_PASS_BUS_NAME, NULL); if (ret < 0) return ret; diff --git a/src/thermal/thermal.c b/src/thermal/thermal.c index e40e70d..fd91e17 100644 --- a/src/thermal/thermal.c +++ b/src/thermal/thermal.c @@ -331,7 +331,8 @@ static int thermal_probe(void *data) return -ENOENT; } - ret = pass_gdbus_get_name(PASS_DBUS_THERMAL, DBUS_THERMAL_BUS_NAME); + ret = pass_gdbus_get_name(PASS_DBUS_THERMAL, + DBUS_THERMAL_BUS_NAME, NULL); if (ret < 0) { _E("Failed to own dbus name '%s'\n", DBUS_THERMAL_BUS_NAME); ret = -EINVAL; -- 2.7.4