int ms_cleanup_db(sqlite3 *handle, uid_t uid);
int ms_validate_item(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
int ms_insert_item_batch(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
-int ms_validity_change_all_items(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, bool validity, uid_t uid);
+int ms_validity_change_all_items(sqlite3 *handle, const char *storage_id, bool validity, uid_t uid);
bool ms_delete_invalid_items(sqlite3 *handle, const char *storage_id, uid_t uid);
int ms_set_folder_item_validity(sqlite3 *handle, const char *storage_id, const char *path, int validity, int recursive, uid_t uid);
int ms_delete_invalid_items_in_folder(sqlite3 *handle, const char *storage_id, const char *path, bool is_recursive, uid_t uid);
int ms_set_storage_scan_status(sqlite3 *handle, char *storage_id, media_scan_status_e scan_status, uid_t uid);
int ms_get_storage_list(sqlite3 *handle, GArray **storage_array);
int ms_insert_folder(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
-int ms_delete_invalid_folder(const char *storage_id, int storage_type, uid_t uid);
+int ms_delete_invalid_folder(const char *storage_id, uid_t uid);
int ms_set_folder_validity(sqlite3 *handle, const char *storage_id, const char *start_path, int validity, bool is_recursive, uid_t uid);
int ms_scan_item_batch(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
int ms_scan_validate_item(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
return ret;
}
-bool __ms_check_storage_type(ms_user_storage_type_e storage_type)
-{
- if ((storage_type != MS_USER_STORAGE_INTERNAL)
- && (storage_type != MS_USER_STORAGE_EXTERNAL)
- && (storage_type != MS_USER_STORAGE_EXTERNAL_USB)) {
- MS_DBG_ERR("storage type is incorrect[%d]", storage_type);
- return FALSE;
- }
-
- return TRUE;
-}
-
-int ms_validity_change_all_items(sqlite3 *handle, const char *storage_id, ms_user_storage_type_e storage_type, bool validity , uid_t uid)
+int ms_validity_change_all_items(sqlite3 *handle, const char *storage_id, bool validity , uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
MS_DBG_RETVM_IF(!MS_STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
- MS_DBG_RETVM_IF(__ms_check_storage_type(storage_type) != TRUE, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
- char *sql = sqlite3_mprintf("UPDATE '%q' SET validity=%d WHERE storage_type=%d;", storage_id, validity, storage_type);
+ char *sql = sqlite3_mprintf("UPDATE '%q' SET validity=%d;", storage_id, validity);
ret = media_db_request_update_db(sql, uid);
MS_SQLITE3_SAFE_FREE(sql);
return ret;
}
-int ms_delete_invalid_folder(const char *storage_id, int storage_type, uid_t uid)
+int ms_delete_invalid_folder(const char *storage_id, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
char *sql = NULL;
MS_DBG_RETVM_IF(!MS_STRING_VALID(storage_id), MS_MEDIA_ERR_INVALID_PARAMETER, "storage_id is NULL");
- MS_DBG_RETVM_IF(__ms_check_storage_type(storage_type) != TRUE, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage_type");
- sql = sqlite3_mprintf("DELETE FROM folder WHERE storage_uuid = '%q' AND storage_type = %d AND validity = 0;", storage_id, storage_type);
+ sql = sqlite3_mprintf("DELETE FROM folder WHERE storage_uuid='%q' AND validity=0;", storage_id);
ret = media_db_request_update_db(sql, 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(scan_data->storage_id, storage_type, uid);
+ ms_delete_invalid_folder(scan_data->storage_id, uid);
ms_delete_invalid_items(handle, scan_data->storage_id, uid);
}
int scan_type;
int err = MS_MEDIA_ERR_NONE;
char *start_path = NULL;
- ms_user_storage_type_e storage_type;
-
- err = ms_user_get_storage_type(scan_data->uid, scan_data->msg, &storage_type);
- MS_DBG_RETVM_IF(err != MS_MEDIA_ERR_NONE, err, "Fail to get storage type");
scan_type = scan_data->msg_type;
start_path = g_strdup(scan_data->msg);
} else {
MS_DBG_INFO("INVALID");
- err = ms_validity_change_all_items(handle, storage_id, storage_type, false, scan_data->uid);
+ err = ms_validity_change_all_items(handle, storage_id, false, scan_data->uid);
if (err != MS_MEDIA_ERR_NONE)
MS_DBG_ERR("error : %d", err);
if (!ms_delete_invalid_items(handle, storage_id, scan_data->uid))
MS_DBG_ERR("deleting invalid items in storage failed");
- if (ms_delete_invalid_folder(storage_id, storage_type, scan_data->uid) != MS_MEDIA_ERR_NONE)
+ if (ms_delete_invalid_folder(storage_id, 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_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 = ms_validity_change_all_items(handle, storage_id, false, scan_data->uid);
if (ret != MS_MEDIA_ERR_NONE) {
MS_DBG_ERR("ms_validity_change_all_items failed");
goto NEXT;
if (!ms_delete_invalid_items(handle, storage_id, scan_data->uid))
MS_DBG_ERR("deleting invalid items in storage failed");
- if (ms_delete_invalid_folder(storage_id, storage_type, scan_data->uid) != MS_MEDIA_ERR_NONE)
+ if (ms_delete_invalid_folder(storage_id, scan_data->uid) != MS_MEDIA_ERR_NONE)
MS_DBG_ERR("deleting invalid folders in storage failed");
}
MS_DBG_WARN("init storage data in DB");
/* update storage_id table set validity=0 first */
- ms_validity_change_all_items(handle, mount_uuid, MS_USER_STORAGE_EXTERNAL_USB, false, uid);
+ ms_validity_change_all_items(handle, mount_uuid, false, uid);
/*update folder table set validity = 0*/
ms_set_folder_validity(handle, mount_uuid, storage_path, MS_INVALID, TRUE, uid);
/* update folder table set scan_status=0 first */
}
/* update storage_id table set validity=0 first */
- ms_validity_change_all_items(handle, storage_id, MS_USER_STORAGE_EXTERNAL_USB, false, uid);
+ ms_validity_change_all_items(handle, storage_id, false, uid);
/* update folder table set validity=0 first */
ms_set_folder_validity(handle, storage_id, mount_path, MS_INVALID, TRUE, uid);
/* update folder table set scan_status=0 first */
ms_set_storage_validity(handle, device_id, 0, uid);
/* update storage_id table set validity=0 first */
- if (ms_validity_change_all_items(handle, device_id, MS_USER_STORAGE_EXTERNAL_USB, false, uid) != MS_MEDIA_ERR_NONE)
+ if (ms_validity_change_all_items(handle, device_id, false, uid) != MS_MEDIA_ERR_NONE)
MS_DBG_ERR("ms_validity_change_all_items failed");
/* folder validity set 0 under the start_path in folder table*/
if (ms_set_folder_validity(handle, device_id, mount_path, MS_INVALID, TRUE, uid) != MS_MEDIA_ERR_NONE)
ms_set_storage_validity(handle, storage_id, 1, uid);
/* update storage_id table set validity=0 first */
- ms_validity_change_all_items(handle, storage_id, MS_USER_STORAGE_EXTERNAL_USB, false, uid);
+ ms_validity_change_all_items(handle, storage_id, false, uid);
ms_set_folder_validity(handle, storage_id, mounted_path, MS_INVALID, TRUE, uid);
/* update folder table set scan_status=0 first */
ms_set_folder_scan_status(handle, storage_id, NULL, MS_DIR_SCAN_NONE, uid);
MS_DBG_WARN("init storage data in DB");
/* update storage_id table set validity=0 first */
- ms_validity_change_all_items(handle, DATADISC_STORAGE_ID, MS_USER_STORAGE_EXTERNAL_USB, false, uid);
+ ms_validity_change_all_items(handle, DATADISC_STORAGE_ID, false, uid);
/*update folder table set validity = 0*/
ms_set_folder_validity(handle, DATADISC_STORAGE_ID, mnt_path, MS_INVALID, TRUE, uid);
/* update folder table set scan_status=0 first */
MS_DBG_WARN("[DISC REMOVED]");
ms_set_storage_validity(handle, DATADISC_STORAGE_ID, 0, uid);
/*set media validaty to 0 first, then set folder validaty to 0*/
- ms_validity_change_all_items(handle, DATADISC_STORAGE_ID, MS_USER_STORAGE_EXTERNAL_USB, false, uid);
+ ms_validity_change_all_items(handle, DATADISC_STORAGE_ID, false, uid);
ms_set_folder_validity(handle, DATADISC_STORAGE_ID, mnt_path, false, true, uid);
}
MS_DBG_WARN("init storage data in DB");
/* update storage_id table set validity=0 first */
- ms_validity_change_all_items(handle, DATADISC_STORAGE_ID, MS_USER_STORAGE_EXTERNAL_USB, false, uid);
+ ms_validity_change_all_items(handle, DATADISC_STORAGE_ID, false, uid);
/*update folder table set validity = 0*/
ms_set_folder_validity(handle, DATADISC_STORAGE_ID, mnt_path, MS_INVALID, TRUE, uid);
/* update folder table set scan_status=0 first */
if (validity == 0) {
ms_set_storage_validity(handle, storage_id, 1, uid);
/* update storage_id table set validity=0 first */
- ms_validity_change_all_items(handle, storage_id, MS_USER_STORAGE_EXTERNAL_USB, false, uid);
+ ms_validity_change_all_items(handle, storage_id, false, uid);
ms_set_folder_validity(handle, storage_id, storage_path, MS_INVALID, TRUE, uid);
/* update folder table set scan_status=0 first */
ms_set_folder_scan_status(handle, storage_id, NULL, MS_DIR_SCAN_NONE, uid);