struct linux_dirent *d;
int bpos = 0;
int scan_count = 0;
+ int sleep_count = 0;
const char *trash = "$RECYCLE.BIN";
ms_insert_folder_start(handle);
ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_PROCESSING, uid);
+ sleep_count = 0;
fd = open(current_path, O_RDONLY | O_DIRECTORY);
if (fd == -1) {
break;
for (bpos = 0; bpos < nread;) {
+ sleep_count++;
+ if (sleep_count % 5 == 0) {
+ sleep_count = 0;
+ usleep(SCAN_SLEEP_TIME);
+ }
/*check poweroff status*/
ret = __msc_check_stop_status(scan_type, new_start_path, pid);
if (ret != MS_MEDIA_ERR_NONE) {
if (d->d_name[0] == '.') {
bpos += d->d_reclen;
- usleep(SCAN_SLEEP_TIME);
continue;
}
if (strcmp(d->d_name, trash) == 0) {
MS_DBG_ERR("trash directory");
bpos += d->d_reclen;
- usleep(SCAN_SLEEP_TIME);
continue;
}
if (ms_strappend(path, sizeof(path), "%s/%s", current_path, d->d_name) != MS_MEDIA_ERR_NONE) {
MS_DBG_ERR("ms_strappend failed");
bpos += d->d_reclen;
- usleep(SCAN_SLEEP_TIME);
continue;
}
if (d->d_type == DT_REG) {
if (!ms_check_support_media_type(handle, path)) {
bpos += d->d_reclen;
- usleep(SCAN_SLEEP_TIME);
continue;
}
MS_DBG_ERR("I/O ERROR COUNT[%d]", io_err_folder++);
bpos += d->d_reclen;
- usleep(SCAN_SLEEP_TIME);
continue;
} else {
++scan_count;
if (ms_insert_folder(handle, storage_id, path, uid) != MS_MEDIA_ERR_NONE) {
MS_DBG_ERR("insert folder failed");
bpos += d->d_reclen;
- usleep(SCAN_SLEEP_TIME);
continue;
}
}
}
bpos += d->d_reclen;
- usleep(SCAN_SLEEP_TIME);
}
/*update modifiec type for the internal storage*/
if (scan_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) {
else
ms_update_folder_time(handle, storage_id, current_path, uid);
}
- usleep(SCAN_SLEEP_TIME);
}
ms_insert_folder_end(handle, uid);
struct linux_dirent *d;
int bpos = 0;
int scan_count = 0;
+ int sleep_count = 0;
const char *trash = "$RECYCLE.BIN";
ms_insert_folder_start(handle);
ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_PROCESSING, uid);
+ sleep_count = 0;
fd = open(current_path, O_RDONLY | O_DIRECTORY);
if (fd == -1) {
break;
for (bpos = 0; bpos < nread;) {
+ sleep_count++;
+ if (sleep_count % 5 == 0) {
+ sleep_count = 0;
+ usleep(SCAN_SLEEP_TIME);
+ }
/*check poweroff status*/
ret = __msc_check_stop_status(scan_type, new_start_path, pid);
if (ret != MS_MEDIA_ERR_NONE)
if (strcmp(d->d_name, trash) == 0) {
MS_DBG_ERR("trash directory");
bpos += d->d_reclen;
- usleep(SCAN_SLEEP_TIME);
continue;
}
if (ms_strappend(path, sizeof(path), "%s/%s", current_path, d->d_name) != MS_MEDIA_ERR_NONE) {
MS_DBG_ERR("ms_strappend failed");
bpos += d->d_reclen;
- usleep(SCAN_SLEEP_TIME);
continue;
}
/* check media type */
if (!ms_check_support_media_type(handle, path)) {
bpos += d->d_reclen;
- usleep(SCAN_SLEEP_TIME);
continue;
}
MS_DBG_ERR("I/O ERROR COUNT[%d]", io_err_storage++);
bpos += d->d_reclen;
- usleep(SCAN_SLEEP_TIME);
continue;
} else {
++scan_count;
}
bpos += d->d_reclen;
- usleep(SCAN_SLEEP_TIME);
}
- usleep(SCAN_SLEEP_TIME);
}
ms_insert_folder_end(handle, uid);
}*/
SCAN_DONE:
+ MS_DBG_WARN("storage_id = [%s], dir Path = [%s], pid = [%d]", storage_id, scan_data->msg, scan_data->pid);
if (ret != MS_MEDIA_ERR_SCANNER_FORCE_STOP) {
if (noti_type == MS_ITEM_DELETE) {
- MS_DBG_WARN("storage_id = [%s], dir Path = [%s], folder_uuid = [%s], noti_type = [%d]", storage_id, scan_data->msg, folder_uuid, noti_type);
ms_send_dir_update_noti(handle, storage_id, scan_data->msg, folder_uuid, noti_type, scan_data->pid);
}
msc_insert_exactor_request(scan_data->msg_type, TRUE, scan_data->storage_id, scan_data->msg, scan_data->pid, uid, noti_type);
MS_SAFE_FREE(file_path);
MS_SAFE_FREE(register_data);
+ usleep(SCAN_SLEEP_TIME);
} /*thread while*/
_POWEROFF: