From: hj kim Date: Tue, 1 Sep 2020 06:57:21 +0000 (+0900) Subject: Change parameter type (int -> ms_msg_type_e) X-Git-Tag: submit/tizen/20200903.010252~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=71c9e41ac875f3c279b51a56ca2766d16de48981;p=platform%2Fcore%2Fmultimedia%2Fmedia-server.git Change parameter type (int -> ms_msg_type_e) Change-Id: I810279e05c6e1afd1f36c721497360a0f3ae64ce --- diff --git a/src/common/include/media-common-db-svc.h b/src/common/include/media-common-db-svc.h index 144ec580..9cd7c861 100755 --- a/src/common/include/media-common-db-svc.h +++ b/src/common/include/media-common-db-svc.h @@ -70,7 +70,7 @@ int ms_update_folder_time(sqlite3 *handle, const char *storage_id, char *folder_ int ms_set_storage_scan_status(sqlite3 *handle, char *storage_id, media_scan_status_e scan_status, uid_t uid); int ms_genarate_uuid(char **uuid); int ms_scan_item_batch(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid); -int ms_get_and_extract_media(sqlite3 *handle, const char *storage_id, int scan_type, const char *path); +int ms_get_and_extract_media(sqlite3 *handle, const char *storage_id, ms_msg_type_e msg_type, const char *path); int ms_delete_invalid_items_in_folder(sqlite3 *handle, const char *storage_id, const char *path, bool is_recursive, uid_t uid); int ms_delete_invalid_folder_by_path(sqlite3 *handle, const char *storage_id, const char *folder_path, uid_t uid); int ms_get_folder_scan_status(sqlite3 *handle, const char *storage_id, const char *path, int *scan_status); diff --git a/src/common/media-common-db-svc.c b/src/common/media-common-db-svc.c index f261dd64..5b9b3b4f 100644 --- a/src/common/media-common-db-svc.c +++ b/src/common/media-common-db-svc.c @@ -348,11 +348,11 @@ int ms_scan_item_batch(sqlite3 *handle, const char *storage_id, const char *path return ret; } -int ms_get_and_extract_media(sqlite3 *handle, const char *storage_id, int scan_type, const char *path) +int ms_get_and_extract_media(sqlite3 *handle, const char *storage_id, ms_msg_type_e msg_type, const char *path) { int ret = MS_MEDIA_ERR_NONE; - ret = ((GET_AND_EXTRACT_MEDIA)func_array[eGET_AND_EXTRACT_MEDIA])(handle, storage_id, scan_type, path); + ret = ((GET_AND_EXTRACT_MEDIA)func_array[eGET_AND_EXTRACT_MEDIA])(handle, storage_id, msg_type, path); if (ret != MS_MEDIA_ERR_NONE && ret != MS_MEDIA_ERR_DB_NO_RECORD) MS_DBG_ERR("GET_AND_EXTRACT_MEDIA failed [%d]", ret); diff --git a/src/scanner-v2/include/media-scanner-db-manage-v2.h b/src/scanner-v2/include/media-scanner-db-manage-v2.h index da03764b..d9da0321 100755 --- a/src/scanner-v2/include/media-scanner-db-manage-v2.h +++ b/src/scanner-v2/include/media-scanner-db-manage-v2.h @@ -24,7 +24,7 @@ #include "media-common-types.h" -int msc_check_db_size(uid_t uid, int scan_type); +int msc_check_db_size(uid_t uid, ms_msg_type_e msg_type); int msc_cleanup_invalid_values(uid_t uid); #endif diff --git a/src/scanner-v2/include/media-scanner-extract-v2.h b/src/scanner-v2/include/media-scanner-extract-v2.h index 19f13823..b409236c 100755 --- a/src/scanner-v2/include/media-scanner-extract-v2.h +++ b/src/scanner-v2/include/media-scanner-extract-v2.h @@ -37,7 +37,7 @@ void msc_init_extract_thread(void); void msc_deinit_extract_thread(void); gpointer msc_folder_extract_thread(gpointer data); gpointer msc_storage_extract_thread(gpointer data); -void msc_insert_exactor_request(int message_type, bool ins_status, const char *storage_id, const char *path, int pid, uid_t uid, ms_noti_type_e noti_type); +void msc_insert_exactor_request(ms_msg_type_e msg_type, bool ins_status, const char *storage_id, const char *path, int pid, uid_t uid, ms_noti_type_e noti_type); int msc_remove_extract_request(const ms_comm_msg_s *recv_msg); int msc_set_cancel_extract_item(const char* path, int pid); void msc_set_extract_blocked_path(const char *blocked_path); diff --git a/src/scanner-v2/media-scanner-db-manage-v2.c b/src/scanner-v2/media-scanner-db-manage-v2.c index 40b51699..074ec452 100755 --- a/src/scanner-v2/media-scanner-db-manage-v2.c +++ b/src/scanner-v2/media-scanner-db-manage-v2.c @@ -26,7 +26,7 @@ #include "media-scanner-dbg-v2.h" #include "media-scanner-db-manage-v2.h" -int msc_check_db_size(uid_t uid, int scan_type) +int msc_check_db_size(uid_t uid, ms_msg_type_e msg_type) { double db_size = 0.0; double free_space = 0.0; @@ -34,12 +34,12 @@ int msc_check_db_size(uid_t uid, int scan_type) ms_check_size_mediadb(uid, &db_size); - if (scan_type == MS_MSG_STORAGE_ALL || scan_type == MS_MSG_STORAGE_PARTIAL) { + if (msg_type == MS_MSG_STORAGE_ALL || msg_type == MS_MSG_STORAGE_PARTIAL) { if (db_size >= MEDIA_DB_SIZE_LIMIT_1) { MS_DBG_ERR("DB SIZE [%lf] reach the MEDIA_DB_SIZE_LIMIT_1[%lf]", db_size, MEDIA_DB_SIZE_LIMIT_1); return MS_MEDIA_ERR_DB_LIMIT_1; } - } else if (scan_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE || scan_type == MS_MSG_DIRECTORY_SCANNING) { + } else if (msg_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE || msg_type == MS_MSG_DIRECTORY_SCANNING) { if (db_size >= MEDIA_DB_SIZE_LIMIT_2) { MS_DBG_ERR("DB SIZE [%lf] reach the MEDIA_DB_SIZE_LIMIT_2[%lf]", db_size, MEDIA_DB_SIZE_LIMIT_2); diff --git a/src/scanner-v2/media-scanner-extract-v2.c b/src/scanner-v2/media-scanner-extract-v2.c index f4af287e..284fc40f 100644 --- a/src/scanner-v2/media-scanner-extract-v2.c +++ b/src/scanner-v2/media-scanner-extract-v2.c @@ -48,7 +48,7 @@ static GCond extract_data_cond; static GMutex extract_data_mutex; #define VCONFKEY_PRIVATE_EXTRACTSTATUS "db/private/extractstatus" -static int __msc_check_extract_stop_status(int scan_type, const char *start_path, int pid); +static int __msc_check_extract_stop_status(ms_msg_type_e msg_type, const char *start_path, int pid); static void __msc_set_storage_extract_status(ms_storage_scan_status_e status); static void __msc_get_storage_extract_status(ms_storage_scan_status_e *status); static void __msc_resume_extract(void); @@ -87,20 +87,20 @@ void msc_deinit_extract_thread(void) g_cond_clear(&extract_data_cond); } -static int __msc_folder_bulk_extract(sqlite3 *handle, const char *storage_id, const char *path, int scan_type, int pid) +static int __msc_folder_bulk_extract(sqlite3 *handle, const char *storage_id, const char *path, ms_msg_type_e msg_type, int pid) { int ret = MS_MEDIA_ERR_NONE; MS_DBG_FENTER(); while (1) { - ret = __msc_check_extract_stop_status(scan_type, path, pid); + ret = __msc_check_extract_stop_status(msg_type, path, pid); if (ret == MS_MEDIA_ERR_SCANNER_FORCE_STOP) { MS_DBG_ERR("__msc_folder_bulk_extract MS_MEDIA_ERR_SCANNER_FORCE_STOP"); break; } - ret = ms_get_and_extract_media(handle, storage_id, scan_type, path); + ret = ms_get_and_extract_media(handle, storage_id, msg_type, path); if (ret != MS_MEDIA_ERR_NONE) { if (ret == MS_MEDIA_ERR_DB_NO_RECORD) MS_DBG("Extract done"); @@ -355,11 +355,11 @@ _POWEROFF: return NULL; } -void msc_insert_exactor_request(int message_type, bool ins_status, const char *storage_id, const char *path, int pid, uid_t uid, ms_noti_type_e noti_type) +void msc_insert_exactor_request(ms_msg_type_e msg_type, bool ins_status, const char *storage_id, const char *path, int pid, uid_t uid, ms_noti_type_e noti_type) { ms_comm_msg_s *extract_data = g_new0(ms_comm_msg_s, 1); - extract_data->msg_type = message_type; + extract_data->msg_type = msg_type; extract_data->pid = pid; extract_data->uid = uid; extract_data->result = ins_status; @@ -367,14 +367,15 @@ void msc_insert_exactor_request(int message_type, bool ins_status, const char *s SAFE_STRLCPY(extract_data->msg, path, sizeof(extract_data->msg)); SAFE_STRLCPY(extract_data->storage_id, storage_id, sizeof(extract_data->storage_id)); - if (message_type == MS_MSG_STORAGE_ALL || message_type == MS_MSG_STORAGE_PARTIAL || message_type == MS_MSG_STORAGE_INVALID) { + MS_DBG("msg_type [%d] ins_status[%d]", msg_type, ins_status); + if (msg_type == MS_MSG_STORAGE_ALL || msg_type == MS_MSG_STORAGE_PARTIAL || msg_type == MS_MSG_STORAGE_INVALID) { g_async_queue_push(storage_extract_queue, extract_data); - MS_DBG("insert to storage exactor queue. msg_type [%d]", ins_status); - } else if (message_type == MS_MSG_DIRECTORY_SCANNING || message_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) { + MS_DBG("insert to storage exactor queue"); + } else if (msg_type == MS_MSG_DIRECTORY_SCANNING || msg_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) { g_async_queue_push(folder_extract_queue, extract_data); - MS_DBG("insert to dir exactor queue. msg_type [%d]", ins_status); + MS_DBG("insert to dir exactor queue"); } else { - MS_DBG_ERR("try to insert to exactor scan with msg_type [%d]", message_type); + MS_DBG_ERR("wrong msg_type"); g_free(extract_data); } } @@ -547,14 +548,14 @@ static void __msc_del_extract_blocked_path(const char* blocked_path) MS_DBG_FLEAVE(); } -static int __msc_check_extract_stop_status(int scan_type, const char *start_path, int pid) +static int __msc_check_extract_stop_status(ms_msg_type_e msg_type, const char *start_path, int pid) { int ret = MS_MEDIA_ERR_NONE; /*check poweroff status*/ MS_DBG_RETV_IF(_msc_is_power_off(), MS_MEDIA_ERR_SCANNER_FORCE_STOP); - if (scan_type == MS_MSG_DIRECTORY_SCANNING || scan_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) { + if (msg_type == MS_MSG_DIRECTORY_SCANNING || msg_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) { g_mutex_lock(&extract_req_mutex); /* check cancel path */ //MS_DBG_ERR("__msc_check_extract_stop_status..."); @@ -581,7 +582,7 @@ static int __msc_check_extract_stop_status(int scan_type, const char *start_path g_mutex_unlock(&extract_req_mutex); } - if (scan_type == MS_MSG_STORAGE_ALL || scan_type == MS_MSG_STORAGE_PARTIAL) { + if (msg_type == MS_MSG_STORAGE_ALL || msg_type == MS_MSG_STORAGE_PARTIAL) { if (g_directory_extract_processing == true) { MS_DBG_WARN("Now directory extract is start. So, storage extract is stopped."); __msc_pause_extract(); diff --git a/src/scanner-v2/media-scanner-scan-v2.c b/src/scanner-v2/media-scanner-scan-v2.c index 4c1c1241..65a71e4c 100644 --- a/src/scanner-v2/media-scanner-scan-v2.c +++ b/src/scanner-v2/media-scanner-scan-v2.c @@ -63,7 +63,7 @@ static char *g_storage_scan_path; static char* g_dir_scan_path; static bool is_scanner_paused = false; -static int __msc_check_stop_status(int scan_type, const char *start_path, int pid); +static int __msc_check_stop_status(ms_msg_type_e msg_type, const char *start_path, int pid); static int __msc_get_null_scan_folder_list(sqlite3 *handle, const char *stroage_id, char *path, GPtrArray *dir_array); static int __msc_check_scan_same_path(char *scan_path); static void __msc_set_storage_scan_cur_path(char *scan_path); @@ -125,7 +125,7 @@ static void __msc_pause_scan(void) g_mutex_unlock(&data_mutex2); } -static int __msc_check_stop_status(int scan_type, const char *start_path, int pid) +static int __msc_check_stop_status(ms_msg_type_e msg_type, const char *start_path, int pid) { int ret = MS_MEDIA_ERR_NONE; @@ -133,7 +133,7 @@ static int __msc_check_stop_status(int scan_type, const char *start_path, int pi if (_msc_is_power_off()) return MS_MEDIA_ERR_SCANNER_FORCE_STOP; - if (scan_type == MS_MSG_DIRECTORY_SCANNING || scan_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) { + if (msg_type == MS_MSG_DIRECTORY_SCANNING || msg_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) { g_mutex_lock(&scan_req_mutex2); /* check cancel path */ //MS_DBG_ERR("__msc_check_stop_status..."); @@ -160,7 +160,7 @@ static int __msc_check_stop_status(int scan_type, const char *start_path, int pi g_mutex_unlock(&scan_req_mutex2); } - if (scan_type == MS_MSG_STORAGE_ALL || scan_type == MS_MSG_STORAGE_PARTIAL) { + if (msg_type == MS_MSG_STORAGE_ALL || msg_type == MS_MSG_STORAGE_PARTIAL) { g_mutex_lock(&blocked_mutex2); /* check cancel path */ if (g_blocked_path2 != NULL) { @@ -180,14 +180,14 @@ static int __msc_check_stop_status(int scan_type, const char *start_path, int pi return ret; } -static int __msc_dir_scan_for_folder(sqlite3 *handle, const char *storage_id, char *start_path, int scan_type, int pid, uid_t uid) +static int __msc_dir_scan_for_folder(sqlite3 *handle, const char *storage_id, char *start_path, ms_msg_type_e msg_type, int pid, uid_t uid) { GPtrArray *dir_array = NULL; int ret = MS_MEDIA_ERR_NONE; char *new_path = NULL; char *current_path = NULL; char path[MS_FILE_PATH_LEN_MAX] = {0, }; - bool is_recursive = (scan_type == MS_MSG_DIRECTORY_SCANNING); + bool is_recursive = (msg_type == MS_MSG_DIRECTORY_SCANNING); char *new_start_path = NULL; int scan_count = 0; @@ -211,11 +211,11 @@ static int __msc_dir_scan_for_folder(sqlite3 *handle, const char *storage_id, ch MS_DBG_SWARN("ms_insert_folder insert path[%s]", new_start_path); } else { if (ms_set_folder_validity(handle, storage_id, new_start_path, MS_INVALID, is_recursive, uid) != MS_MEDIA_ERR_NONE) - MS_DBG_ERR("set_folder_validity failed [%d] ", scan_type); + MS_DBG_ERR("set_folder_validity failed [%d] ", msg_type); } while (dir_array->len != 0) { - ret = __msc_check_stop_status(scan_type, new_start_path, pid); + ret = __msc_check_stop_status(msg_type, new_start_path, pid); if (ret != MS_MEDIA_ERR_NONE) { if (is_recursive) ms_change_validity_item_batch(handle, storage_id, new_start_path, 1, 2, uid); @@ -242,7 +242,7 @@ static int __msc_dir_scan_for_folder(sqlite3 *handle, const char *storage_id, ch continue; } - ret = msc_check_db_size(uid, scan_type); + ret = msc_check_db_size(uid, msg_type); if (ret != MS_MEDIA_ERR_NONE) { if (ret == MS_MEDIA_ERR_DB_FULL_FAIL) ret = MS_MEDIA_ERR_NONE; @@ -272,7 +272,7 @@ static int __msc_dir_scan_for_folder(sqlite3 *handle, const char *storage_id, ch usleep(SCAN_SLEEP_TIME); } - ret = __msc_check_stop_status(scan_type, new_start_path, pid); + ret = __msc_check_stop_status(msg_type, new_start_path, pid); if (ret != MS_MEDIA_ERR_NONE) { if (is_recursive) ms_change_validity_item_batch(handle, storage_id, new_start_path, 1, 2, uid); @@ -280,7 +280,7 @@ static int __msc_dir_scan_for_folder(sqlite3 *handle, const char *storage_id, ch goto STOP_SCAN; } - ret = msc_check_db_size(uid, scan_type); + ret = msc_check_db_size(uid, msg_type); if (ret != MS_MEDIA_ERR_NONE) { if (ret == MS_MEDIA_ERR_DB_FULL_FAIL) ret = MS_MEDIA_ERR_NONE; @@ -316,9 +316,9 @@ static int __msc_dir_scan_for_folder(sqlite3 *handle, const char *storage_id, ch if (scan_count >= MAX_SCAN_COUNT) { scan_count = 0; - ret = __msc_check_stop_status(scan_type, new_start_path, pid); + ret = __msc_check_stop_status(msg_type, new_start_path, pid); if (ret == MS_MEDIA_ERR_NONE) { - msc_insert_exactor_request(scan_type, false, storage_id, current_path, pid, uid, MS_ITEM_UPDATE); + msc_insert_exactor_request(msg_type, false, storage_id, current_path, pid, uid, MS_ITEM_UPDATE); } else { if (is_recursive) ms_change_validity_item_batch(handle, storage_id, new_start_path, 1, 2, uid); @@ -327,7 +327,7 @@ static int __msc_dir_scan_for_folder(sqlite3 *handle, const char *storage_id, ch } } } else { - if (scan_type == MS_MSG_DIRECTORY_SCANNING) { + if (msg_type == MS_MSG_DIRECTORY_SCANNING) { new_path = g_strdup(path); g_ptr_array_add(dir_array, new_path); @@ -342,7 +342,7 @@ static int __msc_dir_scan_for_folder(sqlite3 *handle, const char *storage_id, ch } } } - if (scan_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) + if (msg_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) ms_update_folder_time(handle, storage_id, current_path, uid); ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_DONE, uid); @@ -384,7 +384,7 @@ END_SCAN: return ret; } -static int __msc_dir_scan_for_storage(sqlite3 *handle, const char *storage_id, char *start_path, int scan_type, int pid, uid_t uid) +static int __msc_dir_scan_for_storage(sqlite3 *handle, const char *storage_id, char *start_path, ms_msg_type_e msg_type, int pid, uid_t uid) { GPtrArray *dir_array = NULL; int ret = MS_MEDIA_ERR_NONE; @@ -414,12 +414,12 @@ static int __msc_dir_scan_for_storage(sqlite3 *handle, const char *storage_id, c if (ms_insert_folder(handle, storage_id, new_start_path, uid) != MS_MEDIA_ERR_NONE) MS_DBG_ERR("insert folder failed"); - scan_function = (scan_type == MS_MSG_STORAGE_ALL) ? ms_scan_item_batch : ms_validate_item; + scan_function = (msg_type == MS_MSG_STORAGE_ALL) ? ms_scan_item_batch : ms_validate_item; ms_register_end(uid); while (dir_array->len != 0) { - ret = __msc_check_stop_status(scan_type, new_start_path, pid); + ret = __msc_check_stop_status(msg_type, new_start_path, pid); if (ret != MS_MEDIA_ERR_NONE) goto STOP_SCAN; @@ -441,7 +441,7 @@ static int __msc_dir_scan_for_storage(sqlite3 *handle, const char *storage_id, c continue; } - ret = msc_check_db_size(uid, scan_type); + ret = msc_check_db_size(uid, msg_type); if (ret != MS_MEDIA_ERR_NONE) goto STOP_SCAN; @@ -489,11 +489,11 @@ static int __msc_dir_scan_for_storage(sqlite3 *handle, const char *storage_id, c usleep(SCAN_SLEEP_TIME); } - ret = __msc_check_stop_status(scan_type, new_start_path, pid); + ret = __msc_check_stop_status(msg_type, new_start_path, pid); if (ret != MS_MEDIA_ERR_NONE) goto STOP_SCAN; - ret = msc_check_db_size(uid, scan_type); + ret = msc_check_db_size(uid, msg_type); if (ret != MS_MEDIA_ERR_NONE) goto STOP_SCAN; @@ -514,13 +514,13 @@ static int __msc_dir_scan_for_storage(sqlite3 *handle, const char *storage_id, c ret = scan_function(handle, storage_id, path, uid); if (ret != MS_MEDIA_ERR_NONE) { - MS_DBG_ERR("failed to update db : %d", scan_type); + MS_DBG_ERR("failed to update db : %d", msg_type); continue; } else { ++scan_count; if (scan_count >= MAX_SCAN_COUNT) { scan_count = 0; - msc_insert_exactor_request(scan_type, false, storage_id, current_path, 0, uid, MS_ITEM_UPDATE); + msc_insert_exactor_request(msg_type, false, storage_id, current_path, 0, uid, MS_ITEM_UPDATE); } } } else { diff --git a/src/scanner/media-scanner-scan.c b/src/scanner/media-scanner-scan.c index 37f65e4c..5e9ecfbd 100644 --- a/src/scanner/media-scanner-scan.c +++ b/src/scanner/media-scanner-scan.c @@ -142,16 +142,16 @@ static int __msc_dir_scan(sqlite3 *handle, const char *storage_id, char *start_p static int __msc_db_update(sqlite3 *handle, const char *storage_id, const ms_comm_msg_s * scan_data) { - int scan_type; + ms_msg_type_e msg_type; int err = MS_MEDIA_ERR_NONE; char *start_path = NULL; - scan_type = scan_data->msg_type; + msg_type = scan_data->msg_type; start_path = g_strdup(scan_data->msg); - if (scan_type != MS_MSG_STORAGE_INVALID) { + if (msg_type != MS_MSG_STORAGE_INVALID) { MS_DBG_INFO("INSERT"); - if (scan_type == MS_MSG_STORAGE_ALL) + if (msg_type == MS_MSG_STORAGE_ALL) err = __msc_dir_scan(handle, storage_id, start_path, false, true, scan_data->uid); else err = __msc_dir_scan(handle, storage_id, start_path, true, true, scan_data->uid);