static void __msc_bacth_commit_enable(void* handle, bool ins_status, bool valid_status, bool noti_enable, int pid);
static void __msc_bacth_commit_disable(void* handle, bool ins_status, bool valid_status, int result, uid_t uid);
static int __msc_dir_scan_for_folder(void **handle, const char *storage_id, const char*start_path, ms_storage_type_t storage_type, int scan_type, int pid, uid_t uid);
-static int __msc_dir_scan_for_storage(void **handle, const char *storage_id, const char*start_path, ms_storage_type_t storage_type, int scan_type, int pid, uid_t uid);
+static int __msc_dir_scan_for_storage(void **handle, const char *storage_id, const char*start_path, ms_storage_type_t storage_type, int scan_type, uid_t uid);
static bool __msc_storage_mount_status(const char* start_path);
static char* __msc_get_path(uid_t uid);
return ret;
}
-static int __msc_dir_scan_for_storage(void **handle, const char *storage_id, const char*start_path, ms_storage_type_t storage_type, int scan_type, int pid, uid_t uid)
+static int __msc_dir_scan_for_storage(void **handle, const char *storage_id, const char*start_path, ms_storage_type_t storage_type, int scan_type, uid_t uid)
{
GArray *dir_array = NULL;
int ret = MS_MEDIA_ERR_NONE;
if (scan_type == MS_MSG_DIRECTORY_SCANNING || scan_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) {
err = __msc_dir_scan_for_folder(handle, storage_id, start_path, storage_type, scan_type, scan_data->pid, scan_data->uid);
} else if (scan_type == MS_MSG_STORAGE_ALL || scan_type == MS_MSG_STORAGE_PARTIAL) {
- err = __msc_dir_scan_for_storage(handle, storage_id, start_path, storage_type, scan_type, scan_data->pid, scan_data->uid);
+ err = __msc_dir_scan_for_storage(handle, storage_id, start_path, storage_type, scan_type, scan_data->uid);
}
if (err != MS_MEDIA_ERR_NONE) {
goto NEXT;
}
- /*connect to media db, if conneting is failed, db updating is stopped*/
+ /*connect to media db, if connecting is failed, db updating is stopped*/
err = ms_connect_db(&handle, scan_data->uid);
if (err != MS_MEDIA_ERR_NONE)
continue;
{
ms_comm_msg_s *scan_data = data;
int ret = MS_MEDIA_ERR_NONE;
+ int idx = 0;
void **handle = NULL;
char *start_path = NULL;
ms_storage_type_t storage_type = MS_STORAGE_INTERNAL;
+ GArray *storage_list = NULL;
+ ms_stg_info_s *stg_info = NULL;
MS_DBG_INFO("META UPDATE START");
}
}
- /*FIX ME*/
/*__msc_dir_scan_meta_update For Each USB Storage*/
+ ret = ms_get_storage_list(handle, &storage_list);
+ if (ret != MS_MEDIA_ERR_NONE) {
+ MS_DBG_ERR("ms_get_storage_list() fail");
+ if (handle) ms_disconnect_db(&handle);
+ return MS_MEDIA_ERR_INTERNAL;
+ }
+
+ for (idx = 0; idx < storage_list->len; idx++) {
+ stg_info = g_array_index(storage_list, ms_stg_info_s *, idx);
+
+ /* Check power off status.. storage list vacating for g_array_free.. */
+ if (power_off) {
+ MS_SAFE_FREE(stg_info->stg_path);
+ MS_SAFE_FREE(stg_info->storage_id);
+ MS_SAFE_FREE(stg_info);
+ MS_DBG_WARN("power off");
+ continue;
+ }
+
+ ret = __msc_dir_scan_meta_update(handle, stg_info->stg_path, stg_info->storage_id, storage_type, 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);
+
+ MS_SAFE_FREE(stg_info->stg_path);
+ MS_SAFE_FREE(stg_info->storage_id);
+ MS_SAFE_FREE(stg_info);
+ }
+
+ g_array_free(storage_list, FALSE);
/*call for bundle commit*/
ms_update_end(handle, scan_data->uid);