core: Remove late activation process 46/210146/3
authorDongwoo Lee <dwoo08.lee@samsung.com>
Tue, 16 Jul 2019 01:43:41 +0000 (10:43 +0900)
committerDongwoo Lee <dwoo08.lee@samsung.com>
Tue, 16 Jul 2019 08:07:26 +0000 (17:07 +0900)
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 <dwoo08.lee@samsung.com>
include/pass/device-notifier.h
src/core/gdbus-util.c
src/core/main.c
src/pass/pass.c
src/pmqos/pmqos.c
src/thermal/thermal.c

index d95a6db47a85702288939dc6297ff70ccfbfd5a9..afde1fe9351f741ad3473c24e12d04b131f1e5a8 100644 (file)
@@ -23,7 +23,7 @@
 #include <stdbool.h>
 
 enum device_notifier_type {
-       DEVICE_NOTIFIER_BOOTING_DONE,
+       DEVICE_NOTIFIER_INIT_DONE,
        DEVICE_NOTIFIER_PMQOS,
        DEVICE_NOTIFIER_THERMAL,
        DEVICE_NOTIFIER_MAX,
index c2846f594ddb03d22ebdb27cb89b442a4d588148..410f8a6d4699b512211e307d1a48203409a7972a 100644 (file)
 
 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)
 {
index 46944a41932726b9ba09688429e7810a96bbc08d..15475e2d71d94eb0c45e8ef2a46168519c40739f 100644 (file)
@@ -29,7 +29,6 @@
 #include <pass/gdbus-util.h>
 #include <pass/log.h>
 
-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;
 }
index 0c5abcaabe99a57f32d82afdf7db17a67472fb5a..39af785ed216589a6202b0c9cebc88c717a7b79d 100644 (file)
@@ -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",
index edb15994e3052ba47cc3872353bbf0181cbf9581..e527364fae6bfddb5fcf5be4c1c86e73358d5eee 100644 (file)
@@ -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 \
index 211d3cac2988c9656d4d6eccd55f95c55e9cd34f..e40e70d6520da8b03d2cc39a1e6d26608af4f472 100644 (file)
@@ -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,