From: Daniel Wagner <[email protected]>

Introduce the second hash table which tracks the config object lifetime
based on the file existens. The parsing of the file and creation of the
config object is part of the next patch.
---
 plugins/session_policy_ivi.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/plugins/session_policy_ivi.c b/plugins/session_policy_ivi.c
index b5c3685..a34017a 100644
--- a/plugins/session_policy_ivi.c
+++ b/plugins/session_policy_ivi.c
@@ -24,6 +24,7 @@
 #endif
 
 #include <errno.h>
+#include <string.h>
 
 #include <glib.h>
 
@@ -35,6 +36,8 @@
 #include <connman/session.h>
 #include <connman/dbus.h>
 
+#define POLICYDIR STORAGEDIR "/session_policy_ivi"
+
 static DBusConnection *connection;
 
 static GHashTable *policy_hash;
@@ -238,6 +241,35 @@ static struct connman_session_policy session_policy_ivi = {
        .destroy = policy_ivi_destroy,
 };
 
+static int load_policy(struct policy_data *policy)
+{
+       return 0;
+}
+
+static int read_policies(void)
+{
+       GDir *dir;
+
+       DBG("");
+
+       dir = g_dir_open(POLICYDIR, 0, NULL);
+       if (dir != NULL) {
+               const gchar *file;
+
+               while ((file = g_dir_read_name(dir)) != NULL) {
+                       struct policy_data *policy;
+
+                       policy = create_policy(file);
+                       if (policy != NULL)
+                               load_policy(policy);
+               }
+
+               g_dir_close(dir);
+       }
+
+       return 0;
+}
+
 static int session_policy_ivi_init(void)
 {
        int err;
@@ -266,6 +298,8 @@ static int session_policy_ivi_init(void)
                goto err;
        }
 
+       read_policies();
+
        return 0;
 
 err:
-- 
1.7.11.7

_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman

Reply via email to