static void storage_config_load(struct storage_config_info *info)
{
- int ret;
+ int ret_val;
- ret = config_parse(STORAGE_CONF_FILE, load_config, info);
- if (ret < 0)
- _E("Failed to load %s, %d Use default value!", STORAGE_CONF_FILE, ret); //LCOV_EXCL_LINE
+ ret_val = config_parse(STORAGE_CONF_FILE, load_config, info);
+ if (ret_val < 0)
+ _E("Failed to load %s, %d Use default value!", STORAGE_CONF_FILE, ret_val); //LCOV_EXCL_LINE
}
static int get_memory_size(const char *path, struct statvfs_32 *buf)
{
struct statvfs s;
- int ret;
+ int ret_val;
assert(buf);
- ret = statvfs(path, &s);
- if (ret)
+ ret_val = statvfs(path, &s);
+ if (ret_val)
return -errno; //LCOV_EXCL_LINE System Error
memset(buf, 0, sizeof(struct statvfs_32));
{
struct statvfs_32 temp;
static unsigned long reserved = 0;
- int ret;
+ int ret_val;
if (!buf) {
_E("input param error");
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
+ ret_val = get_memory_size(tzplatform_getenv(TZ_SYS_USER), &temp);
+ if (ret_val || temp.f_bsize == 0) {
+ _E("fail to get memory size %d", ret_val); //LCOV_EXCL_LINE
return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
}
API int storage_get_internal_memory_size64(struct statvfs *buf)
{
static unsigned long reserved = 0;
- int ret;
+ int ret_val;
if (!buf) {
_E("input param error"); //LCOV_EXCL_LINE
return STORAGE_ERROR_INVALID_PARAMETER;
}
- ret = statvfs(tzplatform_getenv(TZ_SYS_USER), buf);
- if (ret) {
+ ret_val = statvfs(tzplatform_getenv(TZ_SYS_USER), buf);
+ if (ret_val) {
_E("fail to get memory size"); //LCOV_EXCL_LINE
return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
}
int storage_get_external_memory_size_with_path(char *path, struct statvfs *buf)
{
struct statvfs_32 temp;
- int ret;
+ int ret_val;
char ext_path[32];
_D("storage_get_external_memory_size");
_D("Block module is not enabled");
return STORAGE_ERROR_NOT_SUPPORTED;
}
- ret = get_external_path(ext_path, sizeof(ext_path));
- if (ret == -ENODEV)
+ ret_val = get_external_path(ext_path, sizeof(ext_path));
+ if (ret_val == -ENODEV)
goto out_nodev;
- if (ret < 0) {
- _E("Failed to get external path(%d)", ret); //LCOV_EXCL_LINE
+ if (ret_val < 0) {
+ _E("Failed to get external path(%d)", ret_val); //LCOV_EXCL_LINE
return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
}
}
if (!mount_check((const char *)ext_path))
goto out_nodev;
- ret = storage_ext_get_statvfs(ext_path, &temp);
- if (ret != 0) {
+ ret_val = storage_ext_get_statvfs(ext_path, &temp);
+ if (ret_val != 0) {
_E("fail to get memory size"); //LCOV_EXCL_LINE
return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
}
/* This api is intended for binaries built with __USE_FILE_OFFSET64(_FILE_OFFSET_BITS=64) */
int storage_get_external_memory_size64_with_path(char *path, struct statvfs *buf)
{
- int ret;
+ int ret_val;
char ext_path[32];
_D("storage_get_external_memory_size64");
_D("Block module is not enabled");
return STORAGE_ERROR_NOT_SUPPORTED;
}
- ret = get_external_path(ext_path, sizeof(ext_path));
- if (ret == -ENODEV)
+ ret_val = get_external_path(ext_path, sizeof(ext_path));
+ if (ret_val == -ENODEV)
goto out_nodev;
- if (ret < 0) {
- _E("Failed to get external path(%d)", ret);
+ if (ret_val < 0) {
+ _E("Failed to get external path(%d)", ret_val);
return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
}
}
if (!mount_check((const char *)ext_path))
goto out_nodev;
- ret = storage_ext_get_statvfs_size64(ext_path, buf);
- if (ret != 0) {
+ ret_val = storage_ext_get_statvfs_size64(ext_path, buf);
+ if (ret_val != 0) {
//LCOV_EXCL_START System Error
_E("fail to get memory size");
return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
int storage_ext_is_supported(void)
{
static int support = -1;
- int ret;
+ int ret_val;
bool ext_avail;
if (support >= 0)
return support;
- ret = system_info_get_platform_bool(EXTERNAL_FEATURE, &ext_avail);
- if (ret < 0)
+ ret_val = system_info_get_platform_bool(EXTERNAL_FEATURE, &ext_avail);
+ if (ret_val < 0)
support = 0;
- else if (ret == 0 && !ext_avail)
+ else if (ret_val == 0 && !ext_avail)
support = 0;
else
support = 1;
int storage_ext_get_list(GList **list)
{
- GVariant *result;
+ GVariant *reply;
GVariantIter *iter;
storage_ext_device *elem, info;
- int ret;
+ int ret, ret_dbus;
if (!list)
return -EINVAL;
- ret = dbus_handle_method_sync_with_reply_var(STORAGE_EXT_BUS_NAME,
+ ret_dbus = dbus_handle_method_sync_with_reply_var(STORAGE_EXT_BUS_NAME,
STORAGE_EXT_PATH_MANAGER,
STORAGE_EXT_IFACE_MANAGER,
STORAGE_EXT_GET_LIST,
g_variant_new("(s)", "all"),
- &result);
- if (ret < 0) {
+ &reply);
+ if (ret_dbus < 0) {
_E("Failed to get storage_ext device info"); //LCOV_EXCL_LINE
return -EIO;
}
- if (!g_variant_get_safe(result, "(a(issssssisibii))", &iter)) {
+ if (!g_variant_get_safe(reply, "(a(issssssisibii))", &iter)) {
_E("Failed to get params from gvariant.");
- g_variant_unref(result);
+ g_variant_unref(reply);
return -EIO;
}
if (ret < 0)
storage_ext_release_list(list); //LCOV_EXCL_LINE System Error
g_variant_iter_free(iter);
- g_variant_unref(result);
+ g_variant_unref(reply);
return ret;
}
int storage_ext_get_statvfs(char *path, struct statvfs_32 *buf)
{
- GVariant *result;
- int ret;
+ GVariant *reply;
+ int ret_dbus;
guint64 bsize, frsize, blocks, bfree, bavail, files, ffree, favail, fsid, flag, namemax;
assert(buf);
memset(buf, 0, sizeof(struct statvfs_32));
- ret = dbus_handle_method_sync_with_reply_var(STORAGE_EXT_BUS_NAME,
+ ret_dbus = dbus_handle_method_sync_with_reply_var(STORAGE_EXT_BUS_NAME,
STORAGE_EXT_PATH_STORAGE,
STORAGE_EXT_IFACE_STORAGE,
STORAGE_EXT_GET_STATVFS,
g_variant_new("(s)", path),
- &result);
- if (ret < 0) {
+ &reply);
+ if (ret_dbus < 0) {
_E("Failed to get storage_ext device info"); //LCOV_EXCL_LINE
return -EIO;
}
- if (!g_variant_get_safe(result, "(ttttttttttt)",
+ if (!g_variant_get_safe(reply, "(ttttttttttt)",
&bsize, &frsize, &blocks,
&bfree, &bavail, &files,
&ffree, &favail, &fsid,
&flag, &namemax)) {
_E("Failed to get params from gvariant.");
- g_variant_unref(result);
+ g_variant_unref(reply);
return -EIO;
}
// %llu bsize, frsize, blocks, bfree, bavail, files, ffree, favail, fsid, flag, namemax
int storage_ext_get_statvfs_size64(char *path, struct statvfs *buf)
{
- GVariant *result;
- int ret;
+ GVariant *reply;
+ int ret_dbus;
assert(buf);
memset(buf, 0, sizeof(struct statvfs));
- ret = dbus_handle_method_sync_with_reply_var(STORAGE_EXT_BUS_NAME,
+ ret_dbus = dbus_handle_method_sync_with_reply_var(STORAGE_EXT_BUS_NAME,
STORAGE_EXT_PATH_STORAGE,
STORAGE_EXT_IFACE_STORAGE,
STORAGE_EXT_GET_STATVFS,
g_variant_new("(s)", path),
- &result);
- if (ret < 0) {
+ &reply);
+ if (ret_dbus < 0) {
_E("Failed to get storage_ext device info"); //LCOV_EXCL_LINE
return -EIO;
}
- if (!g_variant_get_safe(result, "(ttttttttttt)",
+ if (!g_variant_get_safe(reply, "(ttttttttttt)",
&(buf->f_bsize), &(buf->f_frsize), &(buf->f_blocks),
&(buf->f_bfree), &(buf->f_bavail), &(buf->f_files),
&(buf->f_ffree), &(buf->f_favail), &(buf->f_fsid),
&(buf->f_flag), &(buf->f_namemax))) {
_E("Failed to get params from gvariant.");
- g_variant_unref(result);
+ g_variant_unref(reply);
return -EIO;
}
int storage_ext_get_storage_level(const char *path, char **level)
{
- GVariant *result;
- int ret;
- char *tmp;
+ GVariant *reply;
+ int ret_dbus;
+ char *reply_val;
enum tzplatform_variable id;
if (!strcmp(path, tzplatform_getenv(TZ_SYS_USER)))
return -EINVAL;
}
- ret = dbus_handle_method_sync_with_reply_var(STORAGE_EXT_BUS_NAME,
+ ret_dbus = dbus_handle_method_sync_with_reply_var(STORAGE_EXT_BUS_NAME,
STORAGE_EXT_PATH_STORAGE,
STORAGE_EXT_IFACE_STORAGE,
STORAGE_EXT_GET_STORAGE_LEVEL,
g_variant_new("(i)", id),
- &result);
- if (ret < 0) {
+ &reply);
+ if (ret_dbus < 0) {
_E("Failed to get %d level", id);
return -EIO;
}
- if (!g_variant_get_safe(result, "(s)", &tmp)) {
+ if (!g_variant_get_safe(reply, "(s)", &reply_val)) {
_E("Failed to get params from gvariant.");
- g_variant_unref(result);
+ g_variant_unref(reply);
return -EIO;
}
- *level = strdup(tmp);
- g_free(tmp);
- g_variant_unref(result);
+ *level = strdup(reply_val);
+ g_free(reply_val);
+ g_variant_unref(reply);
if (*level == NULL)
return -ENOMEM;
storage_ext_device *dev;
GList *elem;
struct storage_ext_callback *callback;
- int ret;
+ int ret_val;
if (!params)
return;
SYS_G_LIST_FOREACH(changed_list, elem, callback) {
if (!callback->func)
continue;
- ret = callback->func(dev, state, callback->data);
- if (ret < 0)
- _E("Failed to call callback for devnode(%s, %d)", dev->devnode, ret);
+ ret_val = callback->func(dev, state, callback->data);
+ if (ret_val < 0)
+ _E("Failed to call callback for devnode(%s, %d)", dev->devnode, ret_val);
}
storage_ext_release_device(&dev);
int storage_ext_get_device_info(int storage_id, storage_ext_device *info)
{
- GVariant *result;
- int ret;
+ GVariant *reply;
+ int ret_dbus;
- ret = dbus_handle_method_sync_with_reply_var(STORAGE_EXT_BUS_NAME,
+ ret_dbus = dbus_handle_method_sync_with_reply_var(STORAGE_EXT_BUS_NAME,
STORAGE_EXT_PATH_MANAGER,
STORAGE_EXT_IFACE_MANAGER,
"GetDeviceInfo",
g_variant_new("(i)", storage_id),
- &result);
- if (ret < 0) {
+ &reply);
+ if (ret_dbus < 0) {
_E("There is no storage with the storage id (%d)", storage_id); //LCOV_EXCL_LINE
return -ENODEV;
}
- if (!g_variant_get_safe(result, "(issssssisibii)",
+ if (!g_variant_get_safe(reply, "(issssssisibii)",
&info->type, &info->devnode, &info->syspath,
&info->fs_usage, &info->fs_type,
&info->fs_version, &info->fs_uuid,
&info->state, &info->primary,
&info->flags, &info->storage_id)) {
_E("No storage with the storage id (%d)", storage_id); //LCOV_EXCL_LINE
- ret = -ENODEV;
+ ret_dbus = -ENODEV;
goto out;
}
if (info->storage_id < 0) {
_E("No storage with the storage id (%d)", storage_id); //LCOV_EXCL_LINE
- ret = -ENODEV;
+ ret_dbus = -ENODEV;
goto out;
}
- ret = 0;
out:
- g_variant_unref(result);
- return ret;
+ g_variant_unref(reply);
+ return 0;
}
int storage_ext_foreach_device_list(storage_device_supported_cb callback, void *user_data)
{
- int ret;
+ int ret_val;
bool ret_cb;
GList *list = NULL, *elem;
storage_ext_device *dev;
if (!callback)
return -EINVAL;
- ret = storage_ext_get_list(&list);
- if (ret < 0) {
+ ret_val = storage_ext_get_list(&list);
+ if (ret_val < 0) {
_E("Failed to get external storage list from deviced (%d)", errno); //LCOV_EXCL_LINE
- return ret;
+ return ret_val;
}
SYS_G_LIST_FOREACH(list, elem, dev) {
- ret = storage_ext_get_dev_state(dev, STORAGE_EXT_CHANGED, &state);
- if (ret < 0) {
- _E("Failed to get storage state (devnode:%s, ret:%d)", dev->devnode, ret); //LCOV_EXCL_LINE
+ ret_val = storage_ext_get_dev_state(dev, STORAGE_EXT_CHANGED, &state);
+ if (ret_val < 0) {
+ _E("Failed to get storage state (devnode:%s, ret_val:%d)", dev->devnode, ret_val); //LCOV_EXCL_LINE
continue;
}
struct storage_cb_info *cb_info;
GList *elem;
storage_state_e state;
- int ret;
+ int ret_val;
storage_dev_e strdev;
storage_type_e storage_type;
const char *fstype, *fsuuid, *mountpath;
if (type != STORAGE_CALLBACK_TYPE)
return -EINVAL;
- ret = storage_ext_get_dev_state(dev, blk_state, &state);
- if (ret < 0) {
- _E("Failed to get storage state (devnode:%s, ret:%d)", dev->devnode, ret);
- return ret;
+ ret_val = storage_ext_get_dev_state(dev, blk_state, &state);
+ if (ret_val < 0) {
+ _E("Failed to get storage state (devnode:%s, ret_val:%d)", dev->devnode, ret_val);
+ return ret_val;
}
if (dev->type == STORAGE_EXT_SCSI) {
int storage_ext_register_cb(enum storage_cb_type type, struct storage_cb_info *info)
{
struct storage_cb_info *cb_info;
- int n, ret;
+ int n, ret_val;
storage_ext_changed_cb callback;
if (!info)
n = SYS_G_LIST_LENGTH(cb_list[type]);
if (n == 0) {
- ret = storage_ext_register_device_change(callback, (void *)type);
- if (ret < 0)
+ ret_val = storage_ext_register_device_change(callback, (void *)type);
+ if (ret_val < 0)
return -EPERM;
}
API int storage_get_primary_sdcard(int *storage_id, char **path)
{
- GVariant *result;
- int ret;
- char *mount_point = NULL;
- int id;
+ GVariant *reply;
+ int ret, ret_dbus;
+ char *reply_mount_point = NULL;
+ int reply_id;
if (!storage_id || !path)
return STORAGE_ERROR_INVALID_PARAMETER;
if (!storage_ext_is_supported())
return STORAGE_ERROR_NOT_SUPPORTED;
- ret = dbus_handle_method_sync_with_reply_var(STORAGE_EXT_BUS_NAME,
+ ret_dbus = dbus_handle_method_sync_with_reply_var(STORAGE_EXT_BUS_NAME,
STORAGE_EXT_PATH_MANAGER,
STORAGE_EXT_IFACE_MANAGER,
"GetMmcPrimary",
NULL,
- &result);
- if (ret < 0) {
+ &reply);
+ if (ret_dbus < 0) {
//LCOV_EXCL_START System Error
_E("Failed to get primary sdcard partition"); //LCOV_EXCL_LINE
return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
//LCOV_EXCL_STOP
}
- if (!g_variant_get_safe(result, "(issssssisibii)",
+ if (!g_variant_get_safe(reply, "(issssssisibii)",
NULL, NULL, NULL,
NULL, NULL,
NULL, NULL,
- NULL, &mount_point,
+ NULL, &reply_mount_point,
NULL, NULL,
- NULL, &id)) {
- g_variant_unref(result);
+ NULL, &reply_id)) {
+ g_variant_unref(reply);
return STORAGE_ERROR_OPERATION_FAILED;
}
- g_variant_unref(result);
+ g_variant_unref(reply);
- if (id < 0) {
+ if (reply_id < 0) {
ret = STORAGE_ERROR_NO_DEVICE;
goto out;
}
- *path = strdup(mount_point);
+ *path = strdup(reply_mount_point);
if (*path == NULL) {
ret = STORAGE_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE System Error
goto out;
}
- *storage_id = id;
+ *storage_id = reply_id;
ret = STORAGE_ERROR_NONE;
out:
- g_free(mount_point);
+ g_free(reply_mount_point);
return ret;
}
API int storage_get_storage_level(const char *path, char **level)
{
- int ret;
+ int ret_level;
if (!level || !path)
return STORAGE_ERROR_INVALID_PARAMETER;
- ret = storage_ext_get_storage_level(path, level);
- if (ret == -ENOMEM)
+ ret_level = storage_ext_get_storage_level(path, level);
+ if (ret_level == -ENOMEM)
return STORAGE_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE System Error
- else if (ret == -EINVAL)
+ else if (ret_level == -EINVAL)
return STORAGE_ERROR_INVALID_PARAMETER;
- else if (ret < 0)
+ else if (ret_level < 0)
return STORAGE_ERROR_OPERATION_FAILED;
return STORAGE_ERROR_NONE;
void (*mount_cb)(GVariant *, void *, GError *) = NULL;
void *data = NULL;
char *path;
- int ret;
+ int ret_val;
int id;
if (mmc_data && mmc_data->mmc_cb) {
data = mmc_data;
}
- ret = storage_get_primary_sdcard(&id, &path);
- if (ret != STORAGE_ERROR_NONE)
- return ret;
+ ret_val = storage_get_primary_sdcard(&id, &path);
+ if (ret_val != STORAGE_ERROR_NONE)
+ return ret_val;
//LCOV_EXCL_START System Error
if (path)
free(path);
//LCOV_EXCL_STOP
- ret = dbus_handle_method_async_with_reply_var(STORAGE_EXT_BUS_NAME,
+ ret_val = dbus_handle_method_async_with_reply_var(STORAGE_EXT_BUS_NAME,
STORAGE_EXT_PATH_MANAGER,
STORAGE_EXT_IFACE_MANAGER,
"Mount",
-1,
data);
- _I("Mount Request %s", ret == 0 ? "Success" : "Failed");
+ _I("Mount Request %s", ret_val == 0 ? "Success" : "Failed");
- if (ret == -ENOMEM)
+ if (ret_val == -ENOMEM)
return STORAGE_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE System Error
- if (ret < 0)
+ if (ret_val < 0)
return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
return STORAGE_ERROR_NONE;
void (*unmount_cb)(GVariant *, void *, GError *) = NULL;
void *data = NULL;
char *path;
- int ret;
+ int ret_val;
int id;
if (option < 0 || option > 1)
data = mmc_data;
}
- ret = storage_get_primary_sdcard(&id, &path);
- if (ret != STORAGE_ERROR_NONE)
- return ret;
+ ret_val = storage_get_primary_sdcard(&id, &path);
+ if (ret_val != STORAGE_ERROR_NONE)
+ return ret_val;
//LCOV_EXCL_START System Error
if (path)
free(path);
//LCOV_EXCL_STOP
- ret = dbus_handle_method_async_with_reply_var(STORAGE_EXT_BUS_NAME,
+ ret_val = dbus_handle_method_async_with_reply_var(STORAGE_EXT_BUS_NAME,
STORAGE_EXT_PATH_MANAGER,
STORAGE_EXT_IFACE_MANAGER,
"Unmount",
-1,
data);
- _I("Unmount Request %s", ret == 0 ? "Success" : "Failed");
+ _I("Unmount Request %s", ret_val == 0 ? "Success" : "Failed");
- if (ret == -ENOMEM)
+ if (ret_val == -ENOMEM)
return STORAGE_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE System Error
- if (ret < 0)
+ if (ret_val < 0)
return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
return STORAGE_ERROR_NONE;
void (*format_cb)(GVariant *, void *, GError *) = NULL;
void *data = NULL;
char *path;
- int ret;
+ int ret_val;
int id;
if (option < 0 || option > 1)
data = mmc_data;
}
- ret = storage_get_primary_sdcard(&id, &path);
- if (ret != STORAGE_ERROR_NONE)
- return ret;
+ ret_val = storage_get_primary_sdcard(&id, &path);
+ if (ret_val != STORAGE_ERROR_NONE)
+ return ret_val;
//LCOV_EXCL_START System Error
if (path)
free(path);
//LCOV_EXCL_STOP
- ret = dbus_handle_method_async_with_reply_var(STORAGE_EXT_BUS_NAME,
+ ret_val = dbus_handle_method_async_with_reply_var(STORAGE_EXT_BUS_NAME,
STORAGE_EXT_PATH_MANAGER,
STORAGE_EXT_IFACE_MANAGER,
"Format",
FORMAT_TIMEOUT,
data);
- _I("Format Request %s", ret == 0 ? "Success" : "Failed");
+ _I("Format Request %s", ret_val == 0 ? "Success" : "Failed");
- if (ret == -ENOMEM)
+ if (ret_val == -ENOMEM)
return STORAGE_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE System Error
- if (ret < 0)
+ if (ret_val < 0)
return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
return STORAGE_ERROR_NONE;
blkid_cache cache = NULL;
blkid_dev_iterate iter;
blkid_dev dev;
- int ret;
+ int ret_val;
bool found = false;
if (!mounted)
return STORAGE_ERROR_INVALID_PARAMETER;
- ret = blkid_get_cache(&cache, NULL);
- if (ret < 0) {
+ ret_val = blkid_get_cache(&cache, NULL);
+ if (ret_val < 0) {
_E("Failed to get cache"); //LCOV_EXCL_LINE
*mounted = STORAGE_PART_ERROR; //LCOV_EXCL_LINE
return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
}
- ret = blkid_probe_all(cache);
- if (ret < 0) {
+ ret_val = blkid_probe_all(cache);
+ if (ret_val < 0) {
_E("Failed to probe all block devices"); //LCOV_EXCL_LINE
*mounted = STORAGE_PART_ERROR; //LCOV_EXCL_LINE
return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
return STORAGE_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
}
- ret = blkid_dev_set_search(iter, "LABEL", USER_PARTITION);
+ ret_val = blkid_dev_set_search(iter, "LABEL", USER_PARTITION);
if (blkid_dev_next(iter, &dev) == 0) {
dev = blkid_verify(cache, dev);
if (dev) {
return STORAGE_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE
}
- ret = blkid_dev_set_search(iter, "PARTLABEL", USER_PARTITION);
+ ret_val = blkid_dev_set_search(iter, "PARTLABEL", USER_PARTITION);
if (blkid_dev_next(iter, &dev) == 0) {
dev = blkid_verify(cache, dev);
if (dev) {
blkid_put_cache(cache);
if (found) {
- ret = mount_check(tzplatform_getenv(TZ_SYS_USER));
- if (ret)
+ ret_val = mount_check(tzplatform_getenv(TZ_SYS_USER));
+ if (ret_val)
*mounted = STORAGE_PART_MOUNTED;
else
*mounted = STORAGE_PART_NOT_MOUNTED;
static int internal_get_space(unsigned long long *total, unsigned long long *available)
{
struct statvfs s;
- int ret;
+ int ret_val;
#ifdef __USE_FILE_OFFSET64
- ret = storage_get_internal_memory_size64(&s);
+ ret_val = storage_get_internal_memory_size64(&s);
#else
- ret = storage_get_internal_memory_size(&s);
+ ret_val = storage_get_internal_memory_size(&s);
#endif
- if (ret < 0)
+ if (ret_val < 0)
return -EPERM;
if (total)
{
const struct storage_ops *st;
GList *elem;
- int ret;
+ int ret_val;
bool user = true;
if (!callback) {
SYS_G_LIST_FOREACH(st_int_head, elem, st) {
if (user) {
- ret = callback(st->storage_id, st->type, st->get_state(),
+ ret_val = callback(st->storage_id, st->type, st->get_state(),
st->root(), user_data);
/* if the return value is false, will be stop to iterate */
- if (!ret)
+ if (!ret_val)
break;
}
}
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
+ ret_val = storage_ext_foreach_device_list(callback, user_data);
+ if (ret_val < 0) {
+ _E("Failed to iterate external devices (%d)", ret_val); //LCOV_EXCL_LINE
return STORAGE_ERROR_OPERATION_FAILED;
}
const struct storage_ops *st;
GList *elem;
char root[PATH_MAX];
- int ret;
+ int ret_val;
bool extendedint;
bool user = true;
return STORAGE_ERROR_NOT_SUPPORTED;
}
- 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
- if (ret == -ENODEV || ret == -EINVAL)
+ ret_val = storage_ext_get_root(storage_id, root, sizeof(root), &extendedint);
+ if (ret_val < 0) {
+ _E("Failed to get root path of external storage(%d, %d", storage_id, ret_val); //LCOV_EXCL_LINE
+ if (ret_val == -ENODEV || ret_val == -EINVAL)
return STORAGE_ERROR_INVALID_PARAMETER;
- else if (ret == -ENOMEM)
+ else if (ret_val == -ENOMEM)
return STORAGE_ERROR_OUT_OF_MEMORY;
else
return STORAGE_ERROR_OPERATION_FAILED;
char root[PATH_MAX];
char temp[PATH_MAX];
char *temp2, *end;
- int ret;
+ int ret_val;
GList *elem;
bool found;
bool extendedint;
snprintf(temp, PATH_MAX, "%s", temp2);
free(temp2);
} else {
- if ((ret = snprintf(temp, PATH_MAX, "%s/%s", root, dir_path[type])) > PATH_MAX - 1) {
- _E("Path is longer than buffer. Need %d size of buffer.", ret + 1);
+ if ((ret_val = snprintf(temp, PATH_MAX, "%s/%s", root, dir_path[type])) > PATH_MAX - 1) {
+ _E("Path is longer than buffer. Need %d size of buffer.", ret_val + 1);
return STORAGE_ERROR_OUT_OF_MEMORY;
}
}
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
- if (ret == -ENODEV || ret == -EINVAL)
+ ret_val = storage_ext_get_root(storage_id, root, sizeof(root), &extendedint);
+ if (ret_val < 0) {
+ _E("Failed to get root dir for external storage(id:%d, ret:%d)", storage_id, ret_val); //LCOV_EXCL_LINE
+ if (ret_val == -ENODEV || ret_val == -EINVAL)
return STORAGE_ERROR_INVALID_PARAMETER;
- else if (ret == -ENOMEM)
+ else if (ret_val == -ENOMEM)
return STORAGE_ERROR_OUT_OF_MEMORY;
else
return STORAGE_ERROR_OPERATION_FAILED;
if (extendedint)
return STORAGE_ERROR_INVALID_PARAMETER;
- if ((ret = snprintf(temp, sizeof(temp), "%s/%s", root, dir_path[type])) > sizeof(temp) - 1) {
- _E("Path is longer than buffer. Need %d size of buffer.", ret + 1);
+ if ((ret_val = snprintf(temp, sizeof(temp), "%s/%s", root, dir_path[type])) > sizeof(temp) - 1) {
+ _E("Path is longer than buffer. Need %d size of buffer.", ret_val + 1);
return STORAGE_ERROR_OUT_OF_MEMORY;
}
const struct storage_ops *st;
GList *elem;
char root[PATH_MAX];
- int ret;
+ int ret_val;
bool extendedint;
if (storage_id < 0)
return STORAGE_ERROR_NOT_SUPPORTED;
}
- ret = storage_ext_get_root(storage_id, root, sizeof(root), &extendedint);
- if (ret < 0) {
+ ret_val = storage_ext_get_root(storage_id, root, sizeof(root), &extendedint);
+ if (ret_val < 0) {
_E("Failed to get type of external storage");
- if (ret == -ENODEV || ret == -EINVAL)
+ if (ret_val == -ENODEV || ret_val == -EINVAL)
return STORAGE_ERROR_INVALID_PARAMETER;
- else if (ret == -ENOMEM)
+ else if (ret_val == -ENOMEM)
return STORAGE_ERROR_OUT_OF_MEMORY;
else
return STORAGE_ERROR_OPERATION_FAILED;
const struct storage_ops *ops;
storage_state_e st;
GList *elem;
- int ret;
+ int ret_val;
if (storage_id < 0)
return STORAGE_ERROR_INVALID_PARAMETER;
return STORAGE_ERROR_NOT_SUPPORTED;
}
- 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
- if (ret == -ENODEV || ret == -EINVAL)
+ ret_val = storage_ext_get_state(storage_id, &st);
+ if (ret_val < 0) {
+ _E("Failed to get state (storage id(%d), ret_val(%d))", storage_id, ret_val); //LCOV_EXCL_LINE
+ if (ret_val == -ENODEV || ret_val == -EINVAL)
return STORAGE_ERROR_INVALID_PARAMETER;
- else if (ret == -ENOMEM)
+ else if (ret_val == -ENOMEM)
return STORAGE_ERROR_OUT_OF_MEMORY;
else
return STORAGE_ERROR_OPERATION_FAILED;
{
const struct storage_ops *st;
struct storage_cb_info info;
- int ret;
+ int ret_val;
GList *elem;
if (storage_id < 0)
info.id = storage_id;
info.state_cb = callback;
- ret = storage_ext_unregister_cb(STORAGE_CALLBACK_ID, &info);
- if (ret < 0) {
+ ret_val = storage_ext_unregister_cb(STORAGE_CALLBACK_ID, &info);
+ if (ret_val < 0) {
_E("Failed to unregister callback : id(%d)", storage_id); //LCOV_EXCL_LINE
return STORAGE_ERROR_OPERATION_FAILED;
}
{
const struct storage_ops *st;
unsigned long long total;
- int ret;
+ int ret_val;
GList *elem;
if (storage_id < 0)
SYS_G_LIST_FOREACH(st_int_head, elem, st) {
if (st->storage_id != storage_id)
continue;
- ret = st->get_space(&total, NULL);
+ ret_val = st->get_space(&total, NULL);
goto out;
}
return STORAGE_ERROR_NOT_SUPPORTED;
}
- ret = storage_ext_get_space(storage_id, &total, NULL);
+ ret_val = storage_ext_get_space(storage_id, &total, NULL);
out:
- if (ret < 0) {
+ if (ret_val < 0) {
_E("Failed to get total memory : id(%d)", storage_id); //LCOV_EXCL_LINE
- if (ret == -ENODEV || ret == -EINVAL)
+ if (ret_val == -ENODEV || ret_val == -EINVAL)
return STORAGE_ERROR_INVALID_PARAMETER;
- else if (ret == -ENOMEM)
+ else if (ret_val == -ENOMEM)
return STORAGE_ERROR_OUT_OF_MEMORY;
else
return STORAGE_ERROR_OPERATION_FAILED;
{
const struct storage_ops *st;
unsigned long long avail;
- int ret;
+ int ret_val;
GList *elem;
if (storage_id < 0)
SYS_G_LIST_FOREACH(st_int_head, elem, st) {
if (st->storage_id != storage_id)
continue;
- ret = st->get_space(NULL, &avail);
+ ret_val = st->get_space(NULL, &avail);
goto out;
}
return STORAGE_ERROR_NOT_SUPPORTED;
}
- ret = storage_ext_get_space(storage_id, NULL, &avail);
+ ret_val = storage_ext_get_space(storage_id, NULL, &avail);
out:
- if (ret < 0) {
+ if (ret_val < 0) {
_E("Failed to get available memory : id(%d)", storage_id); //LCOV_EXCL_LINE
- if (ret == -ENODEV || ret == -EINVAL)
+ if (ret_val == -ENODEV || ret_val == -EINVAL)
return STORAGE_ERROR_INVALID_PARAMETER;
- else if (ret == -ENOMEM)
+ else if (ret_val == -ENOMEM)
return STORAGE_ERROR_OUT_OF_MEMORY;
else
return STORAGE_ERROR_OPERATION_FAILED;
API int storage_set_changed_cb(storage_type_e type, storage_changed_cb callback, void *user_data)
{
- int ret;
+ int ret_val;
struct storage_cb_info info;
if (type == STORAGE_TYPE_INTERNAL) {
info.type_cb = callback;
info.user_data = user_data;
- ret = storage_ext_register_cb(STORAGE_CALLBACK_TYPE, &info);
- if (ret < 0) {
- _E("Failed to register storage callback(ret:%d)", ret); //LCOV_EXCL_LINE
+ ret_val = storage_ext_register_cb(STORAGE_CALLBACK_TYPE, &info);
+ if (ret_val < 0) {
+ _E("Failed to register storage callback(ret:%d)", ret_val); //LCOV_EXCL_LINE
return STORAGE_ERROR_OPERATION_FAILED;
}
API int storage_unset_changed_cb(storage_type_e type, storage_changed_cb callback)
{
struct storage_cb_info info;
- int ret;
+ int ret_val;
if (type == STORAGE_TYPE_INTERNAL) {
_E("Internal storage is not supported");
info.type = type;
info.type_cb = callback;
- ret = storage_ext_unregister_cb(STORAGE_CALLBACK_TYPE, &info);
- if (ret < 0) {
- _E("Failed to unregister storage callback(ret:%d)", ret); //LCOV_EXCL_LINE
+ ret_val = storage_ext_unregister_cb(STORAGE_CALLBACK_TYPE, &info);
+ if (ret_val < 0) {
+ _E("Failed to unregister storage callback(ret:%d)", ret_val); //LCOV_EXCL_LINE
return STORAGE_ERROR_OPERATION_FAILED;
}