return ret;
}
+int tzip_clear_mount_info(void)
+{
+ int len;
+ int ret = 0;
+ FILE *fp;
+ char *file_entry = NULL;
+ gpointer key, value;
+ GHashTableIter iter;
+ struct tzip_mount_entry *entry;
+
+ /* no mount entry */
+ if (g_hash_table_size(hashmap) == 0) {
+ ret = unlink(TZIP_INFO_FILE);
+ if (ret < 0)
+ _E("unlink fail %s, %d", TZIP_INFO_FILE, errno);
+
+ return ret;
+ }
+
+ fp = fopen(TZIP_INFO_TMP_FILE, "w");
+ if (fp == NULL) {
+ _E("fopen() Failed!!!");
+ return -EIO;
+ }
+
+ g_hash_table_iter_init(&iter, hashmap);
+ while (g_hash_table_iter_next(&iter, &key, &value)) {
+ entry = (struct tzip_mount_entry*)value;
+
+ len = strlen(entry->zip_path) + strlen(entry->path) + 3;
+ file_entry = (char *)malloc(len);
+ if (!file_entry) {
+ _E("Malloc failed");
+ ret = -ENOMEM;
+ goto out;
+ }
+ snprintf(file_entry, len, "%s:%s\n", entry->zip_path, entry->path);
+
+ len = strlen(file_entry);
+ if (fwrite(file_entry, sizeof(char), len, fp) != len) {
+ _E(" fwrite Failed !!!! ");
+ free(file_entry);
+ ret = -EIO;
+ goto out;
+ }
+
+ free(file_entry);
+ }
+
+out:
+ fclose(fp);
+
+ if (ret == 0) {
+ ret = unlink(TZIP_INFO_FILE);
+ if (ret < 0)
+ _E("unlink fail %s, %d", TZIP_INFO_FILE, errno);
+
+ ret = rename(TZIP_INFO_TMP_FILE, TZIP_INFO_FILE);
+ if (ret < 0)
+ _E("rename fail %s, %s, %d", TZIP_INFO_TMP_FILE, TZIP_INFO_FILE, errno);
+ }
+
+ return ret;
+}
+
int tzip_remount_zipfs(const char *src_file, const char *mount_point)
{
int ret = 0;
#define DEFAULT_FILE_MODE 0755
#define TZIP_INFO_FILE "/run/.deviced"
+#define TZIP_INFO_TMP_FILE "/run/.deviced.tmpfile"
#define TZIP_MSGQ_NAME "/tzipmsgq"
GHashTable *hashmap_init(void);
GHashTable *get_hashmap(void);
+int tzip_clear_mount_info(void);
int tzip_store_mount_info(const char* zip_path, const char* mount_path);
int tzip_remount_zipfs(const char *src_file, const char *mount_point);