Check block module enabled before sending GetMmcPrimary dbus method 72/183872/1 accepted/tizen/unified/20180712.142302 submit/tizen/20180712.053331
authorpr.jung <pr.jung@samsung.com>
Thu, 12 Jul 2018 04:29:48 +0000 (13:29 +0900)
committerpr.jung <pr.jung@samsung.com>
Thu, 12 Jul 2018 04:29:48 +0000 (13:29 +0900)
Change-Id: I2634ba2130c35f7c3ccca9e8164ac9c73a9d47a3
Signed-off-by: pr.jung <pr.jung@samsung.com>
include/common.h
src/storage-common.c
src/storage-inhouse.c
src/storage.c

index f208338..dd6f966 100644 (file)
@@ -84,6 +84,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);
 
 #ifdef __cplusplus
 }
index ba76cc8..ea8e174 100644 (file)
  * limitations under the License.
  */
 
-
+#include <unistd.h>
 #include <libmount.h>
 #include "common.h"
 
+#define BLOCK_CONF_FILE         "/etc/storaged/block.conf"
+
 int is_compat_bind_mount(void)
 {
        struct libmnt_table *t = NULL;
@@ -50,3 +52,19 @@ int is_compat_bind_mount(void)
        return 0;
        //LCOV_EXCL_STOP
 }
+
+int storage_ext_is_supported(void)
+{
+       static int support = -1;
+
+       if (support >= 0)
+               return support;
+
+       if (access(BLOCK_CONF_FILE, R_OK) == 0)
+               support = 1;
+       else
+               support = 0;
+
+       return support;
+}
+
index d5ed6b5..2023a56 100755 (executable)
@@ -149,6 +149,9 @@ API int storage_get_primary_sdcard(int *storage_id, char **path)
        if (!storage_id || !path)
                return STORAGE_ERROR_INVALID_PARAMETER;
 
+       if (!storage_ext_is_supported())
+               return STORAGE_ERROR_NO_DEVICE;
+
        result = dbus_method_call_sync(STORAGE_EXT_BUS_NAME,
                        STORAGE_EXT_PATH_MANAGER,
                        STORAGE_EXT_IFACE_MANAGER,
index 9a45507..6dfef6d 100644 (file)
@@ -27,7 +27,6 @@
 #include "log.h"
 #include "storage-external.h"
 
-#define BLOCK_CONF_FILE         "/etc/storaged/block.conf"
 #define USER_UID_START         5000
 
 const char *dir_path[STORAGE_DIRECTORY_MAX];
@@ -61,21 +60,6 @@ void remove_device(const struct storage_ops *st)
        DD_LIST_REMOVE(st_int_head, st);
 }
 
-int storage_ext_is_supported(void)
-{
-       static int support = -1;
-
-       if (support >= 0)
-               return support;
-
-       if (access(BLOCK_CONF_FILE, R_OK) == 0)
-               support = 1;
-       else
-               support = 0;
-
-       return support;
-}
-
 API int storage_foreach_device_supported(storage_device_supported_cb callback, void *user_data)
 {
        const struct storage_ops *st;