libtzplatform-config
mount
blkid
+ capi-system-info
)
SET(pc_dependents "capi-base-common")
* @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
* @retval #STORAGE_ERROR_NOT_SUPPORTED Storage not supported
+ * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
* @see storage_get_state()
*/
int storage_get_root_directory(int storage_id, char **path);
* @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
* @retval #STORAGE_ERROR_NOT_SUPPORTED Storage not supported
+ * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
* @see storage_get_state()
*/
int storage_get_directory(int storage_id, storage_directory_e type, char **path);
* otherwise a negative error value
* @retval #STORAGE_ERROR_NONE Successful
* @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
* @retval #STORAGE_ERROR_NOT_SUPPORTED Storage not supported
+ * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
*/
int storage_get_type(int storage_id, storage_type_e *type);
* otherwise a negative error value
* @retval #STORAGE_ERROR_NONE Successful
* @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
* @retval #STORAGE_ERROR_NOT_SUPPORTED Storage not supported
+ * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
* @see storage_get_root_directory()
* @see storage_get_total_space()
* @see storage_get_available_space()
* otherwise a negative error value
* @retval #STORAGE_ERROR_NONE Successful
* @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
* @retval #STORAGE_ERROR_NOT_SUPPORTED Storage not supported
* @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
* @see storage_get_state()
* otherwise a negative error value
* @retval #STORAGE_ERROR_NONE Successful
* @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
* @retval #STORAGE_ERROR_NOT_SUPPORTED Storage not supported
* @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
* @see storage_get_state()
*
* @retval #STORAGE_ERROR_NONE Successful
* @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
- * @retval #STORAGE_ERROR_NO_DEVICE No such device
- * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
- * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #STORAGE_ERROR_NOT_SUPPORTED Storage not supported
+ * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
*/
int storage_get_primary_sdcard(int *storage_id, char **path);
* @retval #STORAGE_ERROR_NONE Successful
* @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #STORAGE_ERROR_NO_DEVICE No such device
- * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
- * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
*/
int storage_request_mount_mmc(struct mmc_contents *mmc_data);
* @retval #STORAGE_ERROR_NONE Successful
* @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #STORAGE_ERROR_NO_DEVICE No such device
- * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
- * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
*/
int storage_request_unmount_mmc(struct mmc_contents *mmc_data, int option);
* @retval #STORAGE_ERROR_NONE Successful
* @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #STORAGE_ERROR_NO_DEVICE No such device
- * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
- * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
*/
int storage_request_format_mmc(struct mmc_contents *mmc_data);
* @retval #STORAGE_ERROR_NONE Successful
* @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
* @retval #STORAGE_ERROR_NO_DEVICE No such device
- * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
- * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
*/
int storage_format_mmc(struct mmc_contents *mmc_data, int option);
* otherwise a negative error value
*
* @retval #STORAGE_ERROR_NONE Successful
- * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
- * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
+ * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
+ * @retval #STORAGE_ERROR_OUT_OF_MEMORY Out of memory
*/
int storage_is_mounted_opt_usr(storage_part_mount_e *mounted);
BuildRequires: pkgconfig(libtzplatform-config)
BuildRequires: pkgconfig(mount)
BuildRequires: pkgconfig(blkid)
+BuildRequires: pkgconfig(capi-system-info)
%description
development package of library to get storage
goto out_nodev;
ret = storage_ext_get_statvfs(ext_path, &temp);
- if (ret) {
+ if (ret != 0) {
_E("fail to get memory size"); //LCOV_EXCL_LINE
return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
}
goto out_nodev;
ret = storage_ext_get_statvfs_size64(ext_path, buf);
- if (ret) {
+ if (ret != 0) {
//LCOV_EXCL_START System Error
_E("fail to get memory size");
return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
#include <unistd.h>
#include <libmount.h>
+#include <system_info.h>
#include "common.h"
-#define BLOCK_CONF_FILE "/etc/storaged/block.conf"
+#define EXTERNAL_FEATURE "http://tizen.org/feature/storage.external"
int is_compat_bind_mount(void)
{
int storage_ext_is_supported(void)
{
static int support = -1;
+ int ret;
+ bool ext_avail;
if (support >= 0)
return support;
- if (access(BLOCK_CONF_FILE, R_OK) == 0)
- support = 1;
- else
+ ret = system_info_get_platform_bool(EXTERNAL_FEATURE, &ext_avail);
+ if (ret < 0)
+ support = 0;
+ else if (ret == 0 && !ext_avail)
support = 0;
+ else
+ support = 1;
return support;
}
storage_ext_device *dev;
if (storage_id < 0)
- return -ENOTSUP;
+ return -ENODEV;
dev = calloc(1, sizeof(storage_ext_device));
if (!dev) {
int ret = 0;
if (storage_id < 0)
- return -ENOTSUP;
+ return -ENODEV;
if (!path)
return -EINVAL;
int ret;
if (storage_id < 0)
- return -ENOTSUP;
+ return -ENODEV;
if (!state)
return -EINVAL;
return STORAGE_ERROR_INVALID_PARAMETER;
if (!storage_ext_is_supported())
- return STORAGE_ERROR_NO_DEVICE;
+ return STORAGE_ERROR_NOT_SUPPORTED;
result = dbus_method_call_sync(STORAGE_EXT_BUS_NAME,
STORAGE_EXT_PATH_MANAGER,
bool user = true;
if (storage_id < 0)
- return STORAGE_ERROR_NOT_SUPPORTED;
+ return STORAGE_ERROR_INVALID_PARAMETER;
if (!path) {
_E("Invalid parameger");
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;
+ if (ret == -ENODEV || ret == -EINVAL)
+ return STORAGE_ERROR_INVALID_PARAMETER;
+ else if (ret == -ENOMEM)
+ return STORAGE_ERROR_OUT_OF_MEMORY;
+ else
+ return STORAGE_ERROR_OPERATION_FAILED;
}
*path = strdup(root);
bool user = true;
if (storage_id < 0)
- return STORAGE_ERROR_NOT_SUPPORTED;
+ return STORAGE_ERROR_INVALID_PARAMETER;
if (!path) {
_E("Invalid parameger");
/* external storage */
if (type == STORAGE_DIRECTORY_SYSTEM_RINGTONES) {
_E("Not support directory : id(%d) type(%d)", storage_id, type); //LCOV_EXCL_LINE
- return STORAGE_ERROR_NOT_SUPPORTED;
+ return STORAGE_ERROR_INVALID_PARAMETER;
}
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_NOT_SUPPORTED;
+ if (ret == -ENODEV || ret == -EINVAL)
+ return STORAGE_ERROR_INVALID_PARAMETER;
+ else if (ret == -ENOMEM)
+ return STORAGE_ERROR_OUT_OF_MEMORY;
+ else
+ return STORAGE_ERROR_OPERATION_FAILED;
}
/* The operation is not decided */
if (extendedint)
- return STORAGE_ERROR_NOT_SUPPORTED;
+ return STORAGE_ERROR_INVALID_PARAMETER;
snprintf(temp, sizeof(temp), "%s/%s", root, dir_path[type]);
bool extendedint;
if (storage_id < 0)
- return STORAGE_ERROR_NOT_SUPPORTED;
+ return STORAGE_ERROR_INVALID_PARAMETER;
if (!type) {
_E("Invalid parameger");
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 (ret == -ENODEV || ret == -EINVAL)
+ return STORAGE_ERROR_INVALID_PARAMETER;
+ else if (ret == -ENOMEM)
+ return STORAGE_ERROR_OUT_OF_MEMORY;
+ else
+ return STORAGE_ERROR_OPERATION_FAILED;
}
if (extendedint)
*type = STORAGE_TYPE_EXTENDED_INTERNAL;
int ret;
if (storage_id < 0)
- return STORAGE_ERROR_NOT_SUPPORTED;
+ return STORAGE_ERROR_INVALID_PARAMETER;
if (!state) {
_E("Invalid parameger");
ret = storage_ext_get_state(storage_id, &st);
if (ret < 0) {
_E("Failed to get state (storage id(%d), ret(%d))", storage_id, ret); //LCOV_EXCL_LINE
- return STORAGE_ERROR_OPERATION_FAILED;
+ if (ret == -ENODEV || ret == -EINVAL)
+ return STORAGE_ERROR_INVALID_PARAMETER;
+ else if (ret == -ENOMEM)
+ return STORAGE_ERROR_OUT_OF_MEMORY;
+ else
+ return STORAGE_ERROR_OPERATION_FAILED;
}
*state = st;
static int compat_cb_init = 0;
if (storage_id < 0)
- return STORAGE_ERROR_NOT_SUPPORTED;
+ return STORAGE_ERROR_INVALID_PARAMETER;
if (!callback) {
_E("Invalid parameger");
dd_list *elem;
if (storage_id < 0)
- return STORAGE_ERROR_NOT_SUPPORTED;
+ return STORAGE_ERROR_INVALID_PARAMETER;
if (!callback) {
_E("Invalid parameger");
dd_list *elem;
if (storage_id < 0)
- return STORAGE_ERROR_NOT_SUPPORTED;
+ return STORAGE_ERROR_INVALID_PARAMETER;
if (!bytes) {
_E("Invalid parameger");
out:
if (ret < 0) {
_E("Failed to get total memory : id(%d)", storage_id); //LCOV_EXCL_LINE
- if (ret == -ENOTSUP)
- return STORAGE_ERROR_NOT_SUPPORTED;
- return STORAGE_ERROR_OPERATION_FAILED;
+ if (ret == -ENODEV || ret == -EINVAL)
+ return STORAGE_ERROR_INVALID_PARAMETER;
+ else if (ret == -ENOMEM)
+ return STORAGE_ERROR_OUT_OF_MEMORY;
+ else
+ return STORAGE_ERROR_OPERATION_FAILED;
}
*bytes = total;
dd_list *elem;
if (storage_id < 0)
- return STORAGE_ERROR_NOT_SUPPORTED;
+ return STORAGE_ERROR_INVALID_PARAMETER;
if (!bytes) {
_E("Invalid parameger");
out:
if (ret < 0) {
_E("Failed to get available memory : id(%d)", storage_id); //LCOV_EXCL_LINE
- if (ret == -ENOTSUP)
- return STORAGE_ERROR_NOT_SUPPORTED;
- return STORAGE_ERROR_OPERATION_FAILED;
+ if (ret == -ENODEV || ret == -EINVAL)
+ return STORAGE_ERROR_INVALID_PARAMETER;
+ else if (ret == -ENOMEM)
+ return STORAGE_ERROR_OUT_OF_MEMORY;
+ else
+ return STORAGE_ERROR_OPERATION_FAILED;
}
*bytes = avail;
if (type == STORAGE_TYPE_INTERNAL) {
_E("Internal storage is not supported");
- return STORAGE_ERROR_NOT_SUPPORTED;
+ return STORAGE_ERROR_INVALID_PARAMETER;
}
if (type != STORAGE_TYPE_EXTERNAL && type != STORAGE_TYPE_EXTENDED_INTERNAL) {
if (type == STORAGE_TYPE_INTERNAL) {
_E("Internal storage is not supported");
- return STORAGE_ERROR_NOT_SUPPORTED;
+ return STORAGE_ERROR_INVALID_PARAMETER;
}
if (type != STORAGE_TYPE_EXTERNAL && type != STORAGE_TYPE_EXTENDED_INTERNAL) {
ret = storage_ext_get_device_info(storage_id, ext_dev);
if (ret < 0) {
_E("Cannot get the storage with id (%d, ret:%d)", storage_id, ret); //LCOV_EXCL_LINE
+ if (ret == -ENODEV) {
+ ret = STORAGE_ERROR_INVALID_PARAMETER;
+ goto out;
+ }
ret = STORAGE_ERROR_OPERATION_FAILED;
goto out;
}