apply encoded name to the source file of losetup.
[platform/core/appfw/app2sd.git] / plugin / app2sd / inc / app2sd_internals.h
old mode 100755 (executable)
new mode 100644 (file)
index b2e1a91..1ee6274
@@ -28,8 +28,8 @@
 #define _GNU_SOURCE
 #endif
 
-#ifndef _BSD_SOURCE
-#define _BSD_SOURCE
+#ifndef _DEFAULT_SOURCE
+#define _DEFAULT_SOURCE
 #endif
 
 /*Include Headers*/
@@ -47,6 +47,7 @@
 #include <errno.h>
 #include <sys/mount.h>
 #include <app2sd_interface.h>
+#include <math.h>
 
 #define DIR_PERMS (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH)
 
@@ -58,6 +59,7 @@
 #define DEV_MAJOR              7
 
 #define FS_TYPE                "ext4"
+#define INTERNAL_STORAGE_PATH "/opt"
 
 typedef enum mount_type_t {
        MOUNT_TYPE_RD = 0,
@@ -80,15 +82,6 @@ typedef enum app2sd_cmd_t {
        APP2SD_MOVE_APP_TO_PHONE
 } app2sd_cmd;
 
-/*This will store password in DB*/
-int _app2sd_set_passwod_in_db(const char *pkgid, const char *password);
-
-/*This will remove password from db*/
-int _app2sd_remove_password_from_db(const char *pkgid);
-
-/*This will fetch password from db*/
-char *_app2sd_get_passowrd_from_db(const char *pkgid);
-
 /*Checks whether mmc is present or not*/
 int _app2sd_check_mmc_status(void);
 
@@ -99,10 +92,14 @@ int _xsystem(const char *argv[]);
 int _app2sd_get_available_free_memory(const char *sd_path, int *free_mem);
 
 /*Function to move the application from/to SD Card*/
-int _app2sd_move_app(const char *pkgid, app2ext_move_type move_cmd, GList* dir_list);
+int _app2sd_usr_move_app(const char *pkgid, app2ext_move_type move_cmd,
+               GList* dir_list, uid_t uid);
 
 /*utility to delete the directory*/
-int _app2sd_delete_directory(char *dirname);
+int _app2sd_delete_directory(const char *dirname);
+
+/*utility to delete symbolic link*/
+void _app2sd_delete_symlink(const char *dirname);
 
 /*utility to calculate the size of a directory in MB*/
 unsigned long long _app2sd_calculate_dir_size(char *dirname);
@@ -116,53 +113,59 @@ int _app2sd_copy_dir(const char *src, const char *dest);
 /*Utility to rename a directory*/
 int _app2sd_rename_dir(const char *old_name, const char *new_name);
 
-/*Utility to create application directory structure entry as per package type*/
-int _app2sd_create_directory_entry(const char *pkgid, GList* dir_list);
-
 /* Utility to create symlinks */
 int _app2sd_create_symlink(char *pkgid);
 
 /*This function finds the associated device node for the app*/
-char *_app2sd_find_associated_device_node(const char *pkgid);
+char *_app2sd_find_associated_device_node(const char *loopback_device);
 
 /*This function does the loopback encryption for app*/
-char *_app2sd_do_loopback_encryption_setup(const char *pkgid);
+char *_app2sd_do_loopback_encryption_setup(const char *pkgid,
+               const char *loopback_device, uid_t uid);
 
 /*This function detaches the loopback device*/
 char *_app2sd_detach_loop_device(const char *device);
 
 /*This function finds loopback device associated with the app*/
-char *_app2sd_find_associated_device(const char *mmc_app_path);
+char *_app2sd_find_associated_device(const char *loopback_device);
 
 /*This function creates loopback device*/
-int _app2sd_create_loopback_device(const char *pkgid, int size);
+int _app2sd_create_loopback_device(const char *pkgid,
+               const char *loopback_device, int size);
 
 /*This function deletes loopback device associated with the app*/
-int _app2sd_delete_loopback_device(const char *pkgid);
+int _app2sd_delete_loopback_device(const char *loopback_device);
 
 /*This function creates ext4 FS on the device path*/
 int _app2sd_create_file_system(const char *device_path);
 
 /*This function mounts the app content on the device node*/
-int _app2sd_mount_app_content(const char *pkgid, const char *dev,
-                       int mount_type, GList* dir_list, app2sd_cmd cmd);
+int _app2sd_mount_app_content(const char *application_path, const char *pkgid,
+               const char *dev, int mount_type, GList* dir_list,
+               app2sd_cmd cmd, uid_t uid);
 
 /*This function unmounts the app content */
-int _app2sd_unmount_app_content(const char *pkgid);
+int _app2sd_unmount_app_content(const char *application_path);
 
 /*This function removes the loopbck encryption setup for the app*/
-int _app2sd_remove_loopback_encryption_setup(const char *pkgid);
+int _app2sd_remove_loopback_encryption_setup(const char *loopback_device);
+
+/*This function removes all of loopbck encryption setup for the app*/
+int _app2sd_remove_all_loopback_encryption_setups(const char *loopback_device);
 
 /*This function updates loopback device size*/
 int _app2sd_update_loopback_device_size(const char *pkgid,
-       int size, GList* dir_list);
+               const char *loopback_device, const char *application_path,
+               const char *temp_pkgid, const char *temp_loopback_device,
+               const char *temp_application_path, int size, GList* dir_list,
+               uid_t uid);
 
 /* This generates password */
 char *_app2sd_generate_password(const char *pkgid);
 
 /*This function encrypts device*/
-char *_app2sd_encrypt_device(const char *device, const char *pkgid,
-                              char *passwd);
+char *_app2sd_encrypt_device(const char *device, const char *loopback_device,
+               char *passwd);
 
 /*This function finds free device*/
 char *_app2sd_find_free_device(void);
@@ -177,11 +180,13 @@ char *_app2sd_get_password_from_db(const char *pkgid);
 int _app2sd_remove_password_from_db(const char *pkgid);
 
 /* This functions saved password in db */
-int _app2sd_set_password_in_db(const char *pkgid,
-                                     const char *passwd);
+int _app2sd_set_password_in_db(const char *pkgid, const char *passwd);
+
+/* This functions make result file */
+void _app2sd_make_result_info_file(char *pkgid, int size, uid_t uid);
+
+int _is_global(uid_t uid);
 
-/* This functions setup path for smack */
-int _app2sd_setup_path(const char *pkgid, const char *dirpath,
-                                               int apppathtype, const char *groupid);
+char *_app2sd_get_encoded_name(const char *pkgid, uid_t uid);
 
 #endif