sdcard: change root path of sdcard 55/47955/1 submit/tizen/20150911.041040
authortaeyoung <ty317.kim@samsung.com>
Thu, 10 Sep 2015 09:00:44 +0000 (18:00 +0900)
committertaeyoung <ty317.kim@samsung.com>
Thu, 10 Sep 2015 09:03:14 +0000 (18:03 +0900)
- Previously, the sdcard root path is hard-coded to /opt/storage/sdcard
  But the directory policy is changed and the policy can be obtained
  by libtzplatform-config. Thus the path is changed

Change-Id: Id1808bc6c67e0f54d272c332d27351ca81fec842
Signed-off-by: taeyoung <ty317.kim@samsung.com>
src/statvfs.c
src/storage-sdcard.c

index ff93b214056ece8d0f0cefab43980c5e093e70fd..859f43d0aadf2cbc230b0b616841c37e6a226783 100644 (file)
@@ -25,6 +25,7 @@
 #include <errno.h>
 #include <assert.h>
 #include <mntent.h>
+#include <tzplatform_config.h>
 
 #include "log.h"
 #include "common.h"
@@ -33,7 +34,7 @@
 #define MEMORY_MEGABYTE_VALUE  1048576
 
 #define MEMORY_STATUS_USR_PATH "/opt/usr"
-#define EXTERNAL_MEMORY_PATH   "/opt/storage/sdcard"
+#define EXTERNAL_MEMORY_NODE   "sdcard"
 #define STORAGE_CONF_FILE      "/etc/storage/libstorage.conf"
 
 /* it's for 32bit file offset */
@@ -325,6 +326,12 @@ static int mount_check(const char *path)
        return ret;
 }
 
+static const char *get_external_path(void)
+{
+       return tzplatform_mkpath(TZ_SYS_STORAGE,
+                       EXTERNAL_MEMORY_NODE);
+}
+
 API int storage_get_external_memory_size(struct statvfs *buf)
 {
        struct statvfs_32 temp;
@@ -336,12 +343,12 @@ API int storage_get_external_memory_size(struct statvfs *buf)
                return -EINVAL;
        }
 
-       if (!mount_check(EXTERNAL_MEMORY_PATH)) {
+       if (!mount_check(get_external_path())) {
                memset(buf, 0, sizeof(struct statvfs_32));
                return 0;
        }
 
-       ret = get_memory_size(EXTERNAL_MEMORY_PATH, &temp);
+       ret = get_memory_size(get_external_path(), &temp);
        if (ret) {
                _E("fail to get memory size");
                return -errno;
@@ -361,12 +368,12 @@ API int storage_get_external_memory_size64(struct statvfs *buf)
                return -EINVAL;
        }
 
-       if (!mount_check(EXTERNAL_MEMORY_PATH)) {
+       if (!mount_check(get_external_path())) {
                memset(buf, 0, sizeof(struct statvfs));
                return 0;
        }
 
-       ret = statvfs(EXTERNAL_MEMORY_PATH, buf);
+       ret = statvfs(get_external_path(), buf);
        if (ret) {
                _E("fail to get memory size");
                return -errno;
index 70be220672353ef86ea50f739567b82c76c48c7b..8d6dcbd1c8cf5ba04607762a0852164428d93f82 100755 (executable)
 #include <errno.h>
 #include <sys/statvfs.h>
 #include <vconf.h>
+#include <tzplatform_config.h>
 
 #include "common.h"
 #include "list.h"
 #include "log.h"
 
-#define SDCARD_PATH "/opt/storage/sdcard"
+#define SDCARD_NODE "sdcard"
 
 #ifndef __USE_FILE_OFFSET64
 int __WEAK__ storage_get_external_memory_size(struct statvfs *buf);
@@ -88,7 +89,7 @@ static int sdcard_get_space(unsigned long long *total, unsigned long long *avail
 
 static const char *sdcard_get_root(void)
 {
-       return SDCARD_PATH;
+       return tzplatform_mkpath(TZ_SYS_STORAGE, SDCARD_NODE);
 }
 
 static void sdcard_state_cb(keynode_t *key, void *data)