int ms_validate_item(void **handle, const char *storage_id, const char *path, uid_t uid);
int ms_insert_item_batch(void **handle, const char *storage_id, const char *path, uid_t uid);
int ms_insert_burst_item(void **handle, const char *storage_id, const char *path, uid_t uid);
-bool ms_delete_all_items(void **handle, const char *storage_id, ms_storage_type_t storage_type, uid_t uid);
-int ms_validaty_change_all_items(void **handle, const char *storage_id, ms_storage_type_t storage_type, bool validity, uid_t uid);
-bool ms_delete_invalid_items(void **handle, const char *storage_id, ms_storage_type_t storage_type, uid_t uid);
+bool ms_delete_all_items(void **handle, const char *storage_id, ms_user_storage_type_e storage_type, uid_t uid);
+int ms_validaty_change_all_items(void **handle, const char *storage_id, ms_user_storage_type_e storage_type, bool validity, uid_t uid);
+bool ms_delete_invalid_items(void **handle, const char *storage_id, ms_user_storage_type_e storage_type, uid_t uid);
int ms_set_folder_item_validity(void **handle, const char *storage_id, const char *path, int validity, int recursive, uid_t uid);
int ms_send_dir_update_noti(void **handle, const char *storage_id, const char *path, const char *folder_id, ms_noti_type_e noti_type, int pid);
int ms_update_folder_time(void **handle, const char *storage_id, char *folder_path, uid_t uid);
#define MS_DUMMY_MEDIA_DB_PATH MS_MM_CONF_PATH".media.db"
typedef enum {
- MS_STORAGE_INTERNAL = 0, /**< The device's internal storage */
- MS_STORAGE_EXTERNAL = 1, /**< The device's external storage */
- MS_STORAGE_EXTERNAL_USB = 2, /**< The external USB storage (Since 2.4) */
-} ms_storage_type_t;
-
-typedef enum {
MS_SDCARD_INSERTED, /**< Stored only in phone */
MS_SDCARD_REMOVED, /**< Stored only in MMC */
} ms_sdcard_status_type_t;
#ifndef _MEDIA_SERVER_UTILS_H__
#define _MEDIA_SERVER_UTILS_H__
+#include "media-util.h"
#include "media-common-types.h"
int ms_strappend(char *res, const int size, const char *pattern, const char *str1, const char *str2);
int ms_check_ignore_dir(const char *full_path, uid_t uid);
int ms_check_scan_ignore(char * path);
bool ms_storage_mount_status(const char* start_path);
-int ms_set_db_status(ms_db_status_type_t status, ms_storage_type_t storage_type);
+int ms_set_db_status(ms_db_status_type_t status, ms_user_storage_type_e storage_type);
int ms_set_power_mode(ms_db_status_type_t status);
void ms_trim_dir_path(char *dir_path);
int ms_check_size_mediadb(uid_t uid, double *db_size);
return res;
}
-int ms_validaty_change_all_items(void **handle, const char *storage_id, ms_storage_type_t storage_type, bool validity , uid_t uid)
+int ms_validaty_change_all_items(void **handle, const char *storage_id, ms_user_storage_type_e storage_type, bool validity , uid_t uid)
{
int lib_index;
int res = MS_MEDIA_ERR_NONE;
return res;
}
-bool ms_delete_all_items(void **handle, const char *storage_id, ms_storage_type_t storage_type, uid_t uid)
+bool ms_delete_all_items(void **handle, const char *storage_id, ms_user_storage_type_e storage_type, uid_t uid)
{
int lib_index;
int ret = 0;
return true;
}
-bool ms_delete_invalid_items(void **handle, const char *storage_id, ms_storage_type_t storage_type, uid_t uid)
+bool ms_delete_invalid_items(void **handle, const char *storage_id, ms_user_storage_type_e storage_type, uid_t uid)
{
int lib_index;
int ret;
return ret;
}
-int ms_set_db_status(ms_db_status_type_t status, ms_storage_type_t storage_type)
+int ms_set_db_status(ms_db_status_type_t status, ms_user_storage_type_e storage_type)
{
int res = MS_MEDIA_ERR_NONE;
int err = 0;
MS_DBG_ERR("ms_config_set_int failed");
}
- if (storage_type == MS_STORAGE_EXTERNAL) {
+ if (storage_type == MS_USER_STORAGE_EXTERNAL) {
if (!ms_config_set_int(VCONFKEY_FILEMANAGER_MMC_STATUS, VCONFKEY_FILEMANAGER_MMC_LOADING)) {
res = MS_MEDIA_ERR_VCONF_SET_FAIL;
MS_DBG_ERR("ms_config_set_int failed");
MS_DBG_ERR("ms_config_set_int failed");
}
- if (storage_type == MS_STORAGE_EXTERNAL) {
+ if (storage_type == MS_USER_STORAGE_EXTERNAL) {
if (!ms_config_set_int(VCONFKEY_FILEMANAGER_MMC_STATUS, VCONFKEY_FILEMANAGER_MMC_LOADED)) {
res = MS_MEDIA_ERR_VCONF_SET_FAIL;
MS_DBG_ERR("ms_config_set_int failed");
#define LAST_EVENT 1
#define NORMAL_EVENT 0
-static int __msc_check_extract_stop_status(int scan_type, ms_storage_type_t storage_type, const char *start_path, int pid, bool is_end);
+static int __msc_check_extract_stop_status(int scan_type, ms_user_storage_type_e storage_type, const char *start_path, int pid, bool is_end);
static int __msc_set_storage_extract_status(ms_storage_scan_status_e status);
static int __msc_get_storage_extract_status(ms_storage_scan_status_e *status);
static int __msc_resume_extract();
ms_comm_msg_s *extract_data = NULL;
int ret = MS_MEDIA_ERR_NONE;
void **handle = NULL;
- ms_user_storage_type_e storage_type = MS_STORAGE_INTERNAL;
+ ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
int scan_type;
char *update_path = NULL;
unsigned int io_err_count = 0;
MS_DBG_ERR("ms_user_get_storage_type failed");
goto NEXT;
}
- if (storage_type == MS_STORAGE_EXTERNAL_USB) {
+ if (storage_type == MS_USER_STORAGE_EXTERNAL_USB) {
if (!ms_storage_mount_status(update_path)) {
MS_DBG_ERR("%s is unmounted", update_path);
ret = MS_MEDIA_ERR_USB_UNMOUNTED;
return MS_MEDIA_ERR_NONE;
}
-static int __msc_check_extract_stop_status(int scan_type, ms_storage_type_t storage_type, const char *start_path, int pid, bool is_end)
+static int __msc_check_extract_stop_status(int scan_type, ms_user_storage_type_e storage_type, const char *start_path, int pid, bool is_end)
{
int ret = MS_MEDIA_ERR_NONE;
#define BUF_SIZE 1024
-static int __msc_check_stop_status(int scan_type, ms_storage_type_t storage_type, const char *start_path, int pid);
+static int __msc_check_stop_status(int scan_type, ms_user_storage_type_e storage_type, const char *start_path, int pid);
static int __msc_db_update(void **handle, const char *storage_id, const ms_comm_msg_s * scan_data);
static int __msc_make_file_list(char *file_path, GArray **path_array, uid_t uid);
static int __msc_batch_insert(ms_msg_type_e current_msg, int pid, GArray *path_array, uid_t uid);
static int __msc_pop_register_request(GArray *register_array, ms_comm_msg_s **register_data);
static int __msc_clear_file_list(GArray *path_array);
static void __msc_insert_register_request(GArray *register_array, ms_comm_msg_s *insert_data);
-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_folder(void **handle, const char *storage_id, const char*start_path, ms_user_storage_type_e 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_user_storage_type_e storage_type, int scan_type, int pid, uid_t uid);
static int __msc_get_null_scan_folder_list(void **handle, const char *stroage_id, char *path, GArray *dir_array);
static int __msc_dir_scan_cb();
static int __msc_check_scan_same_path(char *scan_path);
return MS_MEDIA_ERR_NONE;
}
-static int __msc_check_stop_status(int scan_type, ms_storage_type_t storage_type, const char *start_path, int pid)
+static int __msc_check_stop_status(int scan_type, ms_user_storage_type_e storage_type, const char *start_path, int pid)
{
int ret = MS_MEDIA_ERR_NONE;
return ret;
}
-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_folder(void **handle, const char *storage_id, const char*start_path, ms_user_storage_type_e storage_type, int scan_type, int pid, uid_t uid)
{
GArray *dir_array = NULL;
int ret = MS_MEDIA_ERR_NONE;
}
/*update modifiec type for the internal storage*/
if (scan_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) {
- if (storage_type == MS_STORAGE_INTERNAL)
+ if (storage_type == MS_USER_STORAGE_INTERNAL)
ms_update_folder_time(handle, INTERNAL_STORAGE_ID, current_path, uid);
else
ms_update_folder_time(handle, storage_id, current_path, 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_user_storage_type_e storage_type, int scan_type, int pid, uid_t uid)
{
GArray *dir_array = NULL;
int ret = MS_MEDIA_ERR_NONE;
char *storage_id = NULL;
bool modified = FALSE;
int index = 0;
- ms_user_storage_type_e storage_type = MS_STORAGE_INTERNAL;
+ ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
ms_dir_scan_status_e scan_status = MS_DIR_SCAN_NONE;
ms_noti_type_e noti_type = MS_ITEM_INSERT;
char *folder_uuid = NULL;
static int __msc_clear_file_list(GArray *path_array);
-static int __msc_check_stop_status(ms_storage_type_t storage_type)
+static int __msc_check_stop_status(ms_user_storage_type_e storage_type)
{
if (power_off) {
MS_DBG_ERR("Power off");
}
}
-static int __msc_dir_scan(void **handle, const char *storage_id, const char*start_path, ms_storage_type_t storage_type, bool check_exists, bool is_recursive, uid_t uid)
+static int __msc_dir_scan(void **handle, const char *storage_id, const char*start_path, ms_user_storage_type_e storage_type, bool check_exists, bool is_recursive, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
GDir *dir = NULL;
return false;
}
-static int __msc_dir_scan_meta_update(void **handle, const char*start_path, const char *storage_id, ms_storage_type_t storage_type, uid_t uid)
+static int __msc_dir_scan_meta_update(void **handle, const char*start_path, const char *storage_id, ms_user_storage_type_e storage_type, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
GDir *dir = NULL;
int ret = MS_MEDIA_ERR_NONE;
int idx = 0;
void **handle = NULL;
- ms_storage_type_t storage_type = MS_STORAGE_INTERNAL;
+ ms_user_storage_type_e storage_type = MS_USER_STORAGE_INTERNAL;
GArray *storage_list = NULL;
ms_stg_info_s *stg_info = NULL;
char *usr_path = NULL;
MS_DBG_WARN("init storage data in DB");
/* update storage_id table set validity=0 first */
- ms_validaty_change_all_items(handle, mount_uuid, MS_STORAGE_EXTERNAL_USB, false, uid);
+ ms_validaty_change_all_items(handle, mount_uuid, MS_USER_STORAGE_EXTERNAL_USB, 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_validaty_change_all_items(handle, storage_id, MS_STORAGE_EXTERNAL_USB, false, uid);
+ ms_validaty_change_all_items(handle, storage_id, MS_USER_STORAGE_EXTERNAL_USB, 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, storage_id, 1, uid);
/* update storage_id table set validity=0 first */
- ms_validaty_change_all_items(handle, storage_id, MS_STORAGE_EXTERNAL_USB, false, uid);
+ ms_validaty_change_all_items(handle, storage_id, MS_USER_STORAGE_EXTERNAL_USB, 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_validaty_change_all_items(handle, DATADISC_STORAGE_ID, MS_STORAGE_EXTERNAL_USB, false, uid);
+ ms_validaty_change_all_items(handle, DATADISC_STORAGE_ID, MS_USER_STORAGE_EXTERNAL_USB, 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);
ms_set_folder_validity(handle, DATADISC_STORAGE_ID, mnt_path, false, true, uid);
- ms_validaty_change_all_items(handle, DATADISC_STORAGE_ID, MS_STORAGE_EXTERNAL_USB, false, uid);
+ ms_validaty_change_all_items(handle, DATADISC_STORAGE_ID, MS_USER_STORAGE_EXTERNAL_USB, false, uid);
}
ms_disconnect_db(&handle);
MS_DBG_WARN("init storage data in DB");
/* update storage_id table set validity=0 first */
- ms_validaty_change_all_items(handle, DATADISC_STORAGE_ID, MS_STORAGE_EXTERNAL_USB, false, uid);
+ ms_validaty_change_all_items(handle, DATADISC_STORAGE_ID, MS_USER_STORAGE_EXTERNAL_USB, 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_validaty_change_all_items(handle, storage_id, MS_STORAGE_EXTERNAL_USB, false, uid);
+ ms_validaty_change_all_items(handle, storage_id, MS_USER_STORAGE_EXTERNAL_USB, 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);