Improve variable naming style 22/255122/4 accepted/tizen/unified/20210317.115939 submit/tizen/20210315.085912
authortaemin.yeom <taemin.yeom@samsung.com>
Fri, 12 Mar 2021 07:56:25 +0000 (16:56 +0900)
committertaemin.yeom <taemin.yeom@samsung.com>
Mon, 15 Mar 2021 07:44:23 +0000 (16:44 +0900)
Change-Id: Ic97f7e14016d60405fb55dffaf0d62ab411ec849
Signed-off-by: taemin.yeom <taemin.yeom@samsung.com>
src/statvfs.c
src/storage-common.c
src/storage-external-dbus.c
src/storage-external.c
src/storage-inhouse.c
src/storage-internal.c
src/storage.c

index 7883276..0e8bac6 100644 (file)
@@ -80,22 +80,22 @@ static int load_config(struct parse_result *result, void *user_data)
 
 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));
@@ -120,16 +120,16 @@ API int storage_get_internal_memory_size(struct statvfs *buf)
 {
        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
        }
 
@@ -154,15 +154,15 @@ API int storage_get_internal_memory_size(struct statvfs *buf)
 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
        }
@@ -211,7 +211,7 @@ static int get_external_path(char *path, size_t len)
 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");
@@ -227,11 +227,11 @@ int storage_get_external_memory_size_with_path(char *path, struct statvfs *buf)
                        _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
                }
        }
@@ -239,8 +239,8 @@ int storage_get_external_memory_size_with_path(char *path, struct statvfs *buf)
        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
        }
@@ -256,7 +256,7 @@ out_nodev:
 /* 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");
@@ -272,11 +272,11 @@ int storage_get_external_memory_size64_with_path(char *path, struct statvfs *buf
                        _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
                }
        }
@@ -284,8 +284,8 @@ int storage_get_external_memory_size64_with_path(char *path, struct statvfs *buf
        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
index cc6ea2e..fdd3825 100644 (file)
@@ -57,16 +57,16 @@ int is_compat_bind_mount(void)
 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;
index ee3016e..1b71d56 100755 (executable)
@@ -96,28 +96,28 @@ void storage_ext_release_list(GList **list)
 
 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;
        }
 
@@ -159,38 +159,38 @@ out:
        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
@@ -213,31 +213,31 @@ int storage_ext_get_statvfs(char *path, struct statvfs_32 *buf)
 
 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;
        }
 
@@ -249,9 +249,9 @@ int storage_ext_get_statvfs_size64(char *path, struct statvfs *buf)
 
 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)))
@@ -265,26 +265,26 @@ int storage_ext_get_storage_level(const char *path, char **level)
                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;
@@ -298,7 +298,7 @@ static void storage_ext_device_changed(GVariant *params, enum storage_ext_state
        storage_ext_device *dev;
        GList *elem;
        struct storage_ext_callback *callback;
-       int ret;
+       int ret_val;
 
        if (!params)
                return;
@@ -332,9 +332,9 @@ static void storage_ext_device_changed(GVariant *params, enum storage_ext_state
        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);
@@ -452,21 +452,21 @@ void storage_ext_unregister_device_change(storage_ext_changed_cb func)
 
 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,
@@ -474,18 +474,17 @@ int storage_ext_get_device_info(int storage_id, storage_ext_device *info)
                                &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;
 }
index e260ebc..3ffcf4a 100755 (executable)
@@ -132,7 +132,7 @@ out:
 
 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;
@@ -141,16 +141,16 @@ int storage_ext_foreach_device_list(storage_device_supported_cb callback, void *
        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;
                }
 
@@ -203,7 +203,7 @@ static int storage_ext_type_changed(storage_ext_device *dev, enum storage_ext_st
        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;
@@ -214,10 +214,10 @@ static int storage_ext_type_changed(storage_ext_device *dev, enum storage_ext_st
        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) {
@@ -293,7 +293,7 @@ out:
 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)
@@ -313,8 +313,8 @@ int storage_ext_register_cb(enum storage_cb_type type, struct storage_cb_info *i
 
        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;
        }
 
index fddb656..c2d5d1b 100755 (executable)
@@ -163,10 +163,10 @@ API int storage_get_origin_internal_path(const char* compat, int len, char* orig
 
 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;
@@ -174,65 +174,65 @@ API int storage_get_primary_sdcard(int *storage_id, char **path)
        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;
@@ -268,7 +268,7 @@ API int storage_request_mount_mmc(struct mmc_contents *mmc_data)
        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) {
@@ -277,15 +277,15 @@ API int storage_request_mount_mmc(struct mmc_contents *mmc_data)
                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",
@@ -294,11 +294,11 @@ API int storage_request_mount_mmc(struct mmc_contents *mmc_data)
                        -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;
@@ -334,7 +334,7 @@ API int storage_request_unmount_mmc(struct mmc_contents *mmc_data, int option)
        void (*unmount_cb)(GVariant *, void *, GError *) = NULL;
        void *data = NULL;
        char *path;
-       int ret;
+       int ret_val;
        int id;
 
        if (option < 0 || option > 1)
@@ -346,15 +346,15 @@ API int storage_request_unmount_mmc(struct mmc_contents *mmc_data, int option)
                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",
@@ -363,11 +363,11 @@ API int storage_request_unmount_mmc(struct mmc_contents *mmc_data, int option)
                        -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;
@@ -408,7 +408,7 @@ API int storage_format_mmc(struct mmc_contents *mmc_data, int option)
        void (*format_cb)(GVariant *, void *, GError *) = NULL;
        void *data = NULL;
        char *path;
-       int ret;
+       int ret_val;
        int id;
 
        if (option < 0 || option > 1)
@@ -420,15 +420,15 @@ API int storage_format_mmc(struct mmc_contents *mmc_data, int option)
                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",
@@ -437,11 +437,11 @@ API int storage_format_mmc(struct mmc_contents *mmc_data, int option)
                        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;
@@ -452,21 +452,21 @@ API int storage_is_mounted_opt_usr(storage_part_mount_e *mounted)
        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
@@ -479,7 +479,7 @@ API int storage_is_mounted_opt_usr(storage_part_mount_e *mounted)
                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) {
@@ -497,7 +497,7 @@ API int storage_is_mounted_opt_usr(storage_part_mount_e *mounted)
                        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) {
@@ -511,8 +511,8 @@ API int storage_is_mounted_opt_usr(storage_part_mount_e *mounted)
        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;
index 2f8a796..e0e565d 100755 (executable)
@@ -43,14 +43,14 @@ static int internal_get_state(void)
 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)
index 5185279..c5e7a6f 100644 (file)
@@ -62,7 +62,7 @@ API int storage_foreach_device_supported(storage_device_supported_cb callback, v
 {
        const struct storage_ops *st;
        GList *elem;
-       int ret;
+       int ret_val;
        bool user = true;
 
        if (!callback) {
@@ -75,10 +75,10 @@ API int storage_foreach_device_supported(storage_device_supported_cb callback, v
 
        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;
                }
        }
@@ -88,9 +88,9 @@ API int storage_foreach_device_supported(storage_device_supported_cb callback, v
                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;
        }
 
@@ -102,7 +102,7 @@ API int storage_get_root_directory(int storage_id, char **path)
        const struct storage_ops *st;
        GList *elem;
        char root[PATH_MAX];
-       int ret;
+       int ret_val;
        bool extendedint;
        bool user = true;
 
@@ -143,12 +143,12 @@ API int storage_get_root_directory(int storage_id, char **path)
                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;
@@ -169,7 +169,7 @@ API int storage_get_directory(int storage_id, storage_directory_e type, char **p
        char root[PATH_MAX];
        char temp[PATH_MAX];
        char *temp2, *end;
-       int ret;
+       int ret_val;
        GList *elem;
        bool found;
        bool extendedint;
@@ -219,8 +219,8 @@ API int storage_get_directory(int storage_id, storage_directory_e type, char **p
                        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;
                        }
                }
@@ -239,12 +239,12 @@ API int storage_get_directory(int storage_id, storage_directory_e type, char **p
                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;
@@ -253,8 +253,8 @@ API int storage_get_directory(int storage_id, storage_directory_e type, char **p
        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;
        }
 
@@ -273,7 +273,7 @@ API int storage_get_type(int storage_id, storage_type_e *type)
        const struct storage_ops *st;
        GList *elem;
        char root[PATH_MAX];
-       int ret;
+       int ret_val;
        bool extendedint;
 
        if (storage_id < 0)
@@ -298,12 +298,12 @@ API int storage_get_type(int storage_id, storage_type_e *type)
                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;
@@ -321,7 +321,7 @@ API int storage_get_state(int storage_id, storage_state_e *state)
        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;
@@ -345,12 +345,12 @@ API int storage_get_state(int storage_id, storage_state_e *state)
                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;
@@ -446,7 +446,7 @@ API int storage_unset_state_changed_cb(int storage_id, storage_state_changed_cb
 {
        const struct storage_ops *st;
        struct storage_cb_info info;
-       int ret;
+       int ret_val;
        GList *elem;
 
        if (storage_id < 0)
@@ -491,8 +491,8 @@ API int storage_unset_state_changed_cb(int storage_id, storage_state_changed_cb
        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;
        }
@@ -504,7 +504,7 @@ API int storage_get_total_space(int storage_id, unsigned long long *bytes)
 {
        const struct storage_ops *st;
        unsigned long long total;
-       int ret;
+       int ret_val;
        GList *elem;
 
        if (storage_id < 0)
@@ -519,7 +519,7 @@ API int storage_get_total_space(int storage_id, unsigned long long *bytes)
        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;
        }
 
@@ -529,14 +529,14 @@ API int storage_get_total_space(int storage_id, unsigned long long *bytes)
                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;
@@ -550,7 +550,7 @@ API int storage_get_available_space(int storage_id, unsigned long long *bytes)
 {
        const struct storage_ops *st;
        unsigned long long avail;
-       int ret;
+       int ret_val;
        GList *elem;
 
        if (storage_id < 0)
@@ -565,7 +565,7 @@ API int storage_get_available_space(int storage_id, unsigned long long *bytes)
        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;
        }
 
@@ -575,14 +575,14 @@ API int storage_get_available_space(int storage_id, unsigned long long *bytes)
                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;
@@ -594,7 +594,7 @@ out:
 
 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) {
@@ -622,9 +622,9 @@ API int storage_set_changed_cb(storage_type_e type, storage_changed_cb callback,
        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;
        }
 
@@ -634,7 +634,7 @@ API int storage_set_changed_cb(storage_type_e type, storage_changed_cb callback,
 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");
@@ -660,9 +660,9 @@ API int storage_unset_changed_cb(storage_type_e type, storage_changed_cb callbac
        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;
        }