diff options
-rw-r--r-- | Makefile.plugins | 16 | ||||
-rw-r--r-- | configure.ac | 10 | ||||
-rw-r--r-- | plugins/session_policy_local.c (renamed from plugins/session_policy_ivi.c) | 54 |
3 files changed, 40 insertions, 40 deletions
diff --git a/Makefile.plugins b/Makefile.plugins index dcfc5990..48dec7a5 100644 --- a/Makefile.plugins +++ b/Makefile.plugins @@ -247,16 +247,16 @@ plugins_session_policy_la_LDFLAGS = $(plugin_ldflags) endif endif -if SESSION_POLICY_IVI -if SESSION_POLICY_IVI_BUILTIN -builtin_modules += session_policy_ivi -builtin_sources += plugins/session_policy_ivi.c +if SESSION_POLICY_LOCAL +if SESSION_POLICY_LOCAL_BUILTIN +builtin_modules += session_policy_local +builtin_sources += plugins/session_policy_local.c else -plugin_LTLIBRARIES += plugins/session_policy_ivi.la -plugin_objects += $(plugins_session_policy_ivi_la_OBJECTS) -plugins_session_policy_ivi_la_CFLAGS = $(plugin_cflags) \ +plugin_LTLIBRARIES += plugins/session_policy_local.la +plugin_objects += $(plugins_session_policy_local_la_OBJECTS) +plugins_session_policy_local_la_CFLAGS = $(plugin_cflags) \ -DSTORAGEDIR=\""$(storagedir)\"" -plugins_session_policy_ivi_la_LDFLAGS = $(plugin_ldflags) +plugins_session_policy_local_la_LDFLAGS = $(plugin_ldflags) endif endif diff --git a/configure.ac b/configure.ac index 76c1a18d..4d71f9c4 100644 --- a/configure.ac +++ b/configure.ac @@ -258,11 +258,11 @@ AC_ARG_ENABLE(session-policy, AM_CONDITIONAL(SESSION_POLICY, test "${enable_session_policy}" != "no") AM_CONDITIONAL(SESSION_POLICY_BUILTIN, test "${enable_session_policy}" = "builtin") -AC_ARG_ENABLE(session-policy-ivi, - AC_HELP_STRING([--enable-session-policy-ivi], [enable IVI Session policy configuration support]), - [enable_session_policy_ivi=${enableval}], [enable_session_policy_ivi="no"]) -AM_CONDITIONAL(SESSION_POLICY_IVI, test "${enable_session_policy_ivi}" != "no") -AM_CONDITIONAL(SESSION_POLICY_IVI_BUILTIN, test "${enable_session_policy_ivi}" = "builtin") +AC_ARG_ENABLE(session-policy-local, + AC_HELP_STRING([--enable-session-policy-local], [enable local file Session policy configuration support]), + [enable_session_policy_local=${enableval}], [enable_session_policy_local="no"]) +AM_CONDITIONAL(SESSION_POLICY_LOCAL, test "${enable_session_policy_local}" != "no") +AM_CONDITIONAL(SESSION_POLICY_LOCAL_BUILTIN, test "${enable_session_policy_local}" = "builtin") AC_ARG_WITH(stats-max-file-size, AC_HELP_STRING([--with-stats-max-file-size=SIZE], [Maximal size of a statistics round robin file]), diff --git a/plugins/session_policy_ivi.c b/plugins/session_policy_local.c index a652964b..7fa3166a 100644 --- a/plugins/session_policy_ivi.c +++ b/plugins/session_policy_local.c @@ -38,7 +38,7 @@ #include <connman/dbus.h> #include <connman/inotify.h> -#define POLICYDIR STORAGEDIR "/session_policy_ivi" +#define POLICYDIR STORAGEDIR "/session_policy_local" static DBusConnection *connection; @@ -198,7 +198,7 @@ done: g_free(ident); } -static int policy_ivi_create(struct connman_session *session, +static int policy_local_create(struct connman_session *session, connman_session_config_cb callback, void *user_data) { @@ -230,7 +230,7 @@ static int policy_ivi_create(struct connman_session *session, return 0; } -static void policy_ivi_destroy(struct connman_session *session) +static void policy_local_destroy(struct connman_session *session) { struct policy_data *policy; @@ -243,11 +243,11 @@ static void policy_ivi_destroy(struct connman_session *session) policy_unref(policy); } -static struct connman_session_policy session_policy_ivi = { - .name = "session ivi policy configuration", +static struct connman_session_policy session_policy_local = { + .name = "session local policy configuration", .priority = CONNMAN_SESSION_POLICY_PRIORITY_DEFAULT, - .create = policy_ivi_create, - .destroy = policy_ivi_destroy, + .create = policy_local_create, + .destroy = policy_local_destroy, }; static int load_keyfile(const char *pathname, GKeyFile **keyfile) @@ -460,24 +460,14 @@ static int read_policies(void) return err; } -static int session_policy_ivi_init(void) +static int session_policy_local_init(void) { int err; - err = connman_inotify_register(POLICYDIR, notify_handler); - if (err < 0) - return err; - connection = connman_dbus_get_connection(); if (connection == NULL) return -EIO; - err = connman_session_policy_register(&session_policy_ivi); - if (err < 0) { - dbus_connection_unref(connection); - return err; - } - session_hash = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL); if (session_hash == NULL) { @@ -492,40 +482,50 @@ static int session_policy_ivi_init(void) goto err; } - err = read_policies(); + err = connman_inotify_register(POLICYDIR, notify_handler); if (err < 0) goto err; + err = read_policies(); + if (err < 0) + goto err_notify; + + err = connman_session_policy_register(&session_policy_local); + if (err < 0) + goto err_notify; + return 0; +err_notify: + + connman_inotify_unregister(POLICYDIR, notify_handler); + err: if (session_hash != NULL) g_hash_table_destroy(session_hash); if (policy_hash != NULL) g_hash_table_destroy(policy_hash); - connman_session_policy_unregister(&session_policy_ivi); + connman_session_policy_unregister(&session_policy_local); dbus_connection_unref(connection); - connman_inotify_unregister(POLICYDIR, notify_handler); - return err; } -static void session_policy_ivi_exit(void) +static void session_policy_local_exit(void) { g_hash_table_destroy(session_hash); g_hash_table_destroy(policy_hash); - connman_session_policy_unregister(&session_policy_ivi); + connman_session_policy_unregister(&session_policy_local); dbus_connection_unref(connection); connman_inotify_unregister(POLICYDIR, notify_handler); } -CONNMAN_PLUGIN_DEFINE(session_policy_ivi, - "Session IVI policy configuration plugin", +CONNMAN_PLUGIN_DEFINE(session_policy_local, + "Session local file policy configuration plugin", VERSION, CONNMAN_PLUGIN_PRIORITY_DEFAULT, - session_policy_ivi_init, session_policy_ivi_exit) + session_policy_local_init, session_policy_local_exit) |