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);
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);
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*);
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);
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);
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_*/
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_*/
} 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 */
} 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 */
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);
}
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;
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;
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));
}
}
/* 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));
}
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;
/* 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)
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;
}
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;
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);
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) {
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);
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)
{
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) {
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);
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");
/* 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");
}
} 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");
__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 {
{
void *funcHandle = NULL;
void *db_handle = NULL;
- char *err_msg = NULL;
int ret = 0;
funcHandle = dlopen(PATH_PLUGIN_LIB, RTLD_LAZY);
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");
{
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) {
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);
//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;
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);
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;
}
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;
}
}
}
- 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) {
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:
__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);
}
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*/
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);
}
}
- 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;
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;
}
}
}
- 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) {
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);
__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);
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]");
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();
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 */
/*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);
}
/*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");
}
/*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);
continue;
}
- ms_insert_folder_start(handle);
+ ms_insert_folder_start();
dir = g_dir_open(current_path, 0, &error);
if (error == NULL && dir != NULL) {
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;
}
}
/* 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;
}
dir = NULL;
}
- ms_insert_folder_end(handle, uid);
+ ms_insert_folder_end(uid);
MS_SAFE_FREE(current_path);
}
}
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) {
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);
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");
}
/*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);
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);
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;
}
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;
}
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);
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);
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);
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");
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;
}
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);
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);
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 */
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");
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