1. Remove plugin APIs that are no longer used.
2. Remove unnecessary parameters.
Change-Id: I26b403d74c2194479af6369c3b7b13346840b728
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
} ms_noti_type_e;
typedef int (*CLEANUP_DB)(sqlite3*, uid_t);
-typedef int (*INSERT_ITEM_BEGIN)(int, bool, int);
+typedef int (*INSERT_ITEM_BEGIN)(bool, 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)(const char *, const char *, int, int);
typedef int (*INSERT_ITEM)(sqlite3 *, const char *, const char *, int, uid_t);
/* FOR BULK COMMIT */
void ms_register_start(bool noti_status, int pid);
void ms_register_end(uid_t uid);
-void ms_validate_start(void);
-void ms_validate_end(uid_t uid);
int ms_get_extract_list(sqlite3 *handle, const char* storage_id, int storage_type, int scan_type, const char* path, int is_end, uid_t uid, void* array);
int ms_update_one_extract_item(sqlite3 *handle, const char* storage_id, int storage_type, void* data);
int ms_query_do_update_list(sqlite3 *handle);
-void ms_batch_commit_enable(bool ins_status, bool valid_status, bool noti_enable, int pid);
-void ms_batch_commit_disable(bool ins_status, bool valid_status, uid_t uid);
+void ms_batch_commit_enable(bool noti_enable, int pid);
+void ms_batch_commit_disable(uid_t uid);
#endif /*_MEDIA_COMMON_DB_SVC_H_*/
#include <tzplatform_config.h>
#define CONFIG_PATH PATH_LIBDIR"/libmedia-content-plugin.so"
-#define MSC_REGISTER_COUNT 300 /*For bundle commit*/
-#define MSC_VALID_COUNT 300 /*For bundle commit*/
static GMutex db_mutex;
static void **func_array;
eINSERT_END,
eINSERT_BATCH,
eINSERT_SCAN,
- eSET_VALIDITY_BEGIN,
- eSET_VALIDITY_END,
eSET_VALIDITY,
eDELETE_FOLDER,
eSEND_DIR_UPDATE_NOTI,
"insert_item_end",
"insert_item",
"insert_item_scan",
- "set_item_validity_begin",
- "set_item_validity_end",
"set_item_validity",
"delete_all_invalid_items_in_folder",
"send_dir_update_noti",
{
int ret = MS_MEDIA_ERR_NONE;
- ret = ((INSERT_ITEM_BEGIN)func_array[eINSERT_BEGIN])(MSC_REGISTER_COUNT, noti_status, pid);/*dlopen*/
+ ret = ((INSERT_ITEM_BEGIN)func_array[eINSERT_BEGIN])(noti_status, pid);/*dlopen*/
if (ret != MS_MEDIA_ERR_NONE)
MS_DBG_ERR("INSERT_ITEM_BEGIN failed [%d]", ret);
}
MS_DBG_ERR("INSERT_ITEM_END failed [%d]", ret);
}
-void ms_validate_start(void)
-{
- int ret = MS_MEDIA_ERR_NONE;
-
- ret = ((SET_ITEM_VALIDITY_BEGIN)func_array[eSET_VALIDITY_BEGIN])(MSC_VALID_COUNT);/*dlopen*/
- if (ret != MS_MEDIA_ERR_NONE)
- MS_DBG_ERR("SET_ITEM_VALIDITY_BEGIN failed [%d]", ret);
-}
-
-void ms_validate_end(uid_t uid)
-{
- int ret = MS_MEDIA_ERR_NONE;
-
- ret = ((SET_ITEM_VALIDITY_END)func_array[eSET_VALIDITY_END])(uid);/*dlopen*/
- if (ret != MS_MEDIA_ERR_NONE)
- MS_DBG_ERR("SET_ITEM_VALIDITY_END failed [%d]", ret);
-}
-
int ms_get_folder_scan_status(sqlite3 *handle, const char *storage_id, const char *path, int *scan_status)
{
int ret = MS_MEDIA_ERR_NONE;
return true;
}
-void ms_batch_commit_enable(bool ins_status, bool valid_status, bool noti_enable, int pid)
+void ms_batch_commit_enable(bool noti_enable, int pid)
{
/*call for bundle commit*/
- if (ins_status)
- ms_register_start(noti_enable, pid);
-
- if (valid_status)
- ms_validate_start();
+ ms_register_start(noti_enable, pid);
}
-void ms_batch_commit_disable(bool ins_status, bool valid_status, uid_t uid)
+void ms_batch_commit_disable(uid_t uid)
{
- /*call for bundle commit*/
- if (valid_status)
- ms_validate_end(uid);
-
- if (ins_status)
- ms_register_end(uid);
+ ms_register_end(uid);
}
goto STOP_SCAN;
}
- ms_batch_commit_disable(true, true, uid);
- ms_batch_commit_enable(true, true, false, pid);
+ ms_batch_commit_disable(uid);
+ ms_batch_commit_enable(false, pid);
/* get the current path from directory array */
current_path = g_array_index(dir_array , char*, 0);
g_array_remove_index(dir_array, 0);
__msc_clear_file_list(dir_array);
- ms_batch_commit_disable(true, true, uid);
+ ms_batch_commit_disable(uid);
if (ret != MS_MEDIA_ERR_NONE) MS_DBG_INFO("ret : %d", ret);
scan_function = (scan_type == MS_MSG_STORAGE_ALL) ? ms_scan_item_batch : ms_scan_validate_item;
- ms_batch_commit_disable(true, true, uid);
+ ms_batch_commit_disable(uid);
/*start db update. the number of element in the array , db update is complete.*/
while (dir_array->len != 0) {
/*check poweroff status*/
if (ret != MS_MEDIA_ERR_NONE)
goto STOP_SCAN;
- /*ms_batch_commit_disable(true, true, uid);*/
- ms_batch_commit_enable(true, true, false, pid);
+ /*ms_batch_commit_disable(uid);*/
+ ms_batch_commit_enable(false, pid);
/* get the current path from directory array */
current_path = g_array_index(dir_array , char*, 0);
}
/*commit to db before set scan done, fix timing issue storage scan, then folder scan for same folder*/
- ms_batch_commit_disable(true, true, uid);
+ ms_batch_commit_disable(uid);
ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_DONE, uid);
if (fd != -1) {
__msc_set_storage_scan_cur_path(NULL);
__msc_clear_file_list(dir_array);
- ms_batch_commit_disable(true, true, uid);
+ ms_batch_commit_disable(uid);
if (ret != MS_MEDIA_ERR_NONE) MS_DBG_INFO("ret : %d", ret);
MS_DBG_ERR("error : %d", err);
/*call for bundle commit*/
- ms_batch_commit_enable(true, true, false, 0);
+ ms_batch_commit_enable(false, 0);
/*insert data into media db */
ret = __msc_db_update(handle, storage_id, scan_data);
/*call for bundle commit*/
- ms_batch_commit_disable(true, true, uid);
+ ms_batch_commit_disable(uid);
MS_DBG_WARN("folder scan done, sent cb event path = [%.*s]", MAX_MSG_SIZE, scan_data->msg);
__msc_call_dir_scan_cb();
sqlite3 *handle = NULL;
ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
int scan_type;
- bool valid_status = true;
char *update_path = NULL;
uid_t uid = MEDIA_DEFAULT_UID;
/*start db updating */
ms_set_db_status(MS_DB_UPDATING, storage_type);
- valid_status = (scan_type == MS_MSG_STORAGE_PARTIAL || MS_MSG_STORAGE_ALL == scan_type) ? true : false;
-
if (scan_type != MS_MSG_STORAGE_INVALID)
- ms_batch_commit_enable(true, valid_status, false, 0);
+ ms_batch_commit_enable(false, 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_batch_commit_disable(true, valid_status, uid);
+ ms_batch_commit_disable(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*/
/*start db updating */
/*call for bundle commit*/
- ms_batch_commit_enable(true, false, true, pid);
+ ms_batch_commit_enable(true, pid);
MS_DBG_WARN("BULK REGISTER START");
}
/*call for bundle commit*/
- ms_batch_commit_disable(true, false, uid);
+ ms_batch_commit_disable(uid);
/*disconnect form media db*/
if (handle) ms_disconnect_db(handle);
start_path = g_strdup(scan_data->msg);
- ms_batch_commit_enable(true, true, false, 0);
+ ms_batch_commit_enable(false, 0);
ret = __msc_dir_scan(handle, scan_data->storage_id, start_path, false, is_recursive, scan_data->uid);
- ms_batch_commit_disable(true, true, scan_data->uid);
+ ms_batch_commit_disable(scan_data->uid);
if (ret != MS_MEDIA_ERR_SCANNER_FORCE_STOP) {
MS_DBG_INFO("working normally");
return ret;
}
- ms_batch_commit_enable(true, true, false, 0);
+ ms_batch_commit_enable(false, 0);
ret = __msc_dir_scan(handle, scan_data->storage_id, start_path, true, is_recursive, scan_data->uid);
- ms_batch_commit_disable(true, true, scan_data->uid);
+ ms_batch_commit_disable(scan_data->uid);
if (ms_delete_invalid_items(handle, scan_data->storage_id, scan_data->uid) != MS_MEDIA_ERR_NONE)
MS_DBG_ERR("deleting invalid items in storage failed");
return ret;
}
- ms_batch_commit_enable(true, true, false, 0);
+ ms_batch_commit_enable(false, 0);
ret = __msc_db_update(handle, scan_data->storage_id, scan_data);
- ms_batch_commit_disable(true, true, scan_data->uid);
+ ms_batch_commit_disable(scan_data->uid);
if (ms_delete_invalid_items(handle, scan_data->storage_id, scan_data->uid) != MS_MEDIA_ERR_NONE)
MS_DBG_ERR("deleting invalid items in storage failed");
ms_set_db_status(MS_DB_UPDATING, storage_type);
- ms_batch_commit_enable(true, false, false, 0);
+ ms_batch_commit_enable(false, 0);
ret = __msc_db_update(handle, scan_data->storage_id, scan_data);
- ms_batch_commit_disable(true, false, scan_data->uid);
+ ms_batch_commit_disable(scan_data->uid);
ms_disconnect_db(handle);
ret = ms_connect_db(&handle, uid);
MS_DBG_RETV_IF(ret != MS_MEDIA_ERR_NONE, MS_MEDIA_ERR_DB_INTERNAL);
- ms_batch_commit_enable(true, false, true, pid);
+ ms_batch_commit_enable(true, pid);
for (i = 0; i < path_array->len; i++) {
insert_path = g_ptr_array_index(path_array, i);
}
/*call for bundle commit*/
- ms_batch_commit_disable(true, false, uid);
+ ms_batch_commit_disable(uid);
ms_disconnect_db(handle);
return ret;