Check block module enabled before sending GetMmcPrimary dbus method 74/183874/1 accepted/tizen/4.0/unified/20180712.142258 submit/tizen_4.0/20180712.053653
authorpr.jung <pr.jung@samsung.com>
Thu, 12 Jul 2018 04:29:48 +0000 (13:29 +0900)
committerHyotaek Shim <hyotaek.shim@samsung.com>
Thu, 12 Jul 2018 05:08:15 +0000 (05:08 +0000)
Change-Id: I2634ba2130c35f7c3ccca9e8164ac9c73a9d47a3
Signed-off-by: pr.jung <pr.jung@samsung.com>
(cherry picked from commit 924ade1b560e5798eb261dc1187df77eaa8f3410)

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 a736890..2c13dad 100755 (executable)
@@ -148,6 +148,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 d79a00d..6fdc8f9 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;