Name: media-server
Summary: A server for media content management
-Version: 0.6.7
+Version: 0.6.8
Release: 0
Group: Multimedia/Service
License: Apache-2.0
int ms_get_storage_id(sqlite3 *handle, const char *path, char *storage_id, uid_t uid);
int ms_insert_folder(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
int ms_delete_invalid_folder(const char *storage_id, uid_t uid);
-int ms_set_folder_validity(sqlite3 *handle, const char *storage_id, const char *start_path, int validity, bool is_recursive, uid_t uid);
+int ms_set_folder_validity(sqlite3 *handle, const char *start_path, int validity, bool is_recursive, uid_t uid);
int ms_check_db(sqlite3 *handle, uid_t uid);
-int ms_check_storage(sqlite3 *handle, const char *storage_id, char **storage_path, int *validity, uid_t uid);
+int ms_check_storage(sqlite3 *handle, const char *storage_id, char **storage_path, int *validity);
int ms_insert_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, uid_t uid);
int ms_update_storage(sqlite3 *handle, const char *storage_id, const char *storage_path, uid_t uid);
-int ms_set_storage_validity(sqlite3 *handle, const char *storage_id, int validity, uid_t uid);
-int ms_set_all_storage_validity(sqlite3 *handle, int validity, uid_t uid);
-int ms_check_folder_exist(sqlite3 *handle, const char *storage_id, const char *folder_path);
+int ms_set_storage_validity(const char *storage_id, int validity, uid_t uid);
+int ms_set_all_storage_validity(int validity, uid_t uid);
+int ms_check_folder_exist(sqlite3 *handle, const char *folder_path);
int ms_get_folder_id(sqlite3 *handle, const char *storage_id, const char *path, char **folder_id);
int ms_get_media_type(const char *path, int *media_type);
bool ms_check_support_media_type(const char *path);
void ms_register_end(uid_t uid);
#ifdef _USE_TVPD_MODE
-int ms_update_folder_time(sqlite3 *handle, const char *storage_id, char *folder_path, uid_t uid);
-int ms_set_storage_scan_status(sqlite3 *handle, const char *storage_id, media_scan_status_e scan_status, uid_t uid);
+int ms_update_folder_time(sqlite3 *handle, char *folder_path, uid_t uid);
+int ms_set_storage_scan_status(const char *storage_id, media_scan_status_e scan_status, uid_t uid);
int ms_genarate_uuid(char **uuid);
int ms_scan_item_batch(sqlite3 *handle, const char *storage_id, const char *path, uid_t uid);
-int ms_get_extract_list(sqlite3 *handle, const char *storage_id, int scan_type, const char* path, int is_end, void *array);
-int ms_update_one_extract_item(sqlite3 *handle, const char *storage_id, void *data, uid_t uid);
-int ms_delete_invalid_items_in_folder(sqlite3 *handle, const char *storage_id, const char *path, bool is_recursive, uid_t uid);
-int ms_delete_invalid_folder_by_path(sqlite3 *handle, const char *storage_id, const char *folder_path, uid_t uid);
-int ms_get_folder_scan_status(sqlite3 *handle, const char *storage_id, const char *path, int *scan_status);
-int ms_set_folder_scan_status(sqlite3 *handle, const char *storage_id, const char *path, int scan_status, uid_t uid);
-int ms_check_folder_modified(sqlite3 *handle, const char *path, const char *storage_id, bool *modified);
-int ms_get_null_scan_folder_list(sqlite3 *handle, const char *stroage_id, const char *path, GPtrArray **dir_array);
-int ms_change_validity_item_batch(sqlite3 *handle, const char *storage_id, const char *path, int des_validity, int src_validity, uid_t uid);
+int ms_get_extract_list(sqlite3 *handle, int scan_type, const char* path, int is_end, void *array);
+int ms_update_one_extract_item(sqlite3 *handle, void *data, uid_t uid);
+int ms_delete_invalid_items_in_folder(sqlite3 *handle, const char *path, bool is_recursive, uid_t uid);
+int ms_delete_invalid_folder_by_path(const char *folder_path, uid_t uid);
+int ms_get_folder_scan_status(sqlite3 *handle, const char *path, int *scan_status);
+int ms_set_folder_scan_status(const char *storage_id, const char *path, int scan_status, uid_t uid);
+int ms_check_folder_modified(sqlite3 *handle, const char *path, bool *modified);
+int ms_get_null_scan_folder_list(sqlite3 *handle, const char *path, GPtrArray **dir_array);
+int ms_change_validity_item_batch(const char *path, int des_validity, int src_validity, uid_t uid);
#endif
#endif /*_MEDIA_COMMON_DB_SVC_H_*/
int ms_set_db_status(ms_db_status_type_t status);
bool ms_storage_mount_status(const char *start_path);
bool ms_is_support_pvr(void);
-int ms_set_vip_process(void);
+void ms_prevent_oom_killer(void);
#endif
#endif/*_MEDIA_SERVER_UTILS_H__*/
typedef int (*SEND_DIR_UPDATE_NOTI)(const char *, const char *, int, int);
typedef int (*INSERT_ITEM)(sqlite3 *, const char *, const char *, uid_t);
-typedef int (*SET_ITEM_VALIDITY)(const char *, const char *, int, uid_t);
+typedef int (*SET_ITEM_VALIDITY)(const char *, int, uid_t);
typedef int (*GET_STORAGE_ID)(sqlite3 *, const char *, char *, uid_t uid);
typedef int (*INSERT_FOLDER)(sqlite3 *, const char *, const char *, uid_t);
-typedef int (*SET_FOLDER_VALIDITY)(sqlite3 *, const char *, const char *, int, bool, uid_t);
+typedef int (*SET_FOLDER_VALIDITY)(sqlite3 *, const char *, int, bool, uid_t);
typedef int (*CHECK_DB)(sqlite3 *, uid_t);
-typedef int (*CHECK_STORAGE)(sqlite3 *, const char *, char **, int *, uid_t);
+typedef int (*CHECK_STORAGE)(sqlite3 *, const char *, char **, int *);
typedef int (*INSERT_STORAGE)(sqlite3 *, const char *, const char *, uid_t);
typedef int (*UPDATE_STORAGE)(sqlite3 *, const char *, const char *, uid_t);
-typedef int (*SET_STORAGE_VALIDITY)(sqlite3 *, const char *, int, uid_t uid);
-typedef int (*SET_ALL_STORAGE_VALIDITY)(sqlite3 *, int, uid_t);
-typedef int (*CHECK_FOLDER_EXIST)(sqlite3 *, const char *, const char *);
+typedef int (*SET_STORAGE_VALIDITY)(const char *, int, uid_t uid);
+typedef int (*SET_ALL_STORAGE_VALIDITY)(int, uid_t);
+typedef int (*CHECK_FOLDER_EXIST)(sqlite3 *, const char *);
typedef int (*GET_MEDIA_TYPE)(const char *, int *);
-typedef int (*REFRESH_ITEM)(sqlite3 *, const char *, const char *, uid_t);
+typedef int (*REFRESH_ITEM)(sqlite3 *, const char *, uid_t);
#ifdef _USE_TVPD_MODE
-typedef int (*UPDATE_FOLDER_TIME)(sqlite3 *, const char *, const char *, uid_t);
+typedef int (*UPDATE_FOLDER_TIME)(sqlite3 *, const char *, uid_t);
typedef int (*GET_UUID)(char **);
-typedef int (*SET_STORAGE_SCAN_STATUS)(sqlite3 *, const char *, int, uid_t);
+typedef int (*SET_STORAGE_SCAN_STATUS)(const char *, int, uid_t);
typedef int (*INSERT_ITEM_SCAN)(sqlite3 *, const char *, const char *, uid_t);
-typedef int (*GET_EXTRACT_LIST)(sqlite3 *, const char*, int, const char *, int, void*);
-typedef int (*UPDATE_ONE_EXTRACT_ITEM)(sqlite3 *, const char *, void *, uid_t);
-typedef int (*DELETE_ALL_INVALID_ITEMS_IN_FOLDER)(sqlite3 *, const char *, const char *, bool, uid_t);
-typedef int (*DELETE_INVALID_FOLDER_BY_PATH)(sqlite3 *, const char *, const char *, uid_t);
-typedef int (*GET_FOLDER_SCAN_STATUS)(sqlite3 *, const char *, const char *, int *);
-typedef int (*SET_FOLDER_SCAN_STATUS)(sqlite3 *, const char *, const char *, int, uid_t);
-typedef int (*CHECK_FOLDER_MODIFIED)(sqlite3 *, const char *, const char *, bool *);
-typedef int (*GET_NULL_SCAN_FOLDER_LIST)(sqlite3 *, const char *, const char *, GPtrArray **);
-typedef int (*CHANGE_VALIDITY_ITEM_BATCH)(sqlite3 *, const char *, const char *, int, int, uid_t);
+typedef int (*GET_EXTRACT_LIST)(sqlite3 *, int, const char *, int, void*);
+typedef int (*UPDATE_ONE_EXTRACT_ITEM)(sqlite3 *, void *, uid_t);
+typedef int (*DELETE_ALL_INVALID_ITEMS_IN_FOLDER)(sqlite3 *, const char *, bool, uid_t);
+typedef int (*DELETE_INVALID_FOLDER_BY_PATH)(const char *, uid_t);
+typedef int (*GET_FOLDER_SCAN_STATUS)(sqlite3 *, const char *, int *);
+typedef int (*SET_FOLDER_SCAN_STATUS)(const char *, const char *, int, uid_t);
+typedef int (*CHECK_FOLDER_MODIFIED)(sqlite3 *, const char *, bool *);
+typedef int (*GET_NULL_SCAN_FOLDER_LIST)(sqlite3 *, const char *, GPtrArray **);
+typedef int (*CHANGE_VALIDITY_ITEM_BATCH)(const char *, int, int, uid_t);
#endif
enum func_list {
#endif
} else if (ret == MS_MEDIA_ERR_NONE) {
if (!modified) {
- ret = ((SET_ITEM_VALIDITY)func_array[eSET_VALIDITY])(storage_id, path, true, uid);
+ ret = ((SET_ITEM_VALIDITY)func_array[eSET_VALIDITY])(path, true, uid);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "SET_ITEM_VALIDITY failed [%d]", ret);
} else {
- ret = ((REFRESH_ITEM)func_array[eREFRESH_ITEM])(handle, storage_id, path, uid);
+ ret = ((REFRESH_ITEM)func_array[eREFRESH_ITEM])(handle, path, uid);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "REFRESH_ITEM failed [%d]", ret);
}
} else {
return ret;
}
-int ms_set_folder_validity(sqlite3 *handle, const char *storage_id, const char *path, int validity, bool is_recursive, uid_t uid)
+int ms_set_folder_validity(sqlite3 *handle, const char *path, int validity, bool is_recursive, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- ret = ((SET_FOLDER_VALIDITY)func_array[eSET_FOLDER_VALIDITY])(handle, storage_id, path, validity, is_recursive, uid);
+ ret = ((SET_FOLDER_VALIDITY)func_array[eSET_FOLDER_VALIDITY])(handle, path, validity, is_recursive, uid);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "SET_FOLDER_VALIDITY failed [%d]", ret);
return ret;
return ret;
}
-int ms_check_storage(sqlite3 *handle, const char *storage_id, char **storage_path, int *validity, uid_t uid)
+int ms_check_storage(sqlite3 *handle, const char *storage_id, char **storage_path, int *validity)
{
int ret = MS_MEDIA_ERR_NONE;
MS_DBG_FENTER();
- ret = ((CHECK_STORAGE)func_array[eCHECK_STORAGE])(handle, storage_id, storage_path, validity, uid);
+ ret = ((CHECK_STORAGE)func_array[eCHECK_STORAGE])(handle, storage_id, storage_path, validity);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "CHECK_STORAGE failed [%d]", ret);
MS_DBG_FLEAVE();
return ret;
}
-int ms_set_storage_validity(sqlite3 *handle, const char *storage_id, int validity, uid_t uid)
+int ms_set_storage_validity(const char *storage_id, int validity, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- ret = ((SET_STORAGE_VALIDITY)func_array[eSET_STORAGE_VALIDITY])(handle, storage_id, validity, uid);
+ ret = ((SET_STORAGE_VALIDITY)func_array[eSET_STORAGE_VALIDITY])(storage_id, validity, uid);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "SET_STORAGE_VALIDITY failed [%d]", ret);
return ret;
}
-int ms_set_all_storage_validity(sqlite3 *handle, int validity, uid_t uid)
+int ms_set_all_storage_validity(int validity, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- ret = ((SET_ALL_STORAGE_VALIDITY)func_array[eSET_ALL_STORAGE_VALIDITY])(handle, validity, uid);
+ ret = ((SET_ALL_STORAGE_VALIDITY)func_array[eSET_ALL_STORAGE_VALIDITY])(validity, uid);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "SET_ALL_STORAGE_VALIDITY failed [%d]", ret);
return ret;
}
-int ms_check_folder_exist(sqlite3 *handle, const char *storage_id, const char *folder_path)
+int ms_check_folder_exist(sqlite3 *handle, const char *folder_path)
{
int ret = MS_MEDIA_ERR_NONE;
- ret = ((CHECK_FOLDER_EXIST)func_array[eCHECK_FOLDER_EXIST])(handle, storage_id, folder_path);
+ ret = ((CHECK_FOLDER_EXIST)func_array[eCHECK_FOLDER_EXIST])(handle, folder_path);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "CHECK_FOLDER_EXIST failed [%d]", ret);
return ret;
}
#ifdef _USE_TVPD_MODE
-int ms_update_folder_time(sqlite3 *handle, const char *storage_id, char *folder_path, uid_t uid)
+int ms_update_folder_time(sqlite3 *handle, char *folder_path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- ret = ((UPDATE_FOLDER_TIME)func_array[eUPDATE_FOLDER_TIME])(handle, storage_id, folder_path, uid);
+ ret = ((UPDATE_FOLDER_TIME)func_array[eUPDATE_FOLDER_TIME])(handle, folder_path, uid);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "UPDATE_FOLDER_TIME failed [%d]", ret);
return ret;
}
-int ms_set_storage_scan_status(sqlite3 *handle, const char *storage_id, media_scan_status_e scan_status, uid_t uid)
+int ms_set_storage_scan_status(const char *storage_id, media_scan_status_e scan_status, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- int status = scan_status;
- MS_DBG_FENTER();
-
- ret = ((SET_STORAGE_SCAN_STATUS)func_array[eSET_STORAGE_SCAN_STATUS])(handle, storage_id, status, uid);
+ ret = ((SET_STORAGE_SCAN_STATUS)func_array[eSET_STORAGE_SCAN_STATUS])(storage_id, scan_status, uid);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "SET_STORAGE_SCAN_STATUS failed [%d]", ret);
MS_DBG("storage_id [%s], scan_status [%d]", storage_id, scan_status);
return ret;
}
-int ms_get_extract_list(sqlite3 *handle, const char* storage_id, int scan_type, const char* path, int is_end, void *array)
+int ms_get_extract_list(sqlite3 *handle, int scan_type, const char* path, int is_end, void *array)
{
int ret = MS_MEDIA_ERR_NONE;
- ret = ((GET_EXTRACT_LIST)func_array[eGET_EXTRACT_LIST])(handle, storage_id, scan_type, path, is_end, array);
+ ret = ((GET_EXTRACT_LIST)func_array[eGET_EXTRACT_LIST])(handle, scan_type, path, is_end, array);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "GET_EXTRACT_LIST failed [%d]", ret);
return ret;
}
-int ms_update_one_extract_item(sqlite3 *handle, const char* storage_id, void *data, uid_t uid)
+int ms_update_one_extract_item(sqlite3 *handle, void *data, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- ret = ((UPDATE_ONE_EXTRACT_ITEM)func_array[eUPDATE_ONE_EXTRACT_ITEM])(handle, storage_id, data, uid);
+ ret = ((UPDATE_ONE_EXTRACT_ITEM)func_array[eUPDATE_ONE_EXTRACT_ITEM])(handle, data, uid);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "UPDATE_ONE_EXTRACT_ITEM failed [%d]", ret);
return ret;
}
-int ms_delete_invalid_items_in_folder(sqlite3 *handle, const char *storage_id, const char *path, bool is_recursive, uid_t uid)
+int ms_delete_invalid_items_in_folder(sqlite3 *handle, const char *path, bool is_recursive, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- ret = ((DELETE_ALL_INVALID_ITEMS_IN_FOLDER)func_array[eDELETE_FOLDER])(handle, storage_id, path, is_recursive, uid);
+ ret = ((DELETE_ALL_INVALID_ITEMS_IN_FOLDER)func_array[eDELETE_FOLDER])(handle, path, is_recursive, uid);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "DELETE_ALL_INVALID_ITEMS_IN_FOLDER failed [%d]", ret);
return ret;
}
-int ms_delete_invalid_folder_by_path(sqlite3 *handle, const char *storage_id, const char *folder_path, uid_t uid)
+int ms_delete_invalid_folder_by_path(const char *folder_path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- ret = ((DELETE_INVALID_FOLDER_BY_PATH)func_array[eDELETE_INVALID_FOLDER_BY_PATH])(handle, storage_id, folder_path, uid);
+ ret = ((DELETE_INVALID_FOLDER_BY_PATH)func_array[eDELETE_INVALID_FOLDER_BY_PATH])(folder_path, uid);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "DELETE_INVALID_FOLDER_BY_PATH failed [%d]", ret);
return ret;
}
-int ms_get_folder_scan_status(sqlite3 *handle, const char *storage_id, const char *path, int *scan_status)
+int ms_get_folder_scan_status(sqlite3 *handle, const char *path, int *scan_status)
{
int ret = MS_MEDIA_ERR_NONE;
int status = 0;
- ret = ((GET_FOLDER_SCAN_STATUS)func_array[eGET_FOLDER_SCAN_STATUS])(handle, storage_id, path, &status);
+ ret = ((GET_FOLDER_SCAN_STATUS)func_array[eGET_FOLDER_SCAN_STATUS])(handle, path, &status);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "GET_FOLDER_SCAN_STATUS failed [%d]", ret);
*scan_status = status;
return ret;
}
-int ms_set_folder_scan_status(sqlite3 *handle, const char *storage_id, const char *path, int scan_status, uid_t uid)
+int ms_set_folder_scan_status(const char *storage_id, const char *path, int scan_status, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- int status = scan_status;
- ret = ((SET_FOLDER_SCAN_STATUS)func_array[eSET_FOLDER_SCAN_STATUS])(handle, storage_id, path, status, uid);
+ ret = ((SET_FOLDER_SCAN_STATUS)func_array[eSET_FOLDER_SCAN_STATUS])(storage_id, path, scan_status, uid);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "SET_FOLDER_SCAN_STATUS failed [%d]", ret);
MS_DBG_SLOG("OK path = [%s], scan_status = [%d]", path, scan_status);
return ret;
}
-int ms_check_folder_modified(sqlite3 *handle, const char *path, const char *storage_id, bool *modified)
+int ms_check_folder_modified(sqlite3 *handle, const char *path, bool *modified)
{
int ret = MS_MEDIA_ERR_NONE;
- MS_DBG("path = [%s], storage_id = [%s]", path, storage_id);
+ MS_DBG("path [%s]", path);
- ret = ((CHECK_FOLDER_MODIFIED)func_array[eCHECK_FOLDER_MODIFIED])(handle, path, storage_id, modified);
+ ret = ((CHECK_FOLDER_MODIFIED)func_array[eCHECK_FOLDER_MODIFIED])(handle, path, modified);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "CHECK_FOLDER_MODIFIED failed [%d]", ret);
return ret;
}
-int ms_get_null_scan_folder_list(sqlite3 *handle, const char *stroage_id, const char *path, GPtrArray **dir_array)
+int ms_get_null_scan_folder_list(sqlite3 *handle, const char *path, GPtrArray **dir_array)
{
int ret = MS_MEDIA_ERR_NONE;
- ret = ((GET_NULL_SCAN_FOLDER_LIST)func_array[eGET_NULL_SCAN_FOLDER_LIST])(handle, stroage_id, path, dir_array);
+ ret = ((GET_NULL_SCAN_FOLDER_LIST)func_array[eGET_NULL_SCAN_FOLDER_LIST])(handle, path, dir_array);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "GET_NULL_SCAN_FOLDER_LIST failed [%d]", ret);
return ret;
}
-int ms_change_validity_item_batch(sqlite3 *handle, const char *storage_id, const char *path, int des_validity, int src_validity, uid_t uid)
+int ms_change_validity_item_batch(const char *path, int des_validity, int src_validity, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- ret = ((CHANGE_VALIDITY_ITEM_BATCH)func_array[eCHANGE_VALIDITY_ITEM_BATCH])(handle, storage_id, path, des_validity, src_validity, uid);
+ ret = ((CHANGE_VALIDITY_ITEM_BATCH)func_array[eCHANGE_VALIDITY_ITEM_BATCH])(path, des_validity, src_validity, uid);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "CHANGE_VALIDITY_ITEM_BATCH failed [%d]", ret);
return ret;
#include "media-common-system.h"
#include "media-common-utils.h"
-#define PROC_OOM_SCORE_ADJ_PATH "/proc/%d/oom_score_adj"
-#define VIP_OOM_SCORE_ADJ (-1000)
-#define PROC_NAME_MAX 1024
-#define PROC_BUF_MAX 64
+#define OOM_SCORE_MIN "-1000"
typedef struct storage_result {
char *storage_path;
bool ms_config_get_int(const char *key, int *value)
{
- int err;
+ int err = VCONF_OK;
if (!key || !value) {
MS_DBG_ERR("Arguments key or value is NULL");
return MS_MEDIA_ERR_INTERNAL;
}
-static int __ms_get_cmdline_from_proc(pid_t pid, char *cmdline)
-{
- char buf[PROC_BUF_MAX];
- char cmdline_buf[PROC_NAME_MAX];
- char *filename;
- FILE *fp;
-
- snprintf(buf, sizeof(buf), "/proc/%d/cmdline", pid);
- fp = fopen(buf, "r");
- if (fp == NULL)
- return MS_MEDIA_ERR_INTERNAL;
-
- if (fgets(cmdline_buf, PROC_NAME_MAX-1, fp) == NULL) {
- fclose(fp);
- return MS_MEDIA_ERR_INTERNAL;
- }
- fclose(fp);
-
- filename = strrchr(cmdline_buf, '/');
- if (filename == NULL)
- filename = cmdline_buf;
- else
- filename = filename + 1;
-
- g_strlcpy(cmdline, filename, PROC_NAME_MAX);
-
- return MS_MEDIA_ERR_NONE;
-}
-
-int ms_set_vip_process(void)
+void ms_prevent_oom_killer(void)
{
char buf[100] = {0};
- int id = 0;
- static pid_t pid = 0;
- static char process_name[PROC_NAME_MAX] = {0};
- static char *appid = NULL;
-
- /* Get Pid */
- pid = getpid();
- if (__ms_get_cmdline_from_proc(pid, process_name)) {
- MS_DBG_ERR("%s: Read process name failed pid[%d]", __func__, pid);
- return MS_MEDIA_ERR_INTERNAL;
- }
- appid = process_name;
-
- MS_DBG("Process name[%s]:Pid[%d]", appid, pid);
+ int fd = 0;
if (prctl(PR_GET_DUMPABLE) == 0)
prctl(PR_SET_DUMPABLE, 1);
- snprintf(buf, sizeof(buf), PROC_OOM_SCORE_ADJ_PATH, pid);
- id = open(buf, O_WRONLY, 0777);
- if (id < 0) {
- MS_DBG_ERR("fopen %s failed errno:%d", buf, errno);
- return MS_MEDIA_ERR_INTERNAL;
- }
- snprintf(buf, sizeof(buf), "%d", VIP_OOM_SCORE_ADJ);
- if (write(id, buf, strlen(buf)) < 0) {
- MS_DBG_ERR("write() failed errno=%d", errno);
- close(id);
- return MS_MEDIA_ERR_INTERNAL;
+ snprintf(buf, sizeof(buf), "/proc/%d/oom_score_adj", getpid());
+ fd = open(buf, O_WRONLY, 0777);
+ if (fd < 0) {
+ MS_DBG_STRERROR("open failed");
+ return;
}
- close(id);
- return MS_MEDIA_ERR_NONE;
+
+ if (write(fd, OOM_SCORE_MIN, strlen(OOM_SCORE_MIN)) < 0)
+ MS_DBG_STRERROR("write failed");
+
+ close(fd);
}
/* Common functions but with a product implementation */
int ms_check_scan_ignore(char *path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- const char *ignore_file = ".scan_ignore";
- char *tmp_path = NULL;
- char *org_path = NULL;
+ g_autofree gchar *tmp_path = NULL;
+ g_autofree gchar *org_path = NULL;
char ignore_path[MAX_FILEPATH_LEN] = {0, };
/* Check for symbolic link */
org_path = g_canonicalize_filename(path, NULL);
if (g_strcmp0(tmp_path, org_path) != 0) {
- MS_SAFE_FREE(tmp_path);
- g_free(org_path);
MS_DBG_ERR("symbolic link(directory)");
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
- MS_SAFE_FREE(tmp_path);
- g_free(org_path);
-
if (g_file_test(path, G_FILE_TEST_IS_DIR)) {
- snprintf(ignore_path, sizeof(ignore_path), "%s/%s", path, ignore_file);
+ snprintf(ignore_path, sizeof(ignore_path), "%s/.scan_ignore", path);
if (g_file_test(ignore_path, G_FILE_TEST_EXISTS)) {
MS_DBG_WARN("scan ignore file exist [%s]", ignore_path);
int ms_check_scan_ignore(char *path, uid_t uid)
{
int ret = MS_MEDIA_ERR_NONE;
- const char *ignore_file = ".scan_ignore";
- char *tmp_path = NULL;
- char *org_path = NULL;
+ g_autofree gchar *tmp_path = NULL;
+ g_autofree gchar *org_path = NULL;
+ g_autofree gchar *mediashared = NULL;
char ignore_path[MAX_FILEPATH_LEN] = {0, };
-
char replace[MAX_FILEPATH_LEN] = {0, };
- char *mediashared = NULL;
/* Check for symbolic link */
tmp_path = realpath(path, NULL);
if (g_str_has_prefix(tmp_path, tzplatform_getenv(TZ_SYS_MEDIASHARED))) {
ms_user_get_mediashared_path(uid, &mediashared);
snprintf(replace, MAX_FILEPATH_LEN, "%s%s", mediashared, tmp_path + strlen(tzplatform_getenv(TZ_SYS_MEDIASHARED)));
- MS_SAFE_FREE(mediashared);
if (g_strcmp0(replace, org_path) != 0) {
- MS_SAFE_FREE(tmp_path);
- g_free(org_path);
MS_DBG_ERR("symbolic link(directory)");
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
} else {
if (g_strcmp0(tmp_path, org_path) != 0) {
- MS_SAFE_FREE(tmp_path);
- g_free(org_path);
MS_DBG_ERR("symbolic link(directory)");
return MS_MEDIA_ERR_INVALID_PARAMETER;
}
}
- MS_SAFE_FREE(tmp_path);
- g_free(org_path);
-
if (g_file_test(path, G_FILE_TEST_IS_DIR)) {
- snprintf(ignore_path, sizeof(ignore_path), "%s/%s", path, ignore_file);
+ snprintf(ignore_path, sizeof(ignore_path), "%s/.scan_ignore", path);
if (g_file_test(ignore_path, G_FILE_TEST_EXISTS)) {
MS_DBG_WARN("scan ignore file exist [%s]", ignore_path);
return ret;
}
-#endif /* _USE_TVPD_MODE */
\ No newline at end of file
+#endif /* _USE_TVPD_MODE */
g_cond_clear(&extract_data_cond);
}
-static int __msc_folder_bulk_extract(sqlite3 *handle, const char *storage_id, const char *path, int scan_type, int pid, bool is_end, uid_t uid)
+static int __msc_folder_bulk_extract(sqlite3 *handle, const char *path, int scan_type, int pid, bool is_end, uid_t uid)
{
- MS_DBG_WARN("begin of __msc_folder_bulk_extract");
+ MS_DBG_FENTER();
int ret = MS_MEDIA_ERR_NONE;
GArray *data_array = NULL;
ms_item_info_s* db_data = NULL;
int sleep_count = 0;
- ret = ms_get_extract_list(handle, storage_id, scan_type, path, is_end, (void *)&data_array);
+ ret = ms_get_extract_list(handle, scan_type, path, is_end, (void *)&data_array);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, MS_MEDIA_ERR_NONE, "ms_get_extract_list failed!!!");
MS_DBG_RETVM_IF(!data_array, MS_MEDIA_ERR_NONE, "data_array is NULL!!!");
g_array_remove_index(data_array, 0);
g_mutex_lock(&decode_mutex);
- ms_update_one_extract_item(handle, storage_id, db_data, uid);
+ ms_update_one_extract_item(handle, db_data, uid);
g_mutex_unlock(&decode_mutex);
if (db_data) {
g_array_free(data_array, FALSE);
data_array = NULL;
- MS_DBG_WARN("end of __msc_folder_bulk_extract");
+ MS_DBG_FLEAVE();
return ret;
}
goto NEXT;
}
- ret = __msc_folder_bulk_extract(handle, extract_data->storage_id, extract_data->msg, extract_data->msg_type, extract_data->pid, end_flag, extract_data->uid);
+ ret = __msc_folder_bulk_extract(handle, extract_data->msg, extract_data->msg_type, extract_data->pid, end_flag, extract_data->uid);
NEXT:
g_directory_extract_processing = false;
goto NEXT;
}
}
- ms_set_storage_scan_status(handle, extract_data->storage_id, MEDIA_EXTRACT_PROCESSING, extract_data->uid);
+ ms_set_storage_scan_status(extract_data->storage_id, MEDIA_EXTRACT_PROCESSING, extract_data->uid);
__msc_extract_set_db_status(MS_DB_UPDATING);
/*extract meta*/
- ret = __msc_folder_bulk_extract(handle, extract_data->storage_id, extract_data->msg, extract_data->msg_type, extract_data->pid, end_flag, extract_data->uid);
+ ret = __msc_folder_bulk_extract(handle, extract_data->msg, extract_data->msg_type, extract_data->pid, end_flag, extract_data->uid);
MS_DBG_WARN("extract PAUSE");
__msc_pause_extract();
MS_DBG_WARN("extract RESUME");
if (__msc_check_extract_stop_status(extract_data->msg_type, extract_data->msg, extract_data->pid) == MS_MEDIA_ERR_SCANNER_FORCE_STOP) {
- ms_set_storage_scan_status(handle, extract_data->storage_id, MEDIA_EXTRACT_STOP, extract_data->uid);
+ ms_set_storage_scan_status(extract_data->storage_id, MEDIA_EXTRACT_STOP, extract_data->uid);
__msc_set_storage_extract_status(MS_STORAGE_SCAN_META_STOP);
MS_DBG_WARN("storage scan force stopped");
/* set vconf key db extract status */
if (extract_data->result) {
MS_DBG_WARN("extract_data->result is true, MS_STORAGE_SCAN_COMPLETE");
__msc_del_extract_blocked_path(extract_data->msg);
- ms_set_storage_scan_status(handle, extract_data->storage_id, MEDIA_EXTRACT_COMPLETE, extract_data->uid);
+ ms_set_storage_scan_status(extract_data->storage_id, MEDIA_EXTRACT_COMPLETE, extract_data->uid);
__msc_set_storage_extract_status(MS_STORAGE_SCAN_COMPLETE);
ms_send_dir_update_noti(extract_data->msg, NULL, MS_ITEM_UPDATE, extract_data->pid);
static bool is_scanner_paused = false;
static int __msc_check_stop_status(ms_msg_type_e msg_type, const char *start_path, int pid);
-static int __msc_get_null_scan_folder_list(sqlite3 *handle, const char *stroage_id, char *path, GPtrArray *dir_array);
+static int __msc_get_null_scan_folder_list(sqlite3 *handle, char *path, GPtrArray *dir_array);
static int __msc_check_scan_same_path(char *scan_path);
static void __msc_set_storage_scan_cur_path(char *scan_path);
static void __msc_set_dir_scan_cur_path(char *scan_path);
MS_DBG_SWARN("ms_insert_folder insert path[%s]", new_start_path);
} else {
- if (ms_set_folder_validity(handle, storage_id, new_start_path, MS_INVALID, is_recursive, uid) != MS_MEDIA_ERR_NONE)
+ if (ms_set_folder_validity(handle, new_start_path, MS_INVALID, is_recursive, uid) != MS_MEDIA_ERR_NONE)
MS_DBG_ERR("set_folder_validity failed [%d] ", msg_type);
}
ret = __msc_check_stop_status(msg_type, new_start_path, pid);
if (ret != MS_MEDIA_ERR_NONE) {
if (is_recursive)
- ms_change_validity_item_batch(handle, storage_id, new_start_path, 1, 2, uid);
+ ms_change_validity_item_batch(new_start_path, 1, 2, uid);
goto STOP_SCAN;
}
continue;
}
- ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_PROCESSING, uid);
+ ms_set_folder_scan_status(storage_id, current_path, MS_DIR_SCAN_PROCESSING, uid);
sleep_count = 0;
dir = opendir(current_path);
ret = __msc_check_stop_status(msg_type, new_start_path, pid);
if (ret != MS_MEDIA_ERR_NONE) {
if (is_recursive)
- ms_change_validity_item_batch(handle, storage_id, new_start_path, 1, 2, uid);
+ ms_change_validity_item_batch(new_start_path, 1, 2, uid);
goto STOP_SCAN;
}
msc_insert_exactor_request(msg_type, false, storage_id, current_path, pid, uid, MS_ITEM_UPDATE);
} else {
if (is_recursive)
- ms_change_validity_item_batch(handle, storage_id, new_start_path, 1, 2, uid);
+ ms_change_validity_item_batch(new_start_path, 1, 2, uid);
goto STOP_SCAN;
}
}
}
}
if (msg_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE)
- ms_update_folder_time(handle, storage_id, current_path, uid);
+ ms_update_folder_time(handle, current_path, uid);
- ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_DONE, uid);
+ ms_set_folder_scan_status(storage_id, current_path, MS_DIR_SCAN_DONE, uid);
MS_SAFE_FREE(current_path);
STOP_SCAN:
MS_DBG_ERR("stop folder scan...");
- ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_STOP, uid);
+ ms_set_folder_scan_status(storage_id, current_path, MS_DIR_SCAN_STOP, uid);
MS_SAFE_FREE(current_path);
END_SCAN:
continue;
}
- ms_get_folder_scan_status(handle, storage_id, current_path, (int *)&scan_status);
+ ms_get_folder_scan_status(handle, current_path, (int *)&scan_status);
if (scan_status == MS_DIR_SCAN_PROCESSING && g_directory_scan_processing2 != DIR_SCAN_NON_SCAN) {
if (g_directory_scan_processing2 == DIR_SCAN_NON_RECURSIVE) {
MS_DBG_SERR("%s is scan done, ignore current path, get subfolder list!!", current_path);
- __msc_get_null_scan_folder_list(handle, storage_id, current_path, dir_array);
+ __msc_get_null_scan_folder_list(handle, current_path, dir_array);
continue;
}
}
- ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_PROCESSING, uid);
+ ms_set_folder_scan_status(storage_id, current_path, MS_DIR_SCAN_PROCESSING, uid);
sleep_count = 0;
dir = opendir(current_path);
}
ms_register_end(uid);
- ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_DONE, uid);
+ ms_set_folder_scan_status(storage_id, current_path, MS_DIR_SCAN_DONE, uid);
if (dir) {
closedir(dir);
is_missing = false;
if (g_directory_scan_processing2 == DIR_SCAN_NON_SCAN) {
- ret = __msc_get_null_scan_folder_list(handle, storage_id, NULL, dir_array);
+ ret = __msc_get_null_scan_folder_list(handle, NULL, dir_array);
MS_DBG_WARN("no wait folder scan callback");
} else {
__msc_pause_scan();
- ret = __msc_get_null_scan_folder_list(handle, storage_id, NULL, dir_array);
+ ret = __msc_get_null_scan_folder_list(handle, NULL, dir_array);
if (ret != MS_MEDIA_ERR_NONE)
break;
STOP_SCAN:
if (current_path != NULL)
- ms_set_folder_scan_status(handle, storage_id, current_path, MS_DIR_SCAN_STOP, uid);
+ ms_set_folder_scan_status(storage_id, current_path, MS_DIR_SCAN_STOP, uid);
MS_SAFE_FREE(current_path);
END_SCAN:
return ret;
}
-static int __msc_get_null_scan_folder_list(sqlite3 *handle, const char *stroage_id, char *path, GPtrArray *dir_array)
+static int __msc_get_null_scan_folder_list(sqlite3 *handle, char *path, GPtrArray *dir_array)
{
int ret = MS_MEDIA_ERR_NONE;
GPtrArray *cur_dir_array = NULL;
- ret = ms_get_null_scan_folder_list(handle, stroage_id, path, &cur_dir_array);
+ ret = ms_get_null_scan_folder_list(handle, path, &cur_dir_array);
if (ret == MS_MEDIA_ERR_NONE && cur_dir_array) {
MS_DBG_WARN("cur_dir_array->len = [%d]", cur_dir_array->len);
g_ptr_array_extend_and_steal(dir_array, cur_dir_array);
if (g_file_test(scan_data->msg, G_FILE_TEST_IS_DIR)) {
is_recursive = (scan_data->msg_type == MS_MSG_DIRECTORY_SCANNING);
- if (ms_check_folder_exist(handle, scan_data->storage_id, scan_data->msg) == MS_MEDIA_ERR_NONE) {
+ if (ms_check_folder_exist(handle, scan_data->msg) == MS_MEDIA_ERR_NONE) {
noti_type = MS_ITEM_UPDATE;
MS_DBG_WARN("[%.*s] already exist", MAX_MSG_SIZE, scan_data->msg);
} else {
}
- ms_get_folder_scan_status(handle, scan_data->storage_id, scan_data->msg, (int*)&scan_status);
+ ms_get_folder_scan_status(handle, scan_data->msg, (int*)&scan_status);
if (scan_status == MS_DIR_SCAN_DONE)
ms_set_folder_item_validity(handle, scan_data->storage_id, scan_data->msg, MS_VALID_V2, MS_RECURSIVE, scan_data->uid);
MS_DBG_WARN("start non recursive dir scan!!");
g_directory_scan_processing2 = DIR_SCAN_NON_RECURSIVE;
- ms_check_folder_modified(handle, scan_data->msg, scan_data->storage_id, &modified);
+ ms_check_folder_modified(handle, scan_data->msg, &modified);
if (!modified) {
MS_DBG_WARN("check [%.*s] has not been modified !!", MAX_MSG_SIZE, scan_data->msg);
- ms_get_folder_scan_status(handle, scan_data->storage_id, scan_data->msg, (int*)&scan_status);
+ ms_get_folder_scan_status(handle, scan_data->msg, (int*)&scan_status);
MS_DBG_WARN("folder scan status = [%d]", scan_status);
if (scan_status == MS_DIR_SCAN_DONE) {
goto NEXT;
- ms_get_folder_scan_status(handle, scan_data->storage_id, scan_data->msg, (int*)&scan_status);
+ ms_get_folder_scan_status(handle, scan_data->msg, (int*)&scan_status);
if (scan_status == MS_DIR_SCAN_DONE) {
MS_DBG_WARN("[%.*s] [MS_DIR_SCAN_DONE]", MAX_MSG_SIZE, scan_data->msg);
goto SCAN_DONE;
__msc_resume_scan();
- if (ms_delete_invalid_items_in_folder(handle, scan_data->storage_id, scan_data->msg, is_recursive, scan_data->uid) != MS_MEDIA_ERR_NONE)
+ if (ms_delete_invalid_items_in_folder(handle, scan_data->msg, is_recursive, scan_data->uid) != MS_MEDIA_ERR_NONE)
MS_DBG_ERR("deleting invalid items in folder failed");
SCAN_DONE:
MS_DBG_WARN("storage_id = [%s], dir Path = [%.*s], pid = [%d]", scan_data->storage_id, MAX_MSG_SIZE, scan_data->msg, scan_data->pid);
if (ret != MS_MEDIA_ERR_SCANNER_FORCE_STOP) {
if (is_recursive) {
- if (ms_delete_invalid_folder_by_path(handle, scan_data->storage_id, scan_data->msg, scan_data->uid) != MS_MEDIA_ERR_NONE)
+ if (ms_delete_invalid_folder_by_path(scan_data->msg, scan_data->uid) != MS_MEDIA_ERR_NONE)
MS_DBG_ERR("deleting invalid folder failed");
}
goto NEXT;
}
- ms_set_storage_scan_status(handle, scan_data->storage_id, MEDIA_SCAN_PROCESSING, scan_data->uid);
+ ms_set_storage_scan_status(scan_data->storage_id, MEDIA_SCAN_PROCESSING, scan_data->uid);
ms_set_db_status(MS_DB_UPDATING);
}
if (ret == MS_MEDIA_ERR_SCANNER_FORCE_STOP) {
- ms_set_storage_scan_status(handle, scan_data->storage_id, MEDIA_SCAN_STOP, scan_data->uid);
+ ms_set_storage_scan_status(scan_data->storage_id, MEDIA_SCAN_STOP, scan_data->uid);
ms_set_db_status(MS_DB_STOPPED);
} else {
- ms_set_storage_scan_status(handle, scan_data->storage_id, MEDIA_SCAN_COMPLETE, scan_data->uid);
+ ms_set_storage_scan_status(scan_data->storage_id, MEDIA_SCAN_COMPLETE, scan_data->uid);
ms_set_db_status(MS_DB_UPDATED);
}
resource_clear_cpu_boosting(stResource);
/*Set VIP Process*/
- ms_set_vip_process();
+ ms_prevent_oom_killer();
g_main_loop_run(scanner_mainloop2);
if (err != MS_MEDIA_ERR_NONE)
MS_DBG_ERR("error : %d", err);
- ms_set_folder_validity(handle, storage_id, start_path, 0, true, scan_data->uid);
+ ms_set_folder_validity(handle, start_path, 0, true, scan_data->uid);
g_free(start_path);
}
MS_DBG_RETVM_IF(!handle, MS_MEDIA_ERR_INVALID_PARAMETER, "handle is NULL");
MS_DBG_RETVM_IF(!scan_data, MS_MEDIA_ERR_INVALID_PARAMETER, "scan_data is NULL");
- ret = ms_set_folder_validity(handle, scan_data->storage_id, scan_data->msg, MS_SCANNING, is_recursive, scan_data->uid);
+ ret = ms_set_folder_validity(handle, scan_data->msg, MS_SCANNING, is_recursive, scan_data->uid);
MS_DBG_RETVM_IF(ret != MS_MEDIA_ERR_NONE, ret, "ms_set_folder_validity failed");
ret = ms_set_folder_item_validity(handle, scan_data->storage_id, scan_data->msg, MS_SCANNING, is_recursive, scan_data->uid);
is_recursive = (scan_data->msg_type == MS_MSG_DIRECTORY_SCANNING_NON_RECURSIVE) ? false : true;
if (g_file_test(scan_data->msg, G_FILE_TEST_IS_DIR)) {
- if (ms_check_folder_exist(handle, scan_data->storage_id, scan_data->msg) == MS_MEDIA_ERR_NONE) {
+ if (ms_check_folder_exist(handle, scan_data->msg) == MS_MEDIA_ERR_NONE) {
MS_DBG_WARN("[%.*s] already exist", MAX_MSG_SIZE, scan_data->msg);
ret = __msc_directory_scan_update_and_delete(handle, scan_data, is_recursive, MS_ITEM_UPDATE);
} else {
}
/* update storage information into media DB */
- ret = ms_check_storage(handle, mount_uuid, &storage_path, &validity, uid);
+ ret = ms_check_storage(handle, mount_uuid, &storage_path, &validity);
if (ret == 0) {
if (validity == 1) {
MS_DBG_ERR("This storage is already updated. So ignore this event.");
ret = ms_update_storage(handle, mount_uuid, mount_path, uid);
scan_type = MS_SCAN_PART;
- ms_set_storage_validity(handle, mount_uuid, 1, uid);
+ ms_set_storage_validity(mount_uuid, 1, uid);
#ifdef _USE_TVPD_MODE
- if (ms_set_storage_scan_status(handle, mount_uuid, MEDIA_SCAN_PREPARE, uid) != MS_MEDIA_ERR_NONE)
+ if (ms_set_storage_scan_status(mount_uuid, MEDIA_SCAN_PREPARE, uid) != MS_MEDIA_ERR_NONE)
MS_DBG_ERR("ms_set_storage_scan_status failed");
#endif
MS_DBG_WARN("init storage data in DB");
/* update storage_id table set validity=0 first */
ms_validity_change_all_items(handle, mount_uuid, false, uid);
/*update folder table set validity = 0*/
- ms_set_folder_validity(handle, mount_uuid, storage_path, MS_INVALID, true, uid);
+ ms_set_folder_validity(handle, storage_path, MS_INVALID, true, uid);
#ifdef _USE_TVPD_MODE
/* update folder table set scan_status=0 first */
- ms_set_folder_scan_status(handle, mount_uuid, NULL, MS_DIR_SCAN_NONE, uid);
+ ms_set_folder_scan_status(mount_uuid, NULL, MS_DIR_SCAN_NONE, uid);
#endif
MS_DBG_WARN("init storage data in DB end");
} else {
if (mount_path && mount_uuid) {
ms_connect_db(&handle, uid);
- ms_set_storage_validity(handle, mount_uuid, 0, uid);
+ ms_set_storage_validity(mount_uuid, 0, uid);
ms_send_storage_scan_request(mount_path, mount_uuid, MS_SCAN_INVALID, uid);
ms_disconnect_db(handle);
} 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_all_storage_validity(0, uid);
ms_disconnect_db(handle);
}
if (storage_id != NULL) {
/* update storage information into media DB */
- ret = ms_check_storage(handle, storage_id, &storage_path, &validity, uid);
+ ret = ms_check_storage(handle, storage_id, &storage_path, &validity);
if (ret == 0) {
if (validity == 1) {
MS_DBG_ERR("This storage is already updated. So ignore this event.");
ret = ms_update_storage(handle, storage_id, mount_path, uid);
}
scan_type = MS_SCAN_PART;
- ms_set_storage_validity(handle, storage_id, 1, uid);
- if (ms_set_storage_scan_status(handle, storage_id, MEDIA_SCAN_PREPARE, uid) != MS_MEDIA_ERR_NONE)
+ ms_set_storage_validity(storage_id, 1, uid);
+ if (ms_set_storage_scan_status(storage_id, MEDIA_SCAN_PREPARE, uid) != MS_MEDIA_ERR_NONE)
MS_DBG_ERR("ms_set_storage_scan_status failed");
media_db_update_send(getpid(), MS_MEDIA_ITEM_STORAGE, MS_MEDIA_ITEM_UPDATE, mount_path, storage_id, 0, PROD_CUSTOM_MIME_ADDED);
/* update storage_id table set validity=0 first */
ms_validity_change_all_items(handle, storage_id, false, uid);
/* update folder table set validity=0 first */
- ms_set_folder_validity(handle, storage_id, mount_path, MS_INVALID, true, uid);
+ ms_set_folder_validity(handle, mount_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_set_folder_scan_status(storage_id, NULL, MS_DIR_SCAN_NONE, uid);
/* request to update media db */
ms_send_storage_scan_request(mount_path, storage_id, scan_type, uid);
return;
}
- ms_set_storage_validity(handle, device_id, 0, uid);
+ ms_set_storage_validity(device_id, 0, uid);
/* update storage_id table set validity=0 first */
if (ms_validity_change_all_items(handle, device_id, false, uid) != MS_MEDIA_ERR_NONE)
MS_DBG_ERR("ms_validity_change_all_items failed");
/* folder validity set 0 under the start_path in folder table*/
- if (ms_set_folder_validity(handle, device_id, mount_path, MS_INVALID, true, uid) != MS_MEDIA_ERR_NONE)
+ if (ms_set_folder_validity(handle, mount_path, MS_INVALID, true, uid) != MS_MEDIA_ERR_NONE)
MS_DBG_ERR("set_folder_validity failed");
if (ms_get_scanner_status()) {
int validity = 0;
char *db_storage_path = NULL;
- ret = ms_check_storage(handle, storage_id, &db_storage_path, &validity, uid);
+ ret = ms_check_storage(handle, storage_id, &db_storage_path, &validity);
if (ret == 0) {
if (validity == 1) {
MS_DBG_ERR("This storage is already updated.");
ret = ms_update_storage(handle, storage_id, mounted_path, uid);
}
- ms_set_storage_validity(handle, storage_id, 1, uid);
+ ms_set_storage_validity(storage_id, 1, uid);
/* update storage_id table set validity=0 first */
ms_validity_change_all_items(handle, storage_id, false, uid);
- ms_set_folder_validity(handle, storage_id, mounted_path, MS_INVALID, true, uid);
+ ms_set_folder_validity(handle, 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_set_folder_scan_status(storage_id, NULL, MS_DIR_SCAN_NONE, uid);
scan_type = MS_SCAN_PART;
g_free(db_storage_path);
if (!ms_config_set_int(MS_SERVER_STATUS, 1))
MS_DBG_ERR("Fail to change sever status");
- ms_set_vip_process();
+ ms_prevent_oom_killer();
#endif
resource_clear_cpu_boosting(stResource);
return;
}
- if (ms_set_storage_scan_status(db_handle, NULL, MEDIA_SCAN_PREPARE, uid) != MS_MEDIA_ERR_NONE)
+ if (ms_set_storage_scan_status(NULL, MEDIA_SCAN_PREPARE, uid) != MS_MEDIA_ERR_NONE)
MS_DBG_ERR("ms_set_storage_scan_status fail");
/*update just valid type*/
- if (ms_set_all_storage_validity(db_handle, 0, uid) != MS_MEDIA_ERR_NONE)
+ if (ms_set_all_storage_validity(0, uid) != MS_MEDIA_ERR_NONE)
MS_DBG_ERR("ms_set_all_storage_validity fail");
#ifdef _USE_ON_DEMAND