From: Dongwoo Lee Date: Tue, 16 Jul 2019 01:43:41 +0000 (+0900) Subject: core: Remove late activation process X-Git-Tag: submit/tizen/20190730.044254~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=cdf2e4d1139c7b930d7331ac4fe2a2700ff98ee2;p=platform%2Fcore%2Fsystem%2Fpass.git core: Remove late activation process Since commit 239483e1b802 ("Rearrange pass.service into delayed.target"), there is no need to wait until systemd become ready because PASS is now delayed target service and thus it is guaranted that systemd is always prepared while pass is initialized. So, late activation for waiting systemd 'booting done' event is now unncessary. This patch remove callbacks for the event and relevant functions. Change-Id: I40a775af04ea4c00c7f39bbba5d73d8b59481d39 Signed-off-by: Dongwoo Lee --- diff --git a/include/pass/device-notifier.h b/include/pass/device-notifier.h index d95a6db..afde1fe 100644 --- a/include/pass/device-notifier.h +++ b/include/pass/device-notifier.h @@ -23,7 +23,7 @@ #include enum device_notifier_type { - DEVICE_NOTIFIER_BOOTING_DONE, + DEVICE_NOTIFIER_INIT_DONE, DEVICE_NOTIFIER_PMQOS, DEVICE_NOTIFIER_THERMAL, DEVICE_NOTIFIER_MAX, diff --git a/src/core/gdbus-util.c b/src/core/gdbus-util.c index c2846f5..410f8a6 100644 --- a/src/core/gdbus-util.c +++ b/src/core/gdbus-util.c @@ -24,96 +24,6 @@ static GDBusConnection *g_dbus_sys_conn[PASS_DBUS_MAX] = {NULL, }; -int pass_gdbus_register_systemd_startup_callback(GDBusSignalCallback cb, - gpointer user_data, guint *id) -{ - GDBusConnection *conn = g_dbus_sys_conn[PASS_DBUS_CORE]; - guint tmp_id; - - if (conn == NULL) { - _E("cannot get the dbus connection " - "to the system message bus\n"); - return -ENOSYS; - } - - tmp_id = g_dbus_connection_signal_subscribe(conn, - SYSTEMD_DBUS_NAME, - SYSTEMD_DBUS_IFACE_MANAGER, - "StartupFinished", - SYSTEMD_DBUS_OBJECT_PATH, - NULL, - G_DBUS_SIGNAL_FLAGS_NONE, - cb, - user_data, - NULL); - if (!tmp_id) - return -ENOTSUP; - - *id = tmp_id; - - return 0; -} - -int pass_gdbus_unregister_systemd_startup_callback(guint id) -{ - GDBusConnection *conn = g_dbus_sys_conn[PASS_DBUS_CORE]; - - if (conn == NULL) { - _E("cannot get the dbus connection " - "to the system message bus\n"); - return -ENOSYS; - } - - if (!id) - return -EINVAL; - - g_dbus_connection_signal_unsubscribe(conn, id); - - return 0; -} - -int pass_gdbus_get_systemd_dbus_property_string(const char *iface, - const char *prop, const char **value) -{ - GDBusConnection *conn = g_dbus_sys_conn[PASS_DBUS_CORE]; - GError *error = NULL; - GVariant *reply; - GVariant *result; - - if (conn == NULL) { - _E("cannot get the dbus connection " - "to the system message bus\n"); - return -ENOSYS; - } - - reply = g_dbus_connection_call_sync(conn, - SYSTEMD_DBUS_NAME, - SYSTEMD_DBUS_OBJECT_PATH, - SYSTEMD_DBUS_IFACE_FOR_PROPS, - SYSTEMD_DBUS_METHOD_GET_PROP, - g_variant_new(SYSTEMD_DBUS_METHOD_GET_PROP_ARG_TYPE, - iface, - prop), - G_VARIANT_TYPE(SYSTEMD_DBUS_METHOD_GET_PROP_RET_TYPE), - G_DBUS_SIGNAL_FLAGS_NONE, - -1, - NULL, - &error); - if (error != NULL) { - _E("cannot get property: %s\n", error->message); - return -EINVAL; - } - - g_variant_get(reply, SYSTEMD_DBUS_METHOD_GET_PROP_RET_TYPE, &result); - *value = g_variant_get_string(result, NULL); - if (*value == NULL) { - _E("cannot get property: not string value property\n"); - return -EINVAL; - } - - return 0; -} - int pass_gdbus_export_interface(passdbus idx, gpointer instance, const char *obj_path) { diff --git a/src/core/main.c b/src/core/main.c index 46944a4..15475e2 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -29,7 +29,6 @@ #include #include -unsigned int g_startup_cb_id; GMainLoop *g_mainloop; static void sig_quit(int signo) @@ -44,50 +43,6 @@ static void sig_usr1(int signo) g_main_loop_quit(g_mainloop); } -static bool check_systemd_state(void) -{ - const char *prop = "SystemState"; - const char *prop_valid_values[] = {"running", "degraded", NULL}; - const char *value; - int i, ret; - - ret = pass_gdbus_get_systemd_dbus_property_string( - SYSTEMD_DBUS_IFACE_MANAGER, - prop, &value); - if (ret < 0) - return false; - - i = 0; - while (prop_valid_values[i] != NULL) { - if (!strncmp(prop_valid_values[i], value, - strlen(prop_valid_values[i]))) - return true; - - i++; - } - - return false; -} - -static void cb_systemd_startup_finished(GDBusConnection *connection, - const gchar *sender_name, - const gchar *object_path, - const gchar *interface_name, - const gchar *signal_name, - GVariant *parameters, - gpointer user_data) -{ - int ret; - - if (check_systemd_state()) { - ret = 1; - device_notify(DEVICE_NOTIFIER_BOOTING_DONE, &ret); - } - - pass_gdbus_unregister_systemd_startup_callback(g_startup_cb_id); - g_startup_cb_id = 0; -} - static int late_init(void) { int ret; @@ -99,17 +54,8 @@ static int late_init(void) if (ret < 0) return ret; - if (check_systemd_state()) { - ret = 1; - device_notify(DEVICE_NOTIFIER_BOOTING_DONE, &ret); - } else { - ret = pass_gdbus_register_systemd_startup_callback( - cb_systemd_startup_finished, - NULL, - &g_startup_cb_id); - if (ret < 0) - return ret; - } + ret = 1; + device_notify(DEVICE_NOTIFIER_INIT_DONE, &ret); return 0; } diff --git a/src/pass/pass.c b/src/pass/pass.c index 0c5abca..39af785 100644 --- a/src/pass/pass.c +++ b/src/pass/pass.c @@ -471,7 +471,7 @@ static void pass_init(void *data) */ static void pass_exit(void *data) { - unregister_notifier(DEVICE_NOTIFIER_BOOTING_DONE, + unregister_notifier(DEVICE_NOTIFIER_INIT_DONE, pass_init_done, NULL); pass_gdbus_disconnect_signal(g_gdbus_instance, @@ -529,7 +529,7 @@ static int pass_probe(void *data) * initialization of the daemon is performed by this notifier after * booting is completely done. */ - ret = register_notifier(DEVICE_NOTIFIER_BOOTING_DONE, + ret = register_notifier(DEVICE_NOTIFIER_INIT_DONE, pass_init_done, NULL); if (ret < 0) { _E("cannot register booting-done notifier for the pass (%d)\n", diff --git a/src/pmqos/pmqos.c b/src/pmqos/pmqos.c index edb1599..e527364 100644 --- a/src/pmqos/pmqos.c +++ b/src/pmqos/pmqos.c @@ -573,7 +573,7 @@ static void pmqos_free(void) */ static void pmqos_exit(void *data) { - unregister_notifier(DEVICE_NOTIFIER_BOOTING_DONE, + unregister_notifier(DEVICE_NOTIFIER_INIT_DONE, pmqos_init_done, NULL); pass_gdbus_disconnect_signal(g_gdbus_instance, @@ -627,7 +627,7 @@ static int pmqos_probe(void *data) * initialization of the daemon is performed by this notifier after * booting is completely done. */ - ret = register_notifier(DEVICE_NOTIFIER_BOOTING_DONE, + ret = register_notifier(DEVICE_NOTIFIER_INIT_DONE, pmqos_init_done, NULL); if (ret < 0) { _E("cannot register a callback function \ diff --git a/src/thermal/thermal.c b/src/thermal/thermal.c index 211d3ca..e40e70d 100644 --- a/src/thermal/thermal.c +++ b/src/thermal/thermal.c @@ -301,7 +301,7 @@ static void thermal_init(void *data) */ static void thermal_exit(void *data) { - unregister_notifier(DEVICE_NOTIFIER_BOOTING_DONE, + unregister_notifier(DEVICE_NOTIFIER_INIT_DONE, thermal_init_done, NULL); pass_gdbus_disconnect_signal(g_gdbus_instance, @@ -372,7 +372,7 @@ static int thermal_probe(void *data) * initialization of the daemon is performed by this notifier after * booting is completely done. */ - ret = register_notifier(DEVICE_NOTIFIER_BOOTING_DONE, + ret = register_notifier(DEVICE_NOTIFIER_INIT_DONE, thermal_init_done, NULL); if (ret < 0) { _E("failed to register a callback function \ @@ -392,7 +392,7 @@ static int thermal_probe(void *data) return 0; out_booting_done: - unregister_notifier(DEVICE_NOTIFIER_BOOTING_DONE, + unregister_notifier(DEVICE_NOTIFIER_INIT_DONE, thermal_init_done, NULL); out_disconnect: pass_gdbus_disconnect_signal(g_gdbus_instance,