Type mismatch issue fix. Use ms_user_storage_type_e instead of ms_storage_type_t 79/166379/1
authorhj kim <backto.kim@samsung.com>
Tue, 9 Jan 2018 06:44:35 +0000 (15:44 +0900)
committerhj kim <backto.kim@samsung.com>
Wed, 10 Jan 2018 02:13:03 +0000 (11:13 +0900)
Change-Id: I2c0ad4a0d2607151660387429278b6f02a0b9f6d

src/common/include/media-common-db-svc.h
src/common/include/media-common-types.h
src/common/include/media-common-utils.h
src/common/media-common-db-svc.c
src/common/media-common-utils.c
src/scanner-v2/media-scanner-extract-v2.c
src/scanner-v2/media-scanner-scan-v2.c
src/scanner/media-scanner-scan.c
src/server/media-server-device-block.c
src/server/media-server-main.c
src/server/media-server-socket.c

index b7e667b..87a17f6 100755 (executable)
@@ -116,9 +116,9 @@ int ms_cleanup_db(void **handle, uid_t uid);
 int ms_validate_item(void **handle, const char *storage_id, const char *path, uid_t uid);
 int ms_insert_item_batch(void **handle, const char *storage_id, const char *path, uid_t uid);
 int ms_insert_burst_item(void **handle, const char *storage_id, const char *path, uid_t uid);
-bool ms_delete_all_items(void **handle, const char *storage_id, ms_storage_type_t storage_type, uid_t uid);
-int ms_validaty_change_all_items(void **handle, const char *storage_id, ms_storage_type_t storage_type, bool validity, uid_t uid);
-bool ms_delete_invalid_items(void **handle, const char *storage_id, ms_storage_type_t storage_type, uid_t uid);
+bool ms_delete_all_items(void **handle, const char *storage_id, ms_user_storage_type_e storage_type, uid_t uid);
+int ms_validaty_change_all_items(void **handle, const char *storage_id, ms_user_storage_type_e storage_type, bool validity, uid_t uid);
+bool ms_delete_invalid_items(void **handle, const char *storage_id, ms_user_storage_type_e storage_type, uid_t uid);
 int ms_set_folder_item_validity(void **handle, const char *storage_id, const char *path, int validity, int recursive, uid_t uid);
 int ms_send_dir_update_noti(void **handle, const char *storage_id, const char *path, const char *folder_id, ms_noti_type_e noti_type, int pid);
 int ms_update_folder_time(void **handle, const char *storage_id, char *folder_path, uid_t uid);
index a2b06df..45920e7 100755 (executable)
@@ -78,12 +78,6 @@ typedef enum {
 #define MS_DUMMY_MEDIA_DB_PATH MS_MM_CONF_PATH".media.db"
 
 typedef enum {
-       MS_STORAGE_INTERNAL = 0,        /**< The device's internal storage */
-       MS_STORAGE_EXTERNAL = 1,        /**< The device's external storage */
-       MS_STORAGE_EXTERNAL_USB = 2,    /**< The external USB storage (Since 2.4) */
-} ms_storage_type_t;
-
-typedef enum {
        MS_SDCARD_INSERTED,     /**< Stored only in phone */
        MS_SDCARD_REMOVED,      /**< Stored only in MMC */
 } ms_sdcard_status_type_t;
index b6d07ed..dba8275 100755 (executable)
@@ -23,6 +23,7 @@
 #ifndef _MEDIA_SERVER_UTILS_H__
 #define _MEDIA_SERVER_UTILS_H__
 
+#include "media-util.h"
 #include "media-common-types.h"
 
 int ms_strappend(char *res, const int size, const char *pattern, const char *str1, const char *str2);
@@ -43,7 +44,7 @@ int ms_check_file_path(const char *file_path, uid_t uid);
 int ms_check_ignore_dir(const char *full_path, uid_t uid);
 int ms_check_scan_ignore(char * path);
 bool ms_storage_mount_status(const char* start_path);
-int ms_set_db_status(ms_db_status_type_t status, ms_storage_type_t storage_type);
+int ms_set_db_status(ms_db_status_type_t status, ms_user_storage_type_e storage_type);
 int ms_set_power_mode(ms_db_status_type_t status);
 void ms_trim_dir_path(char *dir_path);
 int ms_check_size_mediadb(uid_t uid, double *db_size);
index a6f4842..4e07296 100755 (executable)
@@ -486,7 +486,7 @@ int ms_scan_validate_item(void **handle, const char *storage_id, const char *pat
        return res;
 }
 
-int ms_validaty_change_all_items(void **handle, const char *storage_id, ms_storage_type_t storage_type, bool validity , uid_t uid)
+int ms_validaty_change_all_items(void **handle, const char *storage_id, ms_user_storage_type_e storage_type, bool validity , uid_t uid)
 {
        int lib_index;
        int res = MS_MEDIA_ERR_NONE;
@@ -638,7 +638,7 @@ int ms_insert_burst_item(void **handle, const char *storage_id, const char *path
        return res;
 }
 
-bool ms_delete_all_items(void **handle, const char *storage_id, ms_storage_type_t storage_type, uid_t uid)
+bool ms_delete_all_items(void **handle, const char *storage_id, ms_user_storage_type_e storage_type, uid_t uid)
 {
        int lib_index;
        int ret = 0;
@@ -657,7 +657,7 @@ bool ms_delete_all_items(void **handle, const char *storage_id, ms_storage_type_
        return true;
 }
 
-bool ms_delete_invalid_items(void **handle, const char *storage_id, ms_storage_type_t storage_type, uid_t uid)
+bool ms_delete_invalid_items(void **handle, const char *storage_id, ms_user_storage_type_e storage_type, uid_t uid)
 {
        int lib_index;
        int ret;
index 2227ad3..4549d1d 100755 (executable)
@@ -366,7 +366,7 @@ bool ms_storage_mount_status(const char* start_path)
        return ret;
 }
 
-int ms_set_db_status(ms_db_status_type_t status, ms_storage_type_t storage_type)
+int ms_set_db_status(ms_db_status_type_t status, ms_user_storage_type_e storage_type)
 {
        int res = MS_MEDIA_ERR_NONE;
        int err = 0;
@@ -377,7 +377,7 @@ int ms_set_db_status(ms_db_status_type_t status, ms_storage_type_t storage_type)
                        MS_DBG_ERR("ms_config_set_int failed");
                }
 
-               if (storage_type == MS_STORAGE_EXTERNAL) {
+               if (storage_type == MS_USER_STORAGE_EXTERNAL) {
                        if (!ms_config_set_int(VCONFKEY_FILEMANAGER_MMC_STATUS, VCONFKEY_FILEMANAGER_MMC_LOADING)) {
                                res = MS_MEDIA_ERR_VCONF_SET_FAIL;
                                MS_DBG_ERR("ms_config_set_int failed");
@@ -389,7 +389,7 @@ int ms_set_db_status(ms_db_status_type_t status, ms_storage_type_t storage_type)
                        MS_DBG_ERR("ms_config_set_int failed");
                }
 
-               if (storage_type == MS_STORAGE_EXTERNAL) {
+               if (storage_type == MS_USER_STORAGE_EXTERNAL) {
                        if (!ms_config_set_int(VCONFKEY_FILEMANAGER_MMC_STATUS, VCONFKEY_FILEMANAGER_MMC_LOADED)) {
                                res = MS_MEDIA_ERR_VCONF_SET_FAIL;
                                MS_DBG_ERR("ms_config_set_int failed");
index e517ba6..ee875a3 100755 (executable)
@@ -61,7 +61,7 @@ GMutex extract_data_mutex;
 #define LAST_EVENT 1
 #define NORMAL_EVENT 0
 
-static int __msc_check_extract_stop_status(int scan_type, ms_storage_type_t storage_type, const char *start_path, int pid, bool is_end);
+static int __msc_check_extract_stop_status(int scan_type, ms_user_storage_type_e storage_type, const char *start_path, int pid, bool is_end);
 static int __msc_set_storage_extract_status(ms_storage_scan_status_e status);
 static int __msc_get_storage_extract_status(ms_storage_scan_status_e *status);
 static int __msc_resume_extract();
@@ -335,7 +335,7 @@ gboolean msc_storage_extract_thread(void *data)
        ms_comm_msg_s *extract_data = NULL;
        int ret = MS_MEDIA_ERR_NONE;
        void **handle = NULL;
-       ms_user_storage_type_e storage_type = MS_STORAGE_INTERNAL;
+       ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
        int scan_type;
        char *update_path = NULL;
        unsigned int io_err_count = 0;
@@ -387,7 +387,7 @@ gboolean msc_storage_extract_thread(void *data)
                        MS_DBG_ERR("ms_user_get_storage_type failed");
                        goto NEXT;
                }
-               if (storage_type == MS_STORAGE_EXTERNAL_USB) {
+               if (storage_type == MS_USER_STORAGE_EXTERNAL_USB) {
                        if (!ms_storage_mount_status(update_path)) {
                                MS_DBG_ERR("%s is unmounted", update_path);
                                ret = MS_MEDIA_ERR_USB_UNMOUNTED;
@@ -709,7 +709,7 @@ int msc_del_extract_blocked_path(const char* blocked_path)
        return MS_MEDIA_ERR_NONE;
 }
 
-static int __msc_check_extract_stop_status(int scan_type, ms_storage_type_t storage_type, const char *start_path, int pid, bool is_end)
+static int __msc_check_extract_stop_status(int scan_type, ms_user_storage_type_e storage_type, const char *start_path, int pid, bool is_end)
 {
        int ret = MS_MEDIA_ERR_NONE;
 
index 63a24f5..03e094f 100755 (executable)
@@ -91,15 +91,15 @@ struct linux_dirent {
 
 #define BUF_SIZE 1024
 
-static int __msc_check_stop_status(int scan_type, ms_storage_type_t storage_type, const char *start_path, int pid);
+static int __msc_check_stop_status(int scan_type, ms_user_storage_type_e storage_type, const char *start_path, int pid);
 static int __msc_db_update(void **handle, const char *storage_id, const ms_comm_msg_s * scan_data);
 static int __msc_make_file_list(char *file_path, GArray **path_array, uid_t uid);
 static int __msc_batch_insert(ms_msg_type_e current_msg, int pid, GArray *path_array, uid_t uid);
 static int __msc_pop_register_request(GArray *register_array, ms_comm_msg_s **register_data);
 static int __msc_clear_file_list(GArray *path_array);
 static void __msc_insert_register_request(GArray *register_array, ms_comm_msg_s *insert_data);
-static int __msc_dir_scan_for_folder(void **handle, const char *storage_id, const char*start_path, ms_storage_type_t storage_type, int scan_type, int pid, uid_t uid);
-static int __msc_dir_scan_for_storage(void **handle, const char *storage_id, const char*start_path, ms_storage_type_t storage_type, int scan_type, int pid, uid_t uid);
+static int __msc_dir_scan_for_folder(void **handle, const char *storage_id, const char*start_path, ms_user_storage_type_e storage_type, int scan_type, int pid, uid_t uid);
+static int __msc_dir_scan_for_storage(void **handle, const char *storage_id, const char*start_path, ms_user_storage_type_e storage_type, int scan_type, int pid, uid_t uid);
 static int __msc_get_null_scan_folder_list(void **handle, const char *stroage_id, char *path, GArray *dir_array);
 static int __msc_dir_scan_cb();
 static int __msc_check_scan_same_path(char *scan_path);
@@ -184,7 +184,7 @@ static int __msc_pause_scan()
        return MS_MEDIA_ERR_NONE;
 }
 
-static int __msc_check_stop_status(int scan_type, ms_storage_type_t storage_type, const char *start_path, int pid)
+static int __msc_check_stop_status(int scan_type, ms_user_storage_type_e storage_type, const char *start_path, int pid)
 {
        int ret = MS_MEDIA_ERR_NONE;
 
@@ -251,7 +251,7 @@ END:
        return ret;
 }
 
-static int __msc_dir_scan_for_folder(void **handle, const char *storage_id, const char*start_path, ms_storage_type_t storage_type, int scan_type, int pid, uid_t uid)
+static int __msc_dir_scan_for_folder(void **handle, const char *storage_id, const char*start_path, ms_user_storage_type_e storage_type, int scan_type, int pid, uid_t uid)
 {
        GArray *dir_array = NULL;
        int ret = MS_MEDIA_ERR_NONE;
@@ -543,7 +543,7 @@ static int __msc_dir_scan_for_folder(void **handle, const char *storage_id, cons
                        }
                        /*update modifiec type for the internal storage*/
                        if (scan_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) {
-                               if (storage_type == MS_STORAGE_INTERNAL)
+                               if (storage_type == MS_USER_STORAGE_INTERNAL)
                                        ms_update_folder_time(handle, INTERNAL_STORAGE_ID, current_path, uid);
                                else
                                        ms_update_folder_time(handle, storage_id, current_path, uid);
@@ -589,7 +589,7 @@ END_SCAN:
        return ret;
 }
 
-static int __msc_dir_scan_for_storage(void **handle, const char *storage_id, const char*start_path, ms_storage_type_t storage_type, int scan_type, int pid, uid_t uid)
+static int __msc_dir_scan_for_storage(void **handle, const char *storage_id, const char*start_path, ms_user_storage_type_e storage_type, int scan_type, int pid, uid_t uid)
 {
        GArray *dir_array = NULL;
        int ret = MS_MEDIA_ERR_NONE;
@@ -1084,7 +1084,7 @@ gboolean msc_directory_scan_thread(void *data)
        char *storage_id = NULL;
        bool modified = FALSE;
        int index = 0;
-       ms_user_storage_type_e storage_type = MS_STORAGE_INTERNAL;
+       ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
        ms_dir_scan_status_e scan_status = MS_DIR_SCAN_NONE;
        ms_noti_type_e noti_type = MS_ITEM_INSERT;
        char *folder_uuid = NULL;
index ee35710..a599f95 100755 (executable)
@@ -38,7 +38,7 @@ GMutex scan_req_mutex;
 
 static int __msc_clear_file_list(GArray *path_array);
 
-static int __msc_check_stop_status(ms_storage_type_t storage_type)
+static int __msc_check_stop_status(ms_user_storage_type_e storage_type)
 {
        if (power_off) {
                MS_DBG_ERR("Power off");
@@ -48,7 +48,7 @@ static int __msc_check_stop_status(ms_storage_type_t storage_type)
        }
 }
 
-static int __msc_dir_scan(void **handle, const char *storage_id, const char*start_path, ms_storage_type_t storage_type, bool check_exists, bool is_recursive, uid_t uid)
+static int __msc_dir_scan(void **handle, const char *storage_id, const char*start_path, ms_user_storage_type_e storage_type, bool check_exists, bool is_recursive, uid_t uid)
 {
        int ret = MS_MEDIA_ERR_NONE;
        GDir *dir = NULL;
@@ -735,7 +735,7 @@ _POWEROFF:
        return false;
 }
 
-static int __msc_dir_scan_meta_update(void **handle, const char*start_path, const char *storage_id, ms_storage_type_t storage_type, uid_t uid)
+static int __msc_dir_scan_meta_update(void **handle, const char*start_path, const char *storage_id, ms_user_storage_type_e storage_type, uid_t uid)
 {
        int ret = MS_MEDIA_ERR_NONE;
        GDir *dir = NULL;
@@ -832,7 +832,7 @@ gboolean msc_metadata_update(void *data)
        int ret = MS_MEDIA_ERR_NONE;
        int idx = 0;
        void **handle = NULL;
-       ms_storage_type_t storage_type = MS_STORAGE_INTERNAL;
+       ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
        GArray *storage_list = NULL;
        ms_stg_info_s *stg_info = NULL;
        char *usr_path = NULL;
index 9b62f38..2fbf817 100755 (executable)
@@ -105,7 +105,7 @@ int ms_usb_insert_handler(const char *mount_path, const char *mount_uuid)
 
                        MS_DBG_WARN("init storage data in DB");
                        /* update storage_id table set validity=0 first */
-                       ms_validaty_change_all_items(handle, mount_uuid, MS_STORAGE_EXTERNAL_USB, false, uid);
+                       ms_validaty_change_all_items(handle, mount_uuid, MS_USER_STORAGE_EXTERNAL_USB, false, uid);
                        /*update folder table set validity = 0*/
                        ms_set_folder_validity(handle, mount_uuid, storage_path, MS_INVALID, TRUE, uid);
                        /* update folder table set scan_status=0 first */
@@ -454,7 +454,7 @@ static void __ms_usb_add_event(const char *mount_path)
                }
 
                /* update storage_id table set validity=0 first */
-               ms_validaty_change_all_items(handle, storage_id, MS_STORAGE_EXTERNAL_USB, false, uid);
+               ms_validaty_change_all_items(handle, storage_id, MS_USER_STORAGE_EXTERNAL_USB, false, uid);
                /* update folder table set validity=0 first */
                ms_set_folder_validity(handle, storage_id, mount_path, MS_INVALID, TRUE, uid);
                /* update folder table set scan_status=0 first */
@@ -695,7 +695,7 @@ int ms_check_mounted_storage(uid_t uid)
 
                                                ms_set_storage_validity(handle, storage_id, 1, uid);
                                                /* update storage_id table set validity=0 first */
-                                               ms_validaty_change_all_items(handle, storage_id, MS_STORAGE_EXTERNAL_USB, false, uid);
+                                               ms_validaty_change_all_items(handle, storage_id, MS_USER_STORAGE_EXTERNAL_USB, false, uid);
                                                ms_set_folder_validity(handle, storage_id, mounted_path, MS_INVALID, TRUE, uid);
                                                /* update folder table set scan_status=0 first */
                                                ms_set_folder_scan_status(handle, storage_id, NULL, MS_DIR_SCAN_NONE, uid);
index af2d2b3..7c8f064 100755 (executable)
@@ -205,7 +205,7 @@ void _ms_datadisc_vconf_cb(void *data)
 
                                MS_DBG_WARN("init storage data in DB");
                                /* update storage_id table set validity=0 first */
-                               ms_validaty_change_all_items(handle, DATADISC_STORAGE_ID, MS_STORAGE_EXTERNAL_USB, false, uid);
+                               ms_validaty_change_all_items(handle, DATADISC_STORAGE_ID, MS_USER_STORAGE_EXTERNAL_USB, false, uid);
                                /*update folder table set validity = 0*/
                                ms_set_folder_validity(handle, DATADISC_STORAGE_ID, mnt_path, MS_INVALID, TRUE, uid);
                                /* update folder table set scan_status=0 first */
@@ -225,7 +225,7 @@ void _ms_datadisc_vconf_cb(void *data)
                        MS_DBG_WARN("[DISC REMOVED]");
                        ms_set_storage_validity(handle, DATADISC_STORAGE_ID, 0, uid);
                        ms_set_folder_validity(handle, DATADISC_STORAGE_ID, mnt_path, false, true, uid);
-                       ms_validaty_change_all_items(handle, DATADISC_STORAGE_ID, MS_STORAGE_EXTERNAL_USB, false, uid);
+                       ms_validaty_change_all_items(handle, DATADISC_STORAGE_ID, MS_USER_STORAGE_EXTERNAL_USB, false, uid);
                }
 
                ms_disconnect_db(&handle);
@@ -720,7 +720,7 @@ static int __ms_check_disc_status(void)
 
                                MS_DBG_WARN("init storage data in DB");
                                /* update storage_id table set validity=0 first */
-                               ms_validaty_change_all_items(handle, DATADISC_STORAGE_ID, MS_STORAGE_EXTERNAL_USB, false, uid);
+                               ms_validaty_change_all_items(handle, DATADISC_STORAGE_ID, MS_USER_STORAGE_EXTERNAL_USB, false, uid);
                                /*update folder table set validity = 0*/
                                ms_set_folder_validity(handle, DATADISC_STORAGE_ID, mnt_path, MS_INVALID, TRUE, uid);
                                /* update folder table set scan_status=0 first */
index 8267df0..9642b35 100755 (executable)
@@ -530,7 +530,7 @@ int ms_send_storage_scan_request_senior_mode(void **handle)
                        if (validity == 0) {
                                ms_set_storage_validity(handle, storage_id, 1, uid);
                                /* update storage_id table set validity=0 first */
-                               ms_validaty_change_all_items(handle, storage_id, MS_STORAGE_EXTERNAL_USB, false, uid);
+                               ms_validaty_change_all_items(handle, storage_id, MS_USER_STORAGE_EXTERNAL_USB, false, uid);
                                ms_set_folder_validity(handle, storage_id, storage_path, MS_INVALID, TRUE, uid);
                                /* update folder table set scan_status=0 first */
                                ms_set_folder_scan_status(handle, storage_id, NULL, MS_DIR_SCAN_NONE, uid);