From 2aea54c58fae5887ac081ff0706d44c45428a5bf Mon Sep 17 00:00:00 2001 From: Minje Ahn Date: Thu, 29 Nov 2018 16:21:16 +0900 Subject: [PATCH] Remove unused parameter Delete unused DB handle Change-Id: I1c4c2db2239216439beaf2df1ea259a0823655a1 Signed-off-by: Minje Ahn --- src/common/include/media-common-db-svc.h | 60 +++++++++--------- src/common/include/media-common-external-storage.h | 2 +- src/common/media-common-db-svc.c | 72 +++++++++++----------- src/common/media-common-external-storage.c | 4 +- src/common/media-common-system.c | 3 +- src/mediadb-update.c | 43 ++++++------- src/scanner-v2/media-scanner-scan-v2.c | 48 +++++++-------- src/scanner/media-scanner-scan.c | 38 ++++++------ src/server/media-server-db-manage.c | 2 +- src/server/media-server-device-block.c | 8 +-- src/server/media-server-main.c | 2 +- 11 files changed, 139 insertions(+), 143 deletions(-) diff --git a/src/common/include/media-common-db-svc.h b/src/common/include/media-common-db-svc.h index 7a08f24..83a7601 100755 --- a/src/common/include/media-common-db-svc.h +++ b/src/common/include/media-common-db-svc.h @@ -55,17 +55,17 @@ typedef enum { typedef int (*CONNECT)(void**, uid_t); typedef int (*DISCONNECT)(void*); typedef int (*CLEANUP_DB)(void*, uid_t); -typedef int (*INSERT_ITEM_BEGIN)(void*, int, int, int); -typedef int (*INSERT_ITEM_END)(void*, uid_t); -typedef int (*SET_ITEM_VALIDITY_BEGIN)(void*, int); -typedef int (*SET_ITEM_VALIDITY_END)(void*, uid_t); +typedef int (*INSERT_ITEM_BEGIN)(int, int, int); +typedef int (*INSERT_ITEM_END)(uid_t); +typedef int (*SET_ITEM_VALIDITY_BEGIN)(int); +typedef int (*SET_ITEM_VALIDITY_END)(uid_t); typedef int (*SEND_DIR_UPDATE_NOTI)(void *, const char *, const char *, const char *, int, int); typedef int (*CHECK_ITEM_EXIST)(void*, const char *, const char *, bool *); typedef int (*INSERT_ITEM)(void *, const char *, const char *, int, uid_t); typedef int (*SET_ALL_STORAGE_ITEMS_VALIDITY)(void *, const char *, int, int, uid_t); typedef int (*SET_FOLDER_ITEM_VALIDITY)(void *, const char *, const char *, int, int, uid_t); -typedef int (*SET_ITEM_VALIDITY)(void *, const char *, const char *, int, int, uid_t); +typedef int (*SET_ITEM_VALIDITY)(const char *, const char *, int, int, uid_t); typedef int (*DELETE_ITEM)(void *, const char *, const char *, uid_t); typedef int (*DELETE_ALL_INVALID_ITMES_IN_STORAGE)(void *, const char *, int, uid_t); typedef int (*DELETE_ALL_INVALID_ITEMS_IN_FOLDER)(void *, const char *, const char *, bool, uid_t); @@ -74,10 +74,10 @@ typedef int (*GET_STORAGE_ID)(void *, const char *, char *, uid_t uid); typedef int (*SET_STORAGE_SCAN_STATUS)(void *, const char *, int, uid_t); typedef int (*GET_STORAGE_LIST)(void *, char ***, char ***, int *); typedef int (*INSERT_FOLDER)(void *, const char *, const char *, int, uid_t); -typedef int (*DELETE_INVALID_FOLDER)(void *, const char *, int, uid_t); +typedef int (*DELETE_INVALID_FOLDER)(const char *, int, uid_t); typedef int (*SET_FOLDER_VALIDITY)(void *, const char *, const char *, int, bool, uid_t); -typedef int (*INSERT_FOLDER_BEGIN)(void *, int); -typedef int (*INSERT_FOLDER_END)(void *, uid_t); +typedef int (*INSERT_FOLDER_BEGIN)(int); +typedef int (*INSERT_FOLDER_END)(uid_t); typedef int (*INSERT_ITEM_SCAN)(void *, const char *, const char *, int, uid_t); typedef int (*GET_FOLDER_SCAN_STATUS)(void *, const char *, const char *, int *); typedef int (*SET_FOLDER_SCAN_STATUS)(void *, const char *, const char *, int, uid_t); @@ -86,16 +86,16 @@ typedef int (*GET_NULL_SCAN_FOLDER_LIST)(void *, const char *, const char *, cha typedef int (*CHANGE_VALIDITY_ITEM_BATCH)(void *, const char *, const char *, int, int, uid_t); typedef int (*CHECK_DB)(void*, uid_t); -typedef int (*GET_UUID)(void *, char **); +typedef int (*GET_UUID)(char **); typedef int (*CHECK_STORAGE)(void *, const char *, char **, int *, uid_t); typedef int (*INSERT_STORAGE)(void *, const char *, int, const char *, uid_t); typedef int (*UPDATE_STORAGE)(void *, const char *, const char *, uid_t); typedef int (*SET_STORAGE_VALIDITY)(void *, const char *, int, uid_t uid); -typedef int (*SET_ALL_STORAGE_VALIDITY)(void *, int, uid_t); +typedef int (*SET_ALL_STORAGE_VALIDITY)(int, uid_t); -typedef int (*UPDATE_ITEM_META)(void *, const char *, const char *, int, uid_t); -typedef int (*UPDATE_ITEM_BEGIN)(void *, int); -typedef int (*UPDATE_ITEM_END)(void *, uid_t); +typedef int (*UPDATE_ITEM_META)(const char *, const char *, int, uid_t); +typedef int (*UPDATE_ITEM_BEGIN)(int); +typedef int (*UPDATE_ITEM_END)(uid_t); typedef int (*DELETE_INVALID_FOLDER_BY_PATH)(void *, const char *, const char *, uid_t); typedef int (*CHECK_FOLDER_EXIST)(void*, const char*, const char*); @@ -103,7 +103,7 @@ typedef int (*GET_FOLDER_ID)(void *, const char *, const char *, char *); typedef int (*GET_EXTRACT_LIST)(void*, const char*, int, int, const char*, uid_t, void*); typedef int (*UPDATE_ONE_EXTRACT_ITEM)(void*, const char*, int, void*); typedef int (*QUERY_DO_UPDATE_LIST)(void*); -typedef int (*GET_MEDIA_TYPE)(void *, const char *, int *); +typedef int (*GET_MEDIA_TYPE)(const char *, int *); int ms_load_functions(void); void ms_unload_functions(void); @@ -122,7 +122,7 @@ int ms_get_storage_id(void **handle, const char *path, char *storage_id, uid_t u int ms_set_storage_scan_status(void **handle, char *storage_id, media_scan_status_e scan_status, uid_t uid); int ms_get_storage_list(void **handle, GArray **storage_array); int ms_insert_folder(void **handle, const char *storage_id, const char *path, uid_t uid); -int ms_delete_invalid_folder(void **handle, const char *storage_id, int storage_type, uid_t uid); +int ms_delete_invalid_folder(const char *storage_id, int storage_type, uid_t uid); int ms_set_folder_validity(void **handle, const char *storage_id, const char *start_path, int validity, bool is_recursive, uid_t uid); int ms_scan_item_batch(void **handle, const char *storage_id, const char *path, uid_t uid); int ms_scan_validate_item(void **handle, const char *storage_id, const char *path, uid_t uid); @@ -133,34 +133,34 @@ int ms_get_null_scan_folder_list(void **handle, const char *stroage_id, const ch int ms_change_validity_item_batch(void **handle, const char *storage_id, const char *path, int des_validity, int src_validity, uid_t uid); int ms_check_db_upgrade(void **handle, uid_t uid); -int ms_genarate_uuid(void **handle, char **uuid); +int ms_genarate_uuid(char **uuid); int ms_check_storage(void **handle, const char *storage_id, char **storage_path, int *validity, uid_t uid); int ms_insert_storage(void **handle, const char *storage_id, const char *storage_path, uid_t uid); int ms_update_storage(void **handle, const char *storage_id, const char *storage_path, uid_t uid); int ms_set_storage_validity(void **handle, const char *storage_id, int validity, uid_t uid); -int ms_set_all_storage_validity(void **handle, int validity, uid_t uid); -int ms_update_meta_batch(void **handle, const char *path, const char *storage_id, uid_t uid); +int ms_set_all_storage_validity(int validity, uid_t uid); +int ms_update_meta_batch(const char *path, const char *storage_id, uid_t uid); int ms_delete_invalid_folder_by_path(void **handle, const char *storage_id, const char *folder_path, uid_t uid); int ms_check_folder_exist(void **handle, const char *storage_id, const char *folder_path); int ms_get_folder_id(void **handle, const char *storage_id, const char *path, char **folder_id); -int ms_get_media_type(void **handle, const char *path, int *media_type); -bool ms_check_support_media_type(void **handle, const char *path); +int ms_get_media_type(const char *path, int *media_type); +bool ms_check_support_media_type(const char *path); /* FOR BULK COMMIT */ -void ms_register_start(void **handle, ms_noti_switch_e noti_status, int pid); -void ms_register_end(void **handle, uid_t uid); -void ms_validate_start(void **handle); -void ms_validate_end(void **handle, uid_t uid); -void ms_insert_folder_start(void **handle); -void ms_insert_folder_end(void **handle, uid_t uid); -void ms_update_start(void **handle); -void ms_update_end(void **handle, uid_t uid); +void ms_register_start(ms_noti_switch_e noti_status, int pid); +void ms_register_end(uid_t uid); +void ms_validate_start(); +void ms_validate_end(uid_t uid); +void ms_insert_folder_start(); +void ms_insert_folder_end(uid_t uid); +void ms_update_start(); +void ms_update_end(uid_t uid); int ms_get_extract_list(void** handle, const char* storage_id, int storage_type, int scan_type, const char* path, uid_t uid, void* array); int ms_update_one_extract_item(void** handle, const char* storage_id, int storage_type, void* data); int ms_query_do_update_list(void** handle); -void ms_bacth_commit_enable(void* handle, bool ins_status, bool valid_status, bool noti_enable, int pid); -void ms_bacth_commit_disable(void* handle, bool ins_status, bool valid_status, uid_t uid); +void ms_bacth_commit_enable(bool ins_status, bool valid_status, bool noti_enable, int pid); +void ms_bacth_commit_disable(bool ins_status, bool valid_status, uid_t uid); #endif /*_MEDIA_COMMON_DB_SVC_H_*/ diff --git a/src/common/include/media-common-external-storage.h b/src/common/include/media-common-external-storage.h index eada7f9..af31213 100755 --- a/src/common/include/media-common-external-storage.h +++ b/src/common/include/media-common-external-storage.h @@ -28,6 +28,6 @@ int ms_get_stg_changed_event(void); int ms_read_device_info(const char *root_path, char **device_uuid); int ms_write_device_info(const char *root_path, char *device_uuid); -int ms_get_added_storage_path(void **handle, const char *add_path, char **device_id); +int ms_get_added_storage_path(const char *add_path, char **device_id); #endif /*_MEDIA_SERVER_EXTERNAL_STORAGE_H_*/ diff --git a/src/common/media-common-db-svc.c b/src/common/media-common-db-svc.c index abbd6eb..d876583 100755 --- a/src/common/media-common-db-svc.c +++ b/src/common/media-common-db-svc.c @@ -379,7 +379,7 @@ int ms_validate_item(void **handle, const char *storage_id, const char *path, ui } else if (ret == MS_MEDIA_ERR_NONE) { if (modified == FALSE) { /*if meta data of file exist, change valid field to "1" */ - ret = ((SET_ITEM_VALIDITY)func_array[lib_index][eSET_VALIDITY])(handle[lib_index], storage_id, path, true, true, uid); /*dlopen*/ + ret = ((SET_ITEM_VALIDITY)func_array[lib_index][eSET_VALIDITY])(storage_id, path, true, true, uid); /*dlopen*/ MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "Error : %s [%s]", g_array_index(so_array, char*, lib_index), path); } else { /* the file has same name but it is changed, so we have to update DB */ @@ -409,7 +409,7 @@ int ms_scan_validate_item(void **handle, const char *storage_id, const char *pat } else if (ret == MS_MEDIA_ERR_NONE) { if (modified == FALSE) { /*if meta data of file exist, change valid field to "1" */ - ret = ((SET_ITEM_VALIDITY)func_array[lib_index][eSET_VALIDITY])(handle[lib_index], storage_id, path, true, true, uid); /*dlopen*/ + ret = ((SET_ITEM_VALIDITY)func_array[lib_index][eSET_VALIDITY])(storage_id, path, true, true, uid); /*dlopen*/ MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "Error : %s [%s]", g_array_index(so_array, char*, lib_index), path); } else { /* the file has same name but it is changed, so we have to update DB */ @@ -673,13 +673,13 @@ int ms_insert_folder(void **handle, const char *storage_id, const char *path, ui return ret; } -int ms_delete_invalid_folder(void **handle, const char *storage_id, int storage_type, uid_t uid) +int ms_delete_invalid_folder(const char *storage_id, int storage_type, uid_t uid) { int lib_index; int ret = MS_MEDIA_ERR_NONE; for (lib_index = 0; lib_index < lib_num; lib_index++) { - ret = ((DELETE_INVALID_FOLDER)func_array[lib_index][eDELETE_INVALID_FOLDER])(handle[lib_index], storage_id, storage_type, uid); /*dlopen*/ + ret = ((DELETE_INVALID_FOLDER)func_array[lib_index][eDELETE_INVALID_FOLDER])(storage_id, storage_type, uid); /*dlopen*/ MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "Error : %s [%s]", g_array_index(so_array, char*, lib_index), storage_id); } @@ -715,12 +715,12 @@ int ms_check_db_upgrade(void **handle, uid_t uid) return ret; } -int ms_genarate_uuid(void **handle, char **uuid) +int ms_genarate_uuid(char **uuid) { int lib_index = 0; int ret = MS_MEDIA_ERR_NONE; - ret = ((GET_UUID)func_array[lib_index][eGET_UUID])(NULL, uuid); /*dlopen*/ + ret = ((GET_UUID)func_array[lib_index][eGET_UUID])(uuid); /*dlopen*/ MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "Error : %s", g_array_index(so_array, char*, lib_index)); return ret; @@ -794,20 +794,20 @@ int ms_set_storage_validity(void **handle, const char *storage_id, int validity, return ret; } -int ms_set_all_storage_validity(void **handle, int validity, uid_t uid) +int ms_set_all_storage_validity(int validity, uid_t uid) { int lib_index; int ret = MS_MEDIA_ERR_NONE; for (lib_index = 0; lib_index < lib_num; lib_index++) { - ret = ((SET_ALL_STORAGE_VALIDITY)func_array[lib_index][eSET_ALL_STORAGE_VALIDITY])(handle[lib_index], validity, uid); /*dlopen*/ + ret = ((SET_ALL_STORAGE_VALIDITY)func_array[lib_index][eSET_ALL_STORAGE_VALIDITY])(validity, uid); /*dlopen*/ MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "Error : %s", g_array_index(so_array, char*, lib_index)); } return ret; } -int ms_update_meta_batch(void **handle, const char *path, const char *storage_id, uid_t uid) +int ms_update_meta_batch(const char *path, const char *storage_id, uid_t uid) { int lib_index; int ret = MS_MEDIA_ERR_NONE; @@ -819,7 +819,7 @@ int ms_update_meta_batch(void **handle, const char *path, const char *storage_id MS_DBG_FENTER(); for (lib_index = 0; lib_index < lib_num; lib_index++) { - ret = ((UPDATE_ITEM_META)func_array[lib_index][eUPDATE_ITEM_META])(handle[lib_index], path, storage_id, storage_type, uid); /*dlopen*/ + ret = ((UPDATE_ITEM_META)func_array[lib_index][eUPDATE_ITEM_META])(path, storage_id, storage_type, uid); /*dlopen*/ MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "Error : %s", g_array_index(so_array, char*, lib_index)); } @@ -876,104 +876,104 @@ int ms_get_folder_id(void **handle, const char *storage_id, const char *path, ch } /* FOR BULK COMMIT */ -void ms_register_start(void **handle, ms_noti_switch_e noti_status, int pid) +void ms_register_start(ms_noti_switch_e noti_status, int pid) { int lib_index; int ret = MS_MEDIA_ERR_NONE; for (lib_index = 0; lib_index < lib_num; lib_index++) { - ret = ((INSERT_ITEM_BEGIN)func_array[lib_index][eINSERT_BEGIN])(handle[lib_index], MSC_REGISTER_COUNT, noti_status, pid);/*dlopen*/ + ret = ((INSERT_ITEM_BEGIN)func_array[lib_index][eINSERT_BEGIN])(MSC_REGISTER_COUNT, noti_status, pid);/*dlopen*/ if (ret != MS_MEDIA_ERR_NONE) { MS_DBG_ERR("error : %s", g_array_index(so_array, char*, lib_index)); } } } -void ms_register_end(void **handle, uid_t uid) +void ms_register_end(uid_t uid) { int lib_index; int ret = MS_MEDIA_ERR_NONE; for (lib_index = 0; lib_index < lib_num; lib_index++) { - ret = ((INSERT_ITEM_END)func_array[lib_index][eINSERT_END])(handle[lib_index], uid);/*dlopen*/ + ret = ((INSERT_ITEM_END)func_array[lib_index][eINSERT_END])(uid);/*dlopen*/ if (ret != MS_MEDIA_ERR_NONE) { MS_DBG_ERR("error : %s", g_array_index(so_array, char*, lib_index)); } } } -void ms_validate_start(void **handle) +void ms_validate_start() { int lib_index; int ret = MS_MEDIA_ERR_NONE; for (lib_index = 0; lib_index < lib_num; lib_index++) { - ret = ((SET_ITEM_VALIDITY_BEGIN)func_array[lib_index][eSET_VALIDITY_BEGIN])(handle[lib_index], MSC_VALID_COUNT);/*dlopen*/ + ret = ((SET_ITEM_VALIDITY_BEGIN)func_array[lib_index][eSET_VALIDITY_BEGIN])(MSC_VALID_COUNT);/*dlopen*/ if (ret != MS_MEDIA_ERR_NONE) { MS_DBG_ERR("error : %s", g_array_index(so_array, char*, lib_index)); } } } -void ms_validate_end(void **handle, uid_t uid) +void ms_validate_end(uid_t uid) { int lib_index; int ret = MS_MEDIA_ERR_NONE; for (lib_index = 0; lib_index < lib_num; lib_index++) { - ret = ((SET_ITEM_VALIDITY_END)func_array[lib_index][eSET_VALIDITY_END])(handle[lib_index], uid);/*dlopen*/ + ret = ((SET_ITEM_VALIDITY_END)func_array[lib_index][eSET_VALIDITY_END])(uid);/*dlopen*/ if (ret != MS_MEDIA_ERR_NONE) { MS_DBG_ERR("error : %s", g_array_index(so_array, char*, lib_index)); } } } -void ms_insert_folder_start(void **handle) +void ms_insert_folder_start() { int lib_index; int ret = MS_MEDIA_ERR_NONE; for (lib_index = 0; lib_index < lib_num; lib_index++) { - ret = ((INSERT_FOLDER_BEGIN)func_array[lib_index][eINSERT_FOLDER_BEGIN])(handle[lib_index], MSC_REGISTER_COUNT);/*dlopen*/ + ret = ((INSERT_FOLDER_BEGIN)func_array[lib_index][eINSERT_FOLDER_BEGIN])(MSC_REGISTER_COUNT);/*dlopen*/ if (ret != MS_MEDIA_ERR_NONE) { MS_DBG_ERR("error : %s", g_array_index(so_array, char*, lib_index)); } } } -void ms_insert_folder_end(void **handle, uid_t uid) +void ms_insert_folder_end(uid_t uid) { int lib_index; int ret = MS_MEDIA_ERR_NONE; for (lib_index = 0; lib_index < lib_num; lib_index++) { - ret = ((INSERT_FOLDER_END)func_array[lib_index][eINSERT_FOLDER_END])(handle[lib_index], uid);/*dlopen*/ + ret = ((INSERT_FOLDER_END)func_array[lib_index][eINSERT_FOLDER_END])(uid);/*dlopen*/ if (ret != MS_MEDIA_ERR_NONE) { MS_DBG_ERR("error : %s", g_array_index(so_array, char*, lib_index)); } } } -void ms_update_start(void **handle) +void ms_update_start() { int lib_index; int ret = MS_MEDIA_ERR_NONE; for (lib_index = 0; lib_index < lib_num; lib_index++) { - ret = ((UPDATE_ITEM_BEGIN)func_array[lib_index][eUPDATE_ITEM_BEGIN])(handle[lib_index], MSC_VALID_COUNT);/*dlopen*/ + ret = ((UPDATE_ITEM_BEGIN)func_array[lib_index][eUPDATE_ITEM_BEGIN])(MSC_VALID_COUNT);/*dlopen*/ if (ret != MS_MEDIA_ERR_NONE) { MS_DBG_ERR("error : %s", g_array_index(so_array, char*, lib_index)); } } } -void ms_update_end(void **handle, uid_t uid) +void ms_update_end(uid_t uid) { int lib_index; int ret = MS_MEDIA_ERR_NONE; for (lib_index = 0; lib_index < lib_num; lib_index++) { - ret = ((UPDATE_ITEM_END)func_array[lib_index][eUPDATE_ITEM_END])(handle[lib_index], uid);/*dlopen*/ + ret = ((UPDATE_ITEM_END)func_array[lib_index][eUPDATE_ITEM_END])(uid);/*dlopen*/ if (ret != MS_MEDIA_ERR_NONE) { MS_DBG_ERR("error : %s", g_array_index(so_array, char*, lib_index)); } @@ -1075,20 +1075,20 @@ int ms_change_validity_item_batch(void **handle, const char *storage_id, const c return ret; } -int ms_get_media_type(void **handle, const char *path, int *media_type) +int ms_get_media_type(const char *path, int *media_type) { int lib_index; int ret = MS_MEDIA_ERR_NONE; for (lib_index = 0; lib_index < lib_num; lib_index++) { - ret = ((GET_MEDIA_TYPE)func_array[lib_index][eGET_MEDIA_TYPE])(handle[lib_index], path, media_type); /*dlopen*/ + ret = ((GET_MEDIA_TYPE)func_array[lib_index][eGET_MEDIA_TYPE])(path, media_type); /*dlopen*/ MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "Error : %s", g_array_index(so_array, char*, lib_index)); } return ret; } -bool ms_check_support_media_type(void **handle, const char *path) +bool ms_check_support_media_type(const char *path) { int ret = SYSTEM_INFO_ERROR_NONE; int media_type = -1; @@ -1108,7 +1108,7 @@ bool ms_check_support_media_type(void **handle, const char *path) /* If not, check media type */ if (!scan_other_type) { - ret = ms_get_media_type(handle, path, &media_type); + ret = ms_get_media_type(path, &media_type); MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, false, "Failed to get media type"); if (media_type == MS_MEDIA_TYPE_OTHER) @@ -1118,20 +1118,20 @@ bool ms_check_support_media_type(void **handle, const char *path) return true; } -void ms_bacth_commit_enable(void* handle, bool ins_status, bool valid_status, bool noti_enable, int pid) +void ms_bacth_commit_enable(bool ins_status, bool valid_status, bool noti_enable, int pid) { /*call for bundle commit*/ - if (ins_status) ms_register_start(handle, noti_enable, pid); - if (valid_status) ms_validate_start(handle); + if (ins_status) ms_register_start(noti_enable, pid); + if (valid_status) ms_validate_start(); return; } -void ms_bacth_commit_disable(void* handle, bool ins_status, bool valid_status, uid_t uid) +void ms_bacth_commit_disable(bool ins_status, bool valid_status, uid_t uid) { /*call for bundle commit*/ - if (valid_status) ms_validate_end(handle, uid); - if (ins_status) ms_register_end(handle, uid); + if (valid_status) ms_validate_end(uid); + if (ins_status) ms_register_end(uid); return; } diff --git a/src/common/media-common-external-storage.c b/src/common/media-common-external-storage.c index c0ef4d5..79d55bf 100755 --- a/src/common/media-common-external-storage.c +++ b/src/common/media-common-external-storage.c @@ -130,7 +130,7 @@ int ms_write_device_info(const char *root_path, char *device_uuid) return MS_MEDIA_ERR_NONE; } -int ms_get_added_storage_path(void **handle, const char *add_path, char **device_id) +int ms_get_added_storage_path(const char *add_path, char **device_id) { int ret = MS_MEDIA_ERR_NONE; char *id = NULL; @@ -141,7 +141,7 @@ int ms_get_added_storage_path(void **handle, const char *add_path, char **device ret = ms_read_device_info(add_path, &id); if (id == NULL) { if (ret == MS_MEDIA_ERR_FILE_NOT_EXIST) { - ret = ms_genarate_uuid(handle, &id); + ret = ms_genarate_uuid(&id); ret = ms_write_device_info(add_path , id); if (ret == MS_MEDIA_ERR_NONE) *device_id = strdup(id); diff --git a/src/common/media-common-system.c b/src/common/media-common-system.c index 176b0da..7c3140f 100755 --- a/src/common/media-common-system.c +++ b/src/common/media-common-system.c @@ -385,7 +385,6 @@ int ms_sys_get_device_list(ms_stg_type_e stg_type, GArray **dev_list) usb_device_list_h list; usb_device_h device; char *mount_path = NULL; - void **handle = NULL; ret = ms_load_functions(); if (ret != MS_MEDIA_ERR_NONE) { @@ -422,7 +421,7 @@ int ms_sys_get_device_list(ms_stg_type_e stg_type, GArray **dev_list) char *storage_id = NULL; ms_block_info_s *data = NULL; - err = ms_get_added_storage_path(handle, mount_path, &storage_id); + err = ms_get_added_storage_path(mount_path, &storage_id); if ((err == MS_MEDIA_ERR_NONE) && (storage_id != NULL)) { data = malloc(sizeof(ms_block_info_s)); data->mount_path = strdup(mount_path); diff --git a/src/mediadb-update.c b/src/mediadb-update.c index 49685d7..15a78f4 100755 --- a/src/mediadb-update.c +++ b/src/mediadb-update.c @@ -55,14 +55,14 @@ typedef struct block_info_s { char *mount_uuid; } block_info_s; -int (*svc_connect) (void ** handle, uid_t uid, char ** err_msg); -int (*svc_disconnect) (void * handle, char ** err_msg); -int (*svc_check_db) (void * handle, uid_t uid, char ** err_msg); -int (*svc_get_storage_id) (void * handle, const char *path, char *storage_id, uid_t uid, char ** err_msg); -int (*svc_insert_storage) (void *handle, const char *storage_id, int storage_type, const char *storage_path, uid_t uid, char **err_msg); -int (*svc_update_storage) (void *handle, const char *storage_id, const char *storage_path, uid_t uid, char **err_msg); -int (*svc_set_storage_validity) (void * handle, const char *storage_id, int validity, uid_t uid, char **err_msg); -int (*svc_check_storage) (void * handle, const char *storage_id, char **storage_path, int *validity, uid_t uid, char **err_msg); +int (*svc_connect) (void ** handle, uid_t uid); +int (*svc_disconnect) (void * handle); +int (*svc_check_db) (void * handle, uid_t uid); +int (*svc_get_storage_id) (void * handle, const char *path, char *storage_id, uid_t uid); +int (*svc_insert_storage) (void *handle, const char *storage_id, int storage_type, const char *storage_path, uid_t uid); +int (*svc_update_storage) (void *handle, const char *storage_id, const char *storage_path, uid_t uid); +int (*svc_set_storage_validity) (void * handle, const char *storage_id, int validity, uid_t uid); +int (*svc_check_storage) (void * handle, const char *storage_id, char **storage_path, int *validity, uid_t uid); void callback(media_request_result_s * result, void *user_data) { @@ -206,7 +206,6 @@ static bool __check_storage(void) char *storage_path = NULL; int validity = 0; bool need_scan = false; - char *err_msg = NULL; funcHandle = dlopen(PATH_PLUGIN_LIB, RTLD_LAZY); if (funcHandle == NULL) { @@ -224,7 +223,7 @@ static bool __check_storage(void) ret = __get_device_list(&dev_list); if (ret == 0) { /* Set validity to 0 */ - ret = svc_connect(&db_handle, tzplatform_getuid(TZ_USER_NAME), &err_msg); + ret = svc_connect(&db_handle, tzplatform_getuid(TZ_USER_NAME)); if (ret < 0) { printf("Error svc_connect\n"); __release_device_list(&dev_list); @@ -240,7 +239,7 @@ static bool __check_storage(void) for (i = 0; i < dev_num; i++) { block_info = (block_info_s *)g_array_index(dev_list, int *, i); /* Check exists */ - ret = svc_check_storage(db_handle, block_info->mount_uuid, &storage_path, &validity, tzplatform_getuid(TZ_USER_NAME), &err_msg); + ret = svc_check_storage(db_handle, block_info->mount_uuid, &storage_path, &validity, tzplatform_getuid(TZ_USER_NAME)); if (ret < 0) printf("Error svc_check_storage\n"); @@ -248,13 +247,13 @@ static bool __check_storage(void) /* check storage_path and update validity and path */ /* Mount point can be changed */ if (strcmp(block_info->mount_path, storage_path) != 0) { - ret = svc_update_storage(db_handle, block_info->mount_uuid, block_info->mount_path, tzplatform_getuid(TZ_USER_NAME), &err_msg); + ret = svc_update_storage(db_handle, block_info->mount_uuid, block_info->mount_path, tzplatform_getuid(TZ_USER_NAME)); if (ret < 0) printf("Error svc_update_storage\n"); } if (validity == 0) { - ret = svc_set_storage_validity(db_handle, block_info->mount_uuid, 1, tzplatform_getuid(TZ_USER_NAME), &err_msg); + ret = svc_set_storage_validity(db_handle, block_info->mount_uuid, 1, tzplatform_getuid(TZ_USER_NAME)); if (ret < 0) printf("Error svc_set_storage_validity\n"); @@ -267,7 +266,7 @@ static bool __check_storage(void) } } else { /* insert new storage */ - ret = svc_insert_storage(db_handle, block_info->mount_uuid, 1, block_info->mount_path, tzplatform_getuid(TZ_USER_NAME), &err_msg); + ret = svc_insert_storage(db_handle, block_info->mount_uuid, 1, block_info->mount_path, tzplatform_getuid(TZ_USER_NAME)); if (ret < 0) printf("Error svc_insert_storage\n"); @@ -282,7 +281,7 @@ static bool __check_storage(void) __release_device_list(&dev_list); } - ret = svc_disconnect(db_handle, &err_msg); + ret = svc_disconnect(db_handle); if (ret < 0) printf("Error svc_disconnect\n"); } else { @@ -300,7 +299,6 @@ static void __check_media_db(void) { void *funcHandle = NULL; void *db_handle = NULL; - char *err_msg = NULL; int ret = 0; funcHandle = dlopen(PATH_PLUGIN_LIB, RTLD_LAZY); @@ -313,15 +311,15 @@ static void __check_media_db(void) svc_disconnect = dlsym(funcHandle, "disconnect_db"); svc_check_db = dlsym(funcHandle, "check_db"); - ret = svc_connect(&db_handle, tzplatform_getuid(TZ_USER_NAME), &err_msg); + ret = svc_connect(&db_handle, tzplatform_getuid(TZ_USER_NAME)); if (ret < 0) printf("Error svc_connect\n"); - ret = svc_check_db(db_handle, tzplatform_getuid(TZ_USER_NAME), &err_msg); + ret = svc_check_db(db_handle, tzplatform_getuid(TZ_USER_NAME)); if (ret < 0) printf("Error svc_check_db\n"); - ret = svc_disconnect(db_handle, &err_msg); + ret = svc_disconnect(db_handle); if (ret < 0) printf("Error svc_disconnect\n"); @@ -334,7 +332,6 @@ static int __get_storage_id(const char *path, char *storage_id, uid_t uid) { void *funcHandle = NULL; void *db_handle = NULL; - char *err_msg = NULL; int ret = 0; if (strncmp(tzplatform_getenv(TZ_USER_CONTENT), path, strlen(tzplatform_getenv(TZ_USER_CONTENT))) != 0 && strncmp(tzplatform_getenv(TZ_SYS_STORAGE), path, strlen(tzplatform_getenv(TZ_SYS_STORAGE))) != 0) { @@ -352,20 +349,20 @@ static int __get_storage_id(const char *path, char *storage_id, uid_t uid) svc_disconnect = dlsym(funcHandle, "disconnect_db"); svc_get_storage_id = dlsym(funcHandle, "get_storage_id"); - ret = svc_connect(&db_handle, uid, &err_msg); + ret = svc_connect(&db_handle, uid); if (ret < 0) { printf("Error svc_connect\n"); dlclose(funcHandle); return -1; } - ret = svc_get_storage_id(db_handle, path, storage_id, tzplatform_getuid(TZ_USER_NAME), &err_msg); + ret = svc_get_storage_id(db_handle, path, storage_id, tzplatform_getuid(TZ_USER_NAME)); if (ret < 0) { printf("Error svc_get_storage_id\n"); dlclose(funcHandle); return -1; } - ret = svc_disconnect(db_handle, &err_msg); + ret = svc_disconnect(db_handle); if (ret < 0) { printf("Error svc_disconnect\n"); dlclose(funcHandle); diff --git a/src/scanner-v2/media-scanner-scan-v2.c b/src/scanner-v2/media-scanner-scan-v2.c index e07ddb9..2202ea6 100755 --- a/src/scanner-v2/media-scanner-scan-v2.c +++ b/src/scanner-v2/media-scanner-scan-v2.c @@ -288,7 +288,7 @@ static int __msc_dir_scan_for_folder(void **handle, const char *storage_id, cons //MS_DBG_ERR("new start path [%s]", new_start_path); g_array_append_val(dir_array, start_path); - ms_insert_folder_end(handle, uid); + ms_insert_folder_end(uid); is_recursive = (scan_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) ? false : true; @@ -317,8 +317,8 @@ static int __msc_dir_scan_for_folder(void **handle, const char *storage_id, cons goto STOP_SCAN; } - ms_bacth_commit_disable(handle, TRUE, TRUE, uid); - ms_bacth_commit_enable(handle, TRUE, TRUE, MS_NOTI_SWITCH_OFF, pid); + ms_bacth_commit_disable(TRUE, TRUE, uid); + ms_bacth_commit_enable(TRUE, TRUE, MS_NOTI_SWITCH_OFF, pid); /* get the current path from directory array */ current_path = g_array_index(dir_array , char*, 0); g_array_remove_index(dir_array, 0); @@ -352,7 +352,7 @@ static int __msc_dir_scan_for_folder(void **handle, const char *storage_id, cons goto STOP_SCAN; } - ms_insert_folder_start(handle); + ms_insert_folder_start(); ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_PROCESSING, uid); sleep_count = 0; @@ -473,7 +473,7 @@ static int __msc_dir_scan_for_folder(void **handle, const char *storage_id, cons } if (d->d_type == DT_REG) { - if (!ms_check_support_media_type(handle, path)) { + if (!ms_check_support_media_type(path)) { bpos += d->d_reclen; continue; } @@ -539,7 +539,7 @@ static int __msc_dir_scan_for_folder(void **handle, const char *storage_id, cons } } - ms_insert_folder_end(handle, uid); + ms_insert_folder_end(uid); ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_DONE, uid); if (fd != -1) { @@ -556,7 +556,7 @@ static int __msc_dir_scan_for_folder(void **handle, const char *storage_id, cons STOP_SCAN: MS_DBG_ERR("stop folder scan..."); - ms_insert_folder_end(handle, uid); + ms_insert_folder_end(uid); ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_STOP, uid); END_SCAN: @@ -570,7 +570,7 @@ END_SCAN: __msc_clear_file_list(dir_array); - ms_bacth_commit_disable(handle, TRUE, TRUE, uid); + ms_bacth_commit_disable(TRUE, TRUE, uid); if (ret != MS_MEDIA_ERR_NONE) MS_DBG_INFO("ret : %d", ret); @@ -617,13 +617,13 @@ static int __msc_dir_scan_for_storage(void **handle, const char *storage_id, con } g_array_append_val(dir_array, start_path); - ms_insert_folder_end(handle, uid); + ms_insert_folder_end(uid); 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_scan_validate_item; - ms_bacth_commit_disable(handle, TRUE, TRUE, uid); + ms_bacth_commit_disable(TRUE, TRUE, uid); /*start db update. the number of element in the array , db update is complete.*/ while (dir_array->len != 0) { /*check poweroff status*/ @@ -632,7 +632,7 @@ static int __msc_dir_scan_for_storage(void **handle, const char *storage_id, con goto STOP_SCAN; /*ms_bacth_commit_disable(handle, TRUE, TRUE, uid);*/ - ms_bacth_commit_enable(handle, TRUE, TRUE, MS_NOTI_SWITCH_OFF, pid); + ms_bacth_commit_enable(TRUE, TRUE, MS_NOTI_SWITCH_OFF, pid); /* get the current path from directory array */ current_path = g_array_index(dir_array , char*, 0); @@ -681,7 +681,7 @@ static int __msc_dir_scan_for_storage(void **handle, const char *storage_id, con } } - ms_insert_folder_start(handle); + ms_insert_folder_start(); ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_PROCESSING, uid); sleep_count = 0; @@ -771,7 +771,7 @@ static int __msc_dir_scan_for_storage(void **handle, const char *storage_id, con if (d->d_type == DT_REG) { /* check media type */ - if (!ms_check_support_media_type(handle, path)) { + if (!ms_check_support_media_type(path)) { bpos += d->d_reclen; continue; } @@ -808,9 +808,9 @@ static int __msc_dir_scan_for_storage(void **handle, const char *storage_id, con } } - ms_insert_folder_end(handle, uid); + ms_insert_folder_end(uid); /*commit to db before set scan done, fix timing issue storage scan, then folder scan for same folder*/ - ms_bacth_commit_disable(handle, TRUE, TRUE, uid); + ms_bacth_commit_disable(TRUE, TRUE, uid); ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_DONE, uid); if (fd != -1) { @@ -877,7 +877,7 @@ NEXT_SCAN: goto EXIT; STOP_SCAN: - ms_insert_folder_end(handle, uid); + ms_insert_folder_end(uid); if (current_path != NULL) ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_STOP, uid); @@ -892,7 +892,7 @@ EXIT: __msc_set_storage_scan_cur_path(NULL); __msc_clear_file_list(dir_array); - ms_bacth_commit_disable(handle, TRUE, TRUE, uid); + ms_bacth_commit_disable(TRUE, TRUE, uid); if (ret != MS_MEDIA_ERR_NONE) MS_DBG_INFO("ret : %d", ret); @@ -1255,7 +1255,7 @@ gboolean msc_directory_scan_thread(void *data) MS_DBG_ERR("error : %d", err); /*call for bundle commit*/ - ms_bacth_commit_enable(handle, TRUE, TRUE, MS_NOTI_SWITCH_OFF, 0); + ms_bacth_commit_enable(TRUE, TRUE, MS_NOTI_SWITCH_OFF, 0); if (strcmp(scan_data->msg, MEDIA_ROOT_PATH_DISC) == 0) { MS_DBG("[DATA DISC]"); @@ -1266,7 +1266,7 @@ gboolean msc_directory_scan_thread(void *data) ret = __msc_db_update(handle, storage_id, scan_data); /*call for bundle commit*/ - ms_bacth_commit_disable(handle, TRUE, TRUE, uid); + ms_bacth_commit_disable(TRUE, TRUE, uid); MS_DBG_WARN("folder scan done, sent cb event path = [%.*s]", MAX_MSG_SIZE, scan_data->msg); __msc_call_dir_scan_cb(); @@ -1440,7 +1440,7 @@ gboolean msc_storage_scan_thread(void *data) valid_status = (scan_type == MS_MSG_STORAGE_PARTIAL || MS_MSG_STORAGE_ALL == scan_type) ? TRUE : FALSE; if (scan_type != MS_MSG_STORAGE_INVALID) - ms_bacth_commit_enable(handle, TRUE, valid_status, MS_NOTI_SWITCH_OFF, 0); + ms_bacth_commit_enable(TRUE, valid_status, MS_NOTI_SWITCH_OFF, 0); if (scan_type == MS_MSG_STORAGE_ALL) { /* Delete all data before full scanning */ @@ -1452,11 +1452,11 @@ gboolean msc_storage_scan_thread(void *data) /*call for bundle commit*/ if (scan_type != MS_MSG_STORAGE_INVALID) - ms_bacth_commit_disable(handle, TRUE, valid_status, uid); + ms_bacth_commit_disable(TRUE, valid_status, uid); if (scan_type == MS_MSG_STORAGE_PARTIAL && ret == MS_MEDIA_ERR_NONE) { /*delete invalid folder first, then delete invalid item, avoid to folder was deleted but item not when unmount*/ - ms_delete_invalid_folder(handle, scan_data->storage_id, storage_type, uid); + ms_delete_invalid_folder(scan_data->storage_id, storage_type, uid); ms_delete_invalid_items(handle, scan_data->storage_id, storage_type, uid); } @@ -1614,7 +1614,7 @@ static int __msc_batch_insert(int pid, GArray *path_array, uid_t uid) /*start db updating */ /*call for bundle commit*/ - ms_bacth_commit_enable(handle, TRUE, FALSE, MS_NOTI_SWITCH_ON, pid); + ms_bacth_commit_enable(TRUE, FALSE, MS_NOTI_SWITCH_ON, pid); MS_DBG_WARN("BULK REGISTER START"); @@ -1642,7 +1642,7 @@ static int __msc_batch_insert(int pid, GArray *path_array, uid_t uid) } /*call for bundle commit*/ - ms_bacth_commit_disable(handle, TRUE, FALSE, uid); + ms_bacth_commit_disable(TRUE, FALSE, uid); /*disconnect form media db*/ if (handle) ms_disconnect_db(&handle); diff --git a/src/scanner/media-scanner-scan.c b/src/scanner/media-scanner-scan.c index 3e3c6cd..f71d597 100755 --- a/src/scanner/media-scanner-scan.c +++ b/src/scanner/media-scanner-scan.c @@ -84,7 +84,7 @@ static int __msc_dir_scan(void **handle, const char *storage_id, const char*star continue; } - ms_insert_folder_start(handle); + ms_insert_folder_start(); dir = g_dir_open(current_path, 0, &error); if (error == NULL && dir != NULL) { @@ -94,7 +94,7 @@ static int __msc_dir_scan(void **handle, const char *storage_id, const char*star while ((name = g_dir_read_name(dir))) { ret = __msc_check_stop_status(); if (ret != MS_MEDIA_ERR_NONE) { - ms_insert_folder_end(handle, uid); + ms_insert_folder_end(uid); goto STOP_SCAN; } @@ -114,7 +114,7 @@ static int __msc_dir_scan(void **handle, const char *storage_id, const char*star } /* Check content.scanning.others feature */ - if (!ms_check_support_media_type(handle, path)) { + if (!ms_check_support_media_type(path)) { MS_DBG("Unsupported media type"); continue; } @@ -151,7 +151,7 @@ static int __msc_dir_scan(void **handle, const char *storage_id, const char*star dir = NULL; } - ms_insert_folder_end(handle, uid); + ms_insert_folder_end(uid); MS_SAFE_FREE(current_path); } @@ -305,19 +305,19 @@ gboolean msc_directory_scan_thread(void *data) } start_path = g_strdup(scan_data->msg); - ms_bacth_commit_enable(handle, TRUE, TRUE, MS_NOTI_SWITCH_OFF, 0); + ms_bacth_commit_enable(TRUE, TRUE, MS_NOTI_SWITCH_OFF, 0); if (noti_type == MS_ITEM_INSERT) ret = __msc_dir_scan(handle, storage_id, start_path, false, is_recursive, scan_data->uid); else ret = __msc_dir_scan(handle, storage_id, start_path, true, is_recursive, scan_data->uid); - ms_bacth_commit_disable(handle, TRUE, TRUE, scan_data->uid); + ms_bacth_commit_disable(TRUE, TRUE, scan_data->uid); if (!ms_delete_invalid_items(handle, storage_id, storage_type, scan_data->uid)) MS_DBG_ERR("deleting invalid items in storage failed"); - if (ms_delete_invalid_folder(handle, storage_id, storage_type, scan_data->uid) != MS_MEDIA_ERR_NONE) + if (ms_delete_invalid_folder(storage_id, storage_type, scan_data->uid) != MS_MEDIA_ERR_NONE) MS_DBG_ERR("deleting invalid folders in storage failed"); if (ret != MS_MEDIA_ERR_SCANNER_FORCE_STOP) { @@ -415,7 +415,7 @@ gboolean msc_storage_scan_thread(void *data) ms_set_db_status(MS_DB_UPDATING, storage_type); valid_status = (scan_type == MS_MSG_STORAGE_PARTIAL) ? TRUE : FALSE; - ms_bacth_commit_enable(handle, TRUE, valid_status, MS_NOTI_SWITCH_OFF, 0); + ms_bacth_commit_enable(TRUE, valid_status, MS_NOTI_SWITCH_OFF, 0); if (scan_type == MS_MSG_STORAGE_PARTIAL) { ret = ms_validity_change_all_items(handle, storage_id, storage_type, false, scan_data->uid); @@ -428,13 +428,13 @@ gboolean msc_storage_scan_thread(void *data) ret = __msc_db_update(handle, storage_id, scan_data); /*call for bundle commit*/ - ms_bacth_commit_disable(handle, TRUE, valid_status, scan_data->uid); + ms_bacth_commit_disable(TRUE, valid_status, scan_data->uid); if (scan_type == MS_MSG_STORAGE_PARTIAL && ret == MS_MEDIA_ERR_NONE) { if (!ms_delete_invalid_items(handle, storage_id, storage_type, scan_data->uid)) MS_DBG_ERR("deleting invalid items in storage failed"); - if (ms_delete_invalid_folder(handle, storage_id, storage_type, scan_data->uid) != MS_MEDIA_ERR_NONE) + if (ms_delete_invalid_folder(storage_id, storage_type, scan_data->uid) != MS_MEDIA_ERR_NONE) MS_DBG_ERR("deleting invalid folders in storage failed"); } @@ -576,7 +576,7 @@ static int __msc_batch_insert(int pid, GArray *path_array, uid_t uid) /*start db updating */ /*call for bundle commit*/ - ms_bacth_commit_enable(handle, TRUE, FALSE, MS_NOTI_SWITCH_ON, pid); + ms_bacth_commit_enable(TRUE, FALSE, MS_NOTI_SWITCH_ON, pid); MS_DBG_WARN("BULK REGISTER START[%d]", pid); @@ -597,13 +597,13 @@ static int __msc_batch_insert(int pid, GArray *path_array, uid_t uid) if (power_off) { MS_DBG_ERR("power off"); /*call for bundle commit*/ - ms_register_end(handle, uid); + ms_register_end(uid); break; } } /*call for bundle commit*/ - ms_bacth_commit_disable(handle, TRUE, FALSE, uid); + ms_bacth_commit_disable(TRUE, FALSE, uid); /*disconnect form media db*/ if (handle) ms_disconnect_db(&handle); @@ -736,7 +736,7 @@ _POWEROFF: return false; } -static int __msc_dir_scan_meta_update(void **handle, const char*start_path, const char *storage_id, uid_t uid) +static int __msc_dir_scan_meta_update(const char*start_path, const char *storage_id, uid_t uid) { int ret = MS_MEDIA_ERR_NONE; GDir *dir = NULL; @@ -793,7 +793,7 @@ static int __msc_dir_scan_meta_update(void **handle, const char*start_path, cons } if (g_file_test(path, G_FILE_TEST_IS_REGULAR)) { - if (ms_update_meta_batch(handle, path, storage_id, uid) != MS_MEDIA_ERR_NONE) { + if (ms_update_meta_batch(path, storage_id, uid) != MS_MEDIA_ERR_NONE) { MS_DBG_ERR("failed to update db"); continue; } @@ -849,7 +849,7 @@ gboolean msc_metadata_update(void *data) return false; /*call for bundle commit*/ - ms_update_start(handle); + ms_update_start(); /*insert data into media db */ ret = ms_user_get_internal_root_path(scan_data->uid, &usr_path); @@ -859,7 +859,7 @@ gboolean msc_metadata_update(void *data) return MS_MEDIA_ERR_INTERNAL; } - ret = __msc_dir_scan_meta_update(handle, usr_path, INTERNAL_STORAGE_ID, scan_data->uid); + ret = __msc_dir_scan_meta_update(usr_path, INTERNAL_STORAGE_ID, scan_data->uid); /* send notification */ ms_send_dir_update_noti(handle, INTERNAL_STORAGE_ID, usr_path, NULL, MS_ITEM_UPDATE, scan_data->pid); MS_SAFE_FREE(usr_path); @@ -884,7 +884,7 @@ gboolean msc_metadata_update(void *data) continue; } - ret = __msc_dir_scan_meta_update(handle, stg_info->stg_path, stg_info->storage_id, scan_data->uid); + ret = __msc_dir_scan_meta_update(stg_info->stg_path, stg_info->storage_id, scan_data->uid); /* send notification */ ms_send_dir_update_noti(handle, stg_info->storage_id, stg_info->stg_path, NULL, MS_ITEM_UPDATE, scan_data->pid); @@ -896,7 +896,7 @@ gboolean msc_metadata_update(void *data) g_array_free(storage_list, FALSE); /*call for bundle commit*/ - ms_update_end(handle, scan_data->uid); + ms_update_end(scan_data->uid); if (power_off) { MS_DBG_WARN("power off"); diff --git a/src/server/media-server-db-manage.c b/src/server/media-server-db-manage.c index 0c9a852..ada3ff5 100755 --- a/src/server/media-server-db-manage.c +++ b/src/server/media-server-db-manage.c @@ -135,7 +135,7 @@ int ms_check_corrupt_mediadb(void) ms_sys_get_uid(&uid); - if (media_db_connect(&db_handle, uid, TRUE) != MS_MEDIA_ERR_NONE) { + if (media_db_connect(&db_handle, uid, FALSE) != MS_MEDIA_ERR_NONE) { MS_DBG_ERR("Failed to connect DB"); return MS_MEDIA_ERR_DB_CONNECT_FAIL; } diff --git a/src/server/media-server-device-block.c b/src/server/media-server-device-block.c index 76d1f5b..f1cd37c 100755 --- a/src/server/media-server-device-block.c +++ b/src/server/media-server-device-block.c @@ -42,7 +42,7 @@ static int __ms_get_added_storage_path(void **handle, const char *add_path, char ret = ms_read_device_info(add_path, &id); if (id == NULL) { if (ret == MS_MEDIA_ERR_FILE_NOT_EXIST) { - ret = ms_genarate_uuid(handle, &id); + ret = ms_genarate_uuid(&id); ret = ms_write_device_info(add_path , id); if (ret == MS_MEDIA_ERR_NONE) *device_id = strdup(id); @@ -165,7 +165,7 @@ int ms_storage_remove_handler(const char *mount_path, const char *mount_uuid) ms_sys_get_uid(&uid); ms_connect_db(&handle, uid); - ms_set_all_storage_validity(handle, 0, uid); + ms_set_all_storage_validity(0, uid); ms_disconnect_db(&handle); @@ -212,7 +212,7 @@ static void __ms_usb_add_event(const char *mount_path) if (mount_path != NULL) { MS_DBG_WARN("added path [%s]", mount_path); - __ms_get_added_storage_path(handle, mount_path, &storage_id); + __ms_get_added_storage_path(mount_path, &storage_id); if (storage_id != NULL) { /* update storage information into media DB */ @@ -449,7 +449,7 @@ int ms_check_mounted_storage(uid_t uid) if (storage_id == NULL) { /* in this case, all new storage */ char *device_uuid = NULL; - ret = ms_genarate_uuid(handle, &device_uuid); + ret = ms_genarate_uuid(&device_uuid); ret = ms_write_device_info(mounted_path, device_uuid); if (ret != MS_MEDIA_ERR_NONE) { MS_DBG_ERR("ms_write_device_info failed"); diff --git a/src/server/media-server-main.c b/src/server/media-server-main.c index 3c96ada..e55db7d 100755 --- a/src/server/media-server-main.c +++ b/src/server/media-server-main.c @@ -759,7 +759,7 @@ static void __ms_check_mediadb(void) MS_DBG_ERR("ms_set_storage_scan_status fail"); /*update just valid type*/ - if (ms_set_all_storage_validity(db_handle, 0, uid) != MS_MEDIA_ERR_NONE) + if (ms_set_all_storage_validity(0, uid) != MS_MEDIA_ERR_NONE) MS_DBG_ERR("ms_set_all_storage_validity fail"); #ifdef _USE_TVPD_MODE -- 2.7.4