#include <sys/statvfs.h>
-#include "storage-expand.h"
+#include <storage-expand.h>
/**
- * @brief int storage_get_internal_memory_size(struct statvfs *buf).
- * @brief This generic API is used to get the internal memory size.
+ * @brief Gets the internal memory size.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[out] buf A pointer to a statvfs structure
* @return @c 0 on success,
* otherwise a negative error value on failure
+ * @retval #STORAGE_ERROR_NONE Successful
+ * @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
* @par Example:
* @code
* ...
/**
- * @brief int storage_get_external_memory_size(struct statvfs *buf).
- * @brief This generic API is used to get the external memory size.
+ * @brief Gets the external memory size.
* @since_tizen @if MOBILE 2.3 @elseif WEARABLE 2.3.1 @endif
* @param[out] buf A pointer to a statvfs structure
* @return @c 0 on success,
* otherwise a negative error value on failure
+ * @retval #STORAGE_ERROR_NONE Successful
+ * @retval #STORAGE_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #STORAGE_ERROR_OPERATION_FAILED Operation failed
* @par Example:
* @code
* ...
if (!buf) {
_E("input param error");
- return -EINVAL;
+ return STORAGE_ERROR_INVALID_PARAMETER;
}
ret = get_memory_size(tzplatform_getenv(TZ_SYS_USER), &temp);
if (ret || temp.f_bsize == 0) {
_E("fail to get memory size %d", ret); //LCOV_EXCL_LINE
- return -errno; //LCOV_EXCL_LINE System Error
+ return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
}
if (reserved == 0) {
temp.f_bavail -= reserved;
memcpy(buf, &temp, sizeof(temp));
- return 0;
+ return STORAGE_ERROR_NONE;
}
/* This api is intended for binaries built with __USE_FILE_OFFSET64(_FILE_OFFSET_BITS=64) */
if (!buf) {
_E("input param error"); //LCOV_EXCL_LINE
- return -EINVAL;
+ return STORAGE_ERROR_INVALID_PARAMETER;
}
ret = statvfs(tzplatform_getenv(TZ_SYS_USER), buf);
if (ret) {
_E("fail to get memory size"); //LCOV_EXCL_LINE
- return -errno; //LCOV_EXCL_LINE System Error
+ return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
}
if (reserved == 0) {
buf->f_bavail = 0;
else
buf->f_bavail -= reserved;
- return 0;
+ return STORAGE_ERROR_NONE;
}
int mount_check(const char *path)
_D("storage_get_external_memory_size");
if (!buf) {
_E("input param error");
- return -EINVAL;
+ return STORAGE_ERROR_INVALID_PARAMETER;
}
if (path)
goto out_nodev;
if (ret < 0) {
_E("Failed to get external path(%d)", ret); //LCOV_EXCL_LINE
- return ret;
+ return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
}
}
ret = storage_ext_get_statvfs(ext_path, &temp);
if (ret) {
_E("fail to get memory size"); //LCOV_EXCL_LINE
- return ret; //LCOV_EXCL_LINE System Error
+ return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
}
memcpy(buf, &temp, sizeof(temp));
out_nodev:
memset(buf, 0, sizeof(struct statvfs_32));
- return 0;
+ return STORAGE_ERROR_NONE;
}
/* This api is intended for binaries built with __USE_FILE_OFFSET64(_FILE_OFFSET_BITS=64) */
_D("storage_get_external_memory_size64");
if (!buf) {
_E("input param error");
- return -EINVAL;
+ return STORAGE_ERROR_INVALID_PARAMETER;
}
if (path)
goto out_nodev;
if (ret < 0) {
_E("Failed to get external path(%d)", ret);
- return ret;
+ return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
}
}
if (ret) {
//LCOV_EXCL_START System Error
_E("fail to get memory size");
- return -errno;
+ return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
//LCOV_EXCL_STOP
}
- return 0;
+ return STORAGE_ERROR_NONE;
out_nodev:
memset(buf, 0, sizeof(struct statvfs));