if (path)
snprintf(ext_path, sizeof(ext_path), "%s", path);
else {
+ if (!storage_ext_is_supported()) {
+ _D("Block module is not enabled");
+ goto out_nodev;
+ }
ret = get_external_path(ext_path, sizeof(ext_path));
if (ret == -ENODEV)
goto out_nodev;
if (path)
snprintf(ext_path, sizeof(ext_path), "%s", path);
else {
+ if (!storage_ext_is_supported()) {
+ _D("Block module is not enabled");
+ goto out_nodev;
+ }
ret = get_external_path(ext_path, sizeof(ext_path));
if (ret == -ENODEV)
goto out_nodev;
typedef int (*storage_ext_changed_cb)(storage_ext_device *dev, enum storage_ext_state state, void *data);
+int storage_ext_is_supported(void);
void storage_ext_release_device(storage_ext_device **dev);
void storage_ext_release_list(dd_list **list);
int storage_ext_get_list(dd_list **list);
#include "log.h"
#include "storage-external.h"
+#define BLOCK_CONF_FILE "/etc/deviced/block.conf"
const char *dir_path[STORAGE_DIRECTORY_MAX];
const int tz_id[STORAGE_DIRECTORY_MAX] = {
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;
break;
}
+ if (!storage_ext_is_supported()) {
+ _D("Block module is not enabled");
+ return STORAGE_ERROR_NONE;
+ }
+
ret = storage_ext_foreach_device_list(callback, user_data);
if (ret < 0) {
_E("Failed to iterate external devices (%d)", ret); //LCOV_EXCL_LINE
return STORAGE_ERROR_INVALID_PARAMETER;
}
+ if (!storage_ext_is_supported()) {
+ _E("Block module is not enabled");
+ return STORAGE_ERROR_NOT_SUPPORTED;
+ }
+
/* external storage */
info.type = type;
info.type_cb = callback;
return STORAGE_ERROR_INVALID_PARAMETER;
}
+ if (!storage_ext_is_supported()) {
+ _E("Block module is not enabled");
+ return STORAGE_ERROR_NOT_SUPPORTED;
+ }
+
/* external storage */
info.type = type;
info.type_cb = callback;