int msc_push_scan_request(ms_scan_type_e scan_type, ms_comm_msg_s *recv_msg);
void msc_send_power_off_request(void);
void msc_remove_dir_scan_request(ms_comm_msg_s *recv_msg);
+void msc_remove_storage_scan_request(const char *path);
#endif /*_MEDIA_SCANNER_SCAN_V2_H_*/
if (!ms_config_get_int(VCONFKEY_FILEMANAGER_DB_STATUS, &status))
MS_DBG_ERR("ms_config_get_int[VCONFKEY_FILEMANAGER_DB_STATUS]");
- if (!(g_async_queue_length(storage_queue2) == 0 && status == VCONFKEY_FILEMANAGER_DB_UPDATED))
+ if (!(g_async_queue_length(storage_queue2) == 0 && status == VCONFKEY_FILEMANAGER_DB_UPDATED)) {
+ msc_remove_storage_scan_request(mount_path);
msc_set_blocked_path(mount_path);
+ }
if (g_directory_scan_processing2 != 0) {
MS_DBG_WARN("Doing directory scanning. Set cancel path");
g_mutex_unlock(&scan_req_mutex2);
MS_DBG_WARN("scan_req_mutex2 is UNLOCKED");
}
+
+void msc_remove_storage_scan_request(const char *path)
+{
+ int items_to_find = 0;
+ ms_comm_msg_s *msg = NULL;
+
+ MS_DBG_INFO("Removing path [%s] from storage queue. Acquiring lock.", path);
+ g_async_queue_lock(storage_queue2);
+ MS_DBG_INFO("storage_queue2 LOCKED");
+
+ items_to_find = g_async_queue_length_unlocked(storage_queue2);
+
+ MS_DBG_INFO("storage_queue2 has %d items", items_to_find);
+ while (items_to_find-- > 0) {
+ msg = g_async_queue_pop_unlocked(storage_queue2);
+ if ((msg->msg_type == MS_MSG_STORAGE_PARTIAL || msg->msg_type == MS_MSG_STORAGE_ALL) && (g_strcmp0(msg->msg, path) == 0)) {
+ MS_DBG_WARN("Removing storage request [%s]", path);
+ g_free(msg);
+ } else {
+ g_async_queue_push_unlocked(storage_queue2, msg);
+ }
+ }
+
+ MS_DBG_INFO("Remove storage scan request done");
+
+ g_async_queue_unlock(storage_queue2);
+ MS_DBG_INFO("storage_queue2 UNLOCKED");
+}