* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
*/
typedef enum {
- STORAGE_TYPE_INTERNAL, /**< Internal device storage (built-in storage in a device, non-removable) */
- STORAGE_TYPE_EXTERNAL, /**< External storage */
+ STORAGE_TYPE_INTERNAL, /**< Internal device storage (built-in storage in a device, non-removable) */
+ STORAGE_TYPE_EXTERNAL, /**< External storage */
+ STORAGE_TYPE_EXTENDED_INTERNAL, /**< Extended internal storage (External storage used as internal storage) (Since 4.0) */
} storage_type_e;
* @since_tizen 3.0
*/
typedef enum {
- STORAGE_DEV_EXT_SDCARD = 1001, /**< sdcard device (external storage) */
- STORAGE_DEV_EXT_USB_MASS_STORAGE, /**< USB storage device (external storage) */
+ STORAGE_DEV_EXT_SDCARD = 1001, /**< SD card device (external storage) */
+ STORAGE_DEV_EXT_USB_MASS_STORAGE, /**< USB storage device (external storage) */
+ STORAGE_DEV_EXTENDED_INTERNAL, /**< Extended internal storage device (External storage used as internal storage) (Since 4.0) */
} storage_dev_e;
* @since_tizen 3.0
*
* @param[in] storage_id The storage id
- * @param[out] type storage type (internal or external).
- * @param[out] dev the kind of storage device for external type (sdcard, usb). If type is #STORAGE_TYPE_EXTERNAL, then value of this param is invalid.
+ * @param[out] type The storage @a type (internal or external).
+ * @param[out] dev The storage device for external storage. If @a type is #STORAGE_TYPE_INTERNAL, then value of @a dev should be ignored.
*
* @return @c 0 on success,
* otherwise a negative error value
enum storage_ext_type {
STORAGE_EXT_SCSI,
STORAGE_EXT_MMC,
+ STORAGE_EXT_MMC_EXTENDED_INTERNAL,
};
enum storage_ext_flags {
#include "log.h"
#include "storage-external-dbus.h"
-#define EXTERNAL_STORAGE_PATH "/run/external-storage"
-#define PATH_LEN 55
+#define EXTERNAL_STORAGE_PATH "/run/external-storage"
+#define EXTENDED_INTERNAL_PATH "/run/extended-internal-sd"
+#define PATH_LEN 55
static dd_list *cb_list[STORAGE_CALLBACK_MAX];
continue;
}
- ret_cb = callback(dev->storage_id, STORAGE_TYPE_EXTERNAL,
- state, dev->mount_point, user_data);
+ if (dev->type == STORAGE_EXT_MMC_EXTENDED_INTERNAL)
+ ret_cb = callback(dev->storage_id,
+ STORAGE_TYPE_EXTENDED_INTERNAL,
+ state, dev->mount_point, user_data);
+ else
+ ret_cb = callback(dev->storage_id, STORAGE_TYPE_EXTERNAL,
+ state, dev->mount_point, user_data);
if (!ret_cb)
break;
}
strdev = STORAGE_DEV_EXT_USB_MASS_STORAGE;
else if (dev->type == STORAGE_EXT_MMC)
strdev = STORAGE_DEV_EXT_SDCARD;
+ else if (dev->type == STORAGE_EXT_MMC_EXTENDED_INTERNAL)
+ strdev = STORAGE_DEV_EXTENDED_INTERNAL;
else {
_E("Invalid dev type (%d)", dev->type);
return -EINVAL;
return 0;
}
-int storage_ext_get_root(int storage_id, char *path, size_t len)
+int storage_ext_get_root(int storage_id, char *path, size_t len, bool *extendedinternal)
{
FILE *fp;
storage_ext_device *dev;
char file_name[PATH_LEN];
+ char file_name2[PATH_LEN];
char *tmp;
int ret = 0;
if (!path)
return -EINVAL;
+ if (!extendedinternal)
+ return -EINVAL;
snprintf(file_name, PATH_LEN, EXTERNAL_STORAGE_PATH"/%d", storage_id);
+ snprintf(file_name2, PATH_LEN, EXTENDED_INTERNAL_PATH"/%d", storage_id);
+
+ *extendedinternal = false;
if (access(file_name, R_OK) == 0) {
fp = fopen(file_name, "r");
_D("Failed to get path");
goto out;
}
+ *extendedinternal = false;
+ } else if (access(file_name2, R_OK) == 0) {
+ fp = fopen(file_name2, "r");
+ if (!fp) {
+ _E("Cannot get the storage with id (%d, ret:%d)", storage_id, ret); //LCOV_EXCL_LINE
+ ret = -ENODEV;
+ goto out;
+ }
+ tmp = fgets(path, len, fp);
+ fclose(fp);
+ if (!tmp) {
+ ret = -ENODEV;
+ _D("Failed to get path");
+ goto out;
+ }
+ *extendedinternal = true;
} else {
dev = calloc(1, sizeof(storage_ext_device));
if (!dev) {
}
snprintf(path, len, "%s", dev->mount_point);
+ if (dev->type == STORAGE_EXT_MMC_EXTENDED_INTERNAL)
+ *extendedinternal = true;
+ else
+ *extendedinternal = false;
storage_ext_release_device(&dev);
}
if (ret < 0)
_E("Failed to get state of storage id (%d, ret:%d)", storage_id, ret); //LCOV_EXCL_LINE
-out :
+out:
storage_ext_release_device(&dev);
return ret;
}
int storage_ext_foreach_device_list(storage_device_supported_cb callback, void *user_data);
int storage_ext_register_cb(enum storage_cb_type type, struct storage_cb_info *info);
int storage_ext_unregister_cb(enum storage_cb_type type, struct storage_cb_info *info);
-int storage_ext_get_root(int storage_id, char *path, size_t len);
+int storage_ext_get_root(int storage_id, char *path, size_t len, bool *extendedinternal);
int storage_ext_get_state(int storage_id, storage_state_e *state);
int storage_ext_get_primary_mmc_path(char *path, size_t len);
dd_list *elem;
char root[PATH_MAX];
int ret;
+ bool extendedint;
if (storage_id < 0)
return STORAGE_ERROR_NOT_SUPPORTED;
}
/* external storage */
- ret = storage_ext_get_root(storage_id, root, sizeof(root));
+ ret = storage_ext_get_root(storage_id, root, sizeof(root), &extendedint);
if (ret < 0) {
_E("Failed to get root path of external storage(%d, %d", storage_id, ret); //LCOV_EXCL_LINE
return STORAGE_ERROR_INVALID_PARAMETER;
int ret;
dd_list *elem;
bool found;
+ bool extendedint;
if (storage_id < 0)
return STORAGE_ERROR_NOT_SUPPORTED;
return STORAGE_ERROR_NOT_SUPPORTED;
}
- ret = storage_ext_get_root(storage_id, root, sizeof(root));
+ ret = storage_ext_get_root(storage_id, root, sizeof(root), &extendedint);
if (ret < 0) {
_E("Failed to get root dir for external storage(id:%d, ret:%d)", storage_id, ret); //LCOV_EXCL_LINE
- return STORAGE_ERROR_OPERATION_FAILED;
+ return STORAGE_ERROR_NOT_SUPPORTED;
}
+ /* The operation is not decided */
+ if (extendedint)
+ return STORAGE_ERROR_NOT_SUPPORTED;
snprintf(temp, sizeof(temp), "%s/%s", root, dir_path[type]);
{
const struct storage_ops *st;
dd_list *elem;
+ char root[PATH_MAX];
+ int ret;
+ bool extendedint;
if (storage_id < 0)
return STORAGE_ERROR_NOT_SUPPORTED;
}
/* external storage */
- *type = STORAGE_TYPE_EXTERNAL;
+ ret = storage_ext_get_root(storage_id, root, sizeof(root), &extendedint);
+ if (ret < 0) {
+ _E("Failed to get type of external storage");
+ return STORAGE_ERROR_NOT_SUPPORTED;
+ }
+ if (extendedint)
+ *type = STORAGE_TYPE_EXTENDED_INTERNAL;
+ else
+ *type = STORAGE_TYPE_EXTERNAL;
return STORAGE_ERROR_NONE;
}
return STORAGE_ERROR_NOT_SUPPORTED;
}
- if (type != STORAGE_TYPE_EXTERNAL) {
+ if (type != STORAGE_TYPE_EXTERNAL && type != STORAGE_TYPE_EXTENDED_INTERNAL) {
_E("Invalid type (%d)", type);
return STORAGE_ERROR_INVALID_PARAMETER;
}
return STORAGE_ERROR_NOT_SUPPORTED;
}
- if (type != STORAGE_TYPE_EXTERNAL) {
+ if (type != STORAGE_TYPE_EXTERNAL && type != STORAGE_TYPE_EXTENDED_INTERNAL) {
_E("Invalid type (%d)", type);
return STORAGE_ERROR_INVALID_PARAMETER;
}