Add storage_is_mounted api 85/185485/1
authorpr.jung <pr.jung@samsung.com>
Tue, 31 Jul 2018 05:32:45 +0000 (14:32 +0900)
committerpr.jung <pr.jung@samsung.com>
Tue, 31 Jul 2018 05:36:48 +0000 (14:36 +0900)
- Check input param path is mounted

Change-Id: Ief2f3d1703273d93dcd873c17defda7b6bd6c80e
Signed-off-by: pr.jung <pr.jung@samsung.com>
include/common.h
include/storage-internal.h
src/statvfs.c
src/storage-inhouse.c

index 0e8f4a7eefc447509726f8ec7d81a01fc838e9b5..af8bc3fe862d5ec47d0bd0a64e424f5410358071 100644 (file)
@@ -85,6 +85,7 @@ int storage_get_external_memory_size64_with_path(char *path, struct statvfs *buf
 #define COMPAT_DIR "/opt/usr/media"
 int is_compat_bind_mount(void);
 int storage_ext_is_supported(void);
+int mount_check(char *path);
 
 #define USER_UID_START         5000
 
index e3bd50ab3ac9f71ec2faf927ff5d5134d169b722..5548d8461282df98abfaab1945abf1a3087119f9 100644 (file)
@@ -139,6 +139,19 @@ int storage_request_format_mmc(struct mmc_contents *mmc_data);
  */
 int storage_format_mmc(struct mmc_contents *mmc_data, int option);
 
+/**
+ * @brief This API is used to format mmc.\n
+ *
+ * @param[in] path for checking mounted
+ * @param[out] mounted True when path is mounted
+ *
+ * @return @c 0 on success,
+ *         otherwise a negative error value
+ *
+ * @retval #STORAGE_ERROR_NONE               Successful
+ */
+int storage_is_mounted(char *path, bool *mounted);
+
 /**
  * @}
  */
index 99ed755b7010bca3742edd0599ba0678283ad598..2c470cc7c0f7e20980932296caecc0fc12aa5601 100644 (file)
@@ -288,7 +288,7 @@ API int storage_get_internal_memory_size64(struct statvfs *buf)
        return 0;
 }
 
-static int mount_check(char *path)
+int mount_check(char *path)
 {
        int ret = false;
        struct mntent *mnt;
index 060a36d6b7470a3fa053c2e890b29fee4b3d7862..efd62dbdfa8579dc7a2a41b51873b2114cc21b97 100755 (executable)
@@ -418,3 +418,13 @@ API int storage_format_mmc(struct mmc_contents *mmc_data, int option)
 
        return STORAGE_ERROR_NONE;
 }
+
+int storage_is_mounted(char *path, bool *mounted)
+{
+       int ret;
+
+       ret = mount_check(path);
+
+       *mounted = ret;
+       return STORAGE_ERROR_NONE;
+}