#include <unistd.h>
#include <sys/stat.h>
#include <dirent.h>
+#include <stdio.h>
#include <connman/storage.h>
#define SETTINGS "settings"
#define DEFAULT "default.profile"
+#if defined TIZEN_EXT
+#define INS_SETTINGS "settings.ins"
+#endif
#define MODE (S_IRUSR | S_IWUSR | S_IXUSR | S_IRGRP | \
S_IXGRP | S_IROTH | S_IXOTH)
GKeyFile *keyfile = NULL;
GError *error = NULL;
- DBG("Loading %s", pathname);
-
keyfile = g_key_file_new();
if (!g_key_file_load_from_file(keyfile, pathname, 0, &error)) {
ret = -EIO;
}
+#if defined TIZEN_EXT
+ {
+ FILE *fp = NULL;
+ fp = fopen(pathname, "a+");
+ if(fp){
+ fflush(fp);
+ fsync(fp->_fileno);
+ fclose(fp);
+ DBG("sync the file to disk");
+ }
+ }
+#endif
+
g_free(data);
return ret;
return ret;
}
-void __connman_storage_delete_global(void)
+#if defined TIZEN_EXT
+GKeyFile *__connman_storage_load_ins(void)
{
gchar *pathname;
+ GKeyFile *keyfile = NULL;
- pathname = g_strdup_printf("%s/%s", STORAGEDIR, SETTINGS);
+ pathname = g_strdup_printf("%s/%s", STORAGEDIR, INS_SETTINGS);
if (!pathname)
- return;
+ return NULL;
- storage_delete(pathname);
+ keyfile = storage_load(pathname);
g_free(pathname);
+
+ return keyfile;
}
-GKeyFile *__connman_storage_load_config(const char *ident)
+int __connman_storage_save_ins(GKeyFile *keyfile)
{
gchar *pathname;
- GKeyFile *keyfile = NULL;
+ int ret;
- pathname = g_strdup_printf("%s/%s.config", STORAGEDIR, ident);
+ pathname = g_strdup_printf("%s/%s", STORAGEDIR, INS_SETTINGS);
if (!pathname)
- return NULL;
+ return -ENOMEM;
- keyfile = storage_load(pathname);
+ ret = storage_save(keyfile, pathname);
g_free(pathname);
- return keyfile;
+ return ret;
}
+#endif
-GKeyFile *__connman_storage_load_provider_config(const char *ident)
+void __connman_storage_delete_global(void)
+{
+ gchar *pathname;
+
+ pathname = g_strdup_printf("%s/%s", STORAGEDIR, SETTINGS);
+ if (!pathname)
+ return;
+
+ storage_delete(pathname);
+
+ g_free(pathname);
+}
+
+GKeyFile *__connman_storage_load_config(const char *ident)
{
gchar *pathname;
GKeyFile *keyfile = NULL;
- pathname = g_strdup_printf("%s/%s.config", VPN_STORAGEDIR, ident);
+ pathname = g_strdup_printf("%s/%s.config", STORAGEDIR, ident);
if (!pathname)
return NULL;
return keyfile;
}
-GKeyFile *__connman_storage_open_service(const char *service_id)
+GKeyFile *__connman_storage_load_provider_config(const char *ident)
{
gchar *pathname;
GKeyFile *keyfile = NULL;
- pathname = g_strdup_printf("%s/%s/%s", STORAGEDIR, service_id, SETTINGS);
+ pathname = g_strdup_printf("%s/%s.config", VPN_STORAGEDIR, ident);
if (!pathname)
return NULL;
- keyfile = storage_load(pathname);
- if (keyfile) {
- g_free(pathname);
- return keyfile;
- }
+ keyfile = storage_load(pathname);
g_free(pathname);
- keyfile = g_key_file_new();
-
return keyfile;
}