#ifdef _USE_TVPD_MODE
#include <sys/prctl.h>
+#include <usb-device.h>
#endif
#include <system_info.h>
#include <device/power.h>
-#ifndef _USE_DEVICED_DBUS
-#include <usb-device.h>
-#endif
-
#include "media-util.h"
#include "media-server-ipc.h"
#include "media-common-dbg.h"
return false;
}
-bool ms_config_get_str(const char *key, char **value)
-{
- char *res = NULL;
-
- if (key == NULL || value == NULL) {
- MS_DBG_ERR("Arguments key or value is NULL");
- return false;
- }
-
- res = vconf_get_str(key);
- if (MS_STRING_VALID(res)) {
- *value = g_strdup(res);
- MS_SAFE_FREE(res);
- return true;
- }
-
- return false;
-}
-
-int ms_get_remain_space(double *free_space)
+int ms_get_remain_space(uint64_t *free_space)
{
int ret = MS_MEDIA_ERR_NONE;
const char *path = "/opt";
}
/* f_bsize:unsigned long, f_bavail:fsblkcnt_t(unsigned long) */
- *free_space = (double)(s.f_bsize * s.f_bavail);
+ *free_space = (uint64_t)s.f_bsize * (uint64_t)s.f_bavail;
return MS_MEDIA_ERR_NONE;
}
}
#endif
+bool ms_is_valid_symlink(const char *path)
+{
+#ifdef _USE_TVPD_MODE
+ return false;
+#else
+ g_autofree char *real_path = realpath(path, NULL);
+
+ if (!real_path)
+ return false;
+
+ return (g_strcmp0(real_path, MEDIA_SHARE_PATH) == 0);
+#endif
+}
+
int ms_check_file_path(const char *file_path, uid_t uid)
{
ms_user_storage_type_e storage_type = -1;
return ret;
}
-#ifndef _USE_DEVICED_DBUS
-
+#ifdef _USE_TVPD_MODE
typedef struct storage_result {
char *storage_path;
bool result;
bool ms_storage_mount_status(const char *start_path)
{
bool ret = false;
-#ifndef _USE_DEVICED_DBUS
+#ifdef _USE_TVPD_MODE
storage_result_s res = {0, };
char *remain_path = NULL;
int remain_len = 0;
dir_path[len -1] = '\0';
}
-int ms_check_size_mediadb(uid_t uid, double *db_size)
+int ms_check_size_mediadb(uid_t uid, uint64_t *db_size)
{
int ret = MS_MEDIA_ERR_NONE;
char *db_path = NULL;
ret = ms_user_get_media_db_path(uid, &db_path);
if (stat(db_path, &buf) == 0) {
- *db_size = buf.st_size;
+ *db_size = (uint64_t)buf.st_size;
} else {
MS_DBG_STRERROR("stat failed");
ret = MS_MEDIA_ERR_INTERNAL;