'ms_send_storage_otg_scan_request' and 'ms_send_storage_scan_request' are the same function.
merged with 'ms_send_storage_scan_request'.
Change-Id: I0bc6c553d7daa737d8f6a9ccaaf493a09b1d7337
Signed-off-by: Minje Ahn <minje.ahn@samsung.com>
Name: media-server
Summary: A server for media content management
-Version: 0.5.11
+Version: 0.5.12
Release: 0
Group: Multimedia/Service
License: Apache-2.0
gboolean ms_read_scanner_dispatcher_socket_func(GIOChannel *src, GIOCondition condition, gpointer user_data);
gboolean ms_read_db_update_socket_func(GIOChannel *src, GIOCondition condition, gpointer data);
int ms_send_scan_request(ms_comm_msg_s *send_msg, int client_sock);
-int ms_send_storage_scan_request(const char *root_path, const char *storage_id, ms_dir_scan_type_t scan_type, uid_t uid);
gboolean ms_receive_message_from_scanner(GIOChannel *src, GIOCondition condition, gpointer data);
void ms_remove_request_owner(int pid, const char *req_path);
-int ms_send_storage_otg_scan_request(const char *path, const char *device_uuid, ms_dir_scan_type_t scan_type, uid_t uid);
+int ms_send_storage_scan_request(const char *path, const char *storage_id, ms_dir_scan_type_t scan_type, uid_t uid);
void ms_reset_ownerlist(void);
#endif /*_MEDIA_SERVER_SOCKET_H_*/
}
/* request to update media db */
- ms_send_storage_otg_scan_request(mount_path, mount_uuid, scan_type, uid);
+ ms_send_storage_scan_request(mount_path, mount_uuid, scan_type, uid);
}
ERROR:
sqlite3 *handle = NULL;
uid_t uid = ms_sys_get_uid();
- if (mount_path != NULL && mount_uuid != NULL) {
+ if (mount_path && mount_uuid) {
ms_connect_db(&handle, uid);
ms_set_storage_validity(handle, mount_uuid, 0, uid);
- ms_send_storage_otg_scan_request(mount_path, mount_uuid, MS_SCAN_INVALID, uid);
+ ms_send_storage_scan_request(mount_path, mount_uuid, MS_SCAN_INVALID, uid);
ms_disconnect_db(handle);
- } else if (mount_path != NULL && g_strcmp0(mount_path, STORAGE_REMOVED) == 0) {
+ } else if (mount_path && g_strcmp0(mount_path, STORAGE_REMOVED) == 0) {
ms_connect_db(&handle, uid);
ms_set_all_storage_validity(handle, 0, uid);
ms_set_folder_scan_status(handle, storage_id, NULL, MS_DIR_SCAN_NONE, uid);
/* request to update media db */
- ms_send_storage_otg_scan_request(mount_path, storage_id, scan_type, uid);
+ ms_send_storage_scan_request(mount_path, storage_id, scan_type, uid);
}
ERROR:
if (ms_get_scanner_status()) {
/*If the media scanner is running, the removed USB can be queueing in the job list.*/
/*So try to remove it.*/
- ms_send_storage_otg_scan_request(mount_path, device_id, MS_SCAN_INVALID, uid);
+ ms_send_storage_scan_request(mount_path, device_id, MS_SCAN_INVALID, uid);
}
media_db_update_send(getpid(), MS_MEDIA_ITEM_STORAGE, MS_MEDIA_ITEM_UPDATE, mount_path, device_id, 0, PROD_CUSTOM_MIME_REMOVED);
if (ret != MS_MEDIA_ERR_NONE)
MS_DBG_ERR("error : ms_insert_folder failed");
- ms_send_storage_otg_scan_request(mounted_path, storage_id, scan_type, uid);
+ ms_send_storage_scan_request(mounted_path, storage_id, scan_type, uid);
g_free(storage_id);
storage_id = NULL;
}
return ret;
}
-int ms_send_storage_scan_request(const char *root_path, const char *storage_id, ms_dir_scan_type_t scan_type, uid_t uid)
-{
- ms_comm_msg_s scan_msg = {0, };
- MS_DBG_RETVM_IF(uid == 0, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid UID");
-
- memset(&scan_msg, 0, sizeof(scan_msg));
-
- /* msg_type */
- switch (scan_type) {
- case MS_SCAN_PART:
- scan_msg.msg_type = MS_MSG_STORAGE_PARTIAL;
- break;
- case MS_SCAN_ALL:
- scan_msg.msg_type = MS_MSG_STORAGE_ALL;
- break;
- case MS_SCAN_INVALID:
- scan_msg.msg_type = MS_MSG_STORAGE_INVALID;
- break;
- default:
- MS_DBG_ERR("Invalid scan type");
- return MS_MEDIA_ERR_INVALID_PARAMETER;
- }
-
- if (root_path != NULL)
- g_strlcpy(scan_msg.msg, root_path, sizeof(scan_msg.msg));
-
- if (storage_id != NULL)
- g_strlcpy(scan_msg.storage_id, storage_id, sizeof(scan_msg.storage_id));
-
- scan_msg.uid = uid;
-
- return ms_send_scan_request(&scan_msg, -1);
-}
-
gboolean ms_read_db_update_socket_func(GIOChannel *src, GIOCondition condition, gpointer data)
{
int sock = -1;
__ms_delete_owner(pid, req_path);
}
-int ms_send_storage_otg_scan_request(const char *path, const char *device_uuid, ms_dir_scan_type_t scan_type, uid_t uid)
+int ms_send_storage_scan_request(const char *path, const char *storage_id, ms_dir_scan_type_t scan_type, uid_t uid)
{
ms_comm_msg_s scan_msg = { 0, };
MS_DBG_RETVM_IF(!path, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid path");
- MS_DBG_RETVM_IF(!device_uuid, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid device_uuid");
+ MS_DBG_RETVM_IF(!storage_id, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid storage id");
MS_DBG_RETVM_IF(uid == 0, MS_MEDIA_ERR_INVALID_PARAMETER, "Invalid UID");
- memset(&scan_msg, 0, sizeof(scan_msg));
-
switch (scan_type) {
case MS_SCAN_PART:
scan_msg.msg_type = MS_MSG_STORAGE_PARTIAL;
}
g_strlcpy(scan_msg.msg, path, sizeof(scan_msg.msg));
- g_strlcpy(scan_msg.storage_id, device_uuid, sizeof(scan_msg.storage_id));
+ g_strlcpy(scan_msg.storage_id, storage_id, sizeof(scan_msg.storage_id));
scan_msg.uid = uid;
return ms_send_scan_request(&scan_msg, -1);