From: pr.jung Date: Thu, 12 Jan 2017 08:25:16 +0000 (+0900) Subject: Apply line coverage comments X-Git-Tag: accepted/tizen/3.0/common/20170126.092421^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=21bf3856aa4584c79dede6f33796879b24ade7cb;p=platform%2Fcore%2Fsystem%2Flibstorage.git Apply line coverage comments Change-Id: Iaf69e7622e24e0663aa74415a97fc0a574f71fc9 Signed-off-by: pr.jung --- diff --git a/src/statvfs.c b/src/statvfs.c index 80984d1..eda17bd 100644 --- a/src/statvfs.c +++ b/src/statvfs.c @@ -222,7 +222,7 @@ static int get_memory_size(const char *path, struct statvfs_32 *buf) ret = statvfs(path, &s); if (ret) - return -errno; + return -errno; //LCOV_EXCL_LINE System Error memset(buf, 0, sizeof(struct statvfs_32)); @@ -255,7 +255,7 @@ API int storage_get_internal_memory_size(struct statvfs *buf) ret = get_memory_size(tzplatform_getenv(TZ_SYS_HOME), &temp); if (ret || temp.f_bsize == 0) { _E("fail to get memory size"); //LCOV_EXCL_LINE - return -errno; + return -errno; //LCOV_EXCL_LINE System Error } if (reserved == 0) { @@ -288,7 +288,7 @@ API int storage_get_internal_memory_size64(struct statvfs *buf) ret = statvfs(tzplatform_getenv(TZ_SYS_HOME), buf); if (ret) { _E("fail to get memory size"); //LCOV_EXCL_LINE - return -errno; + return -errno; //LCOV_EXCL_LINE System Error } if (reserved == 0) { @@ -361,7 +361,7 @@ int storage_get_external_memory_size_with_path(char *path, struct statvfs *buf) ret = get_memory_size(ext_path, &temp); if (ret) { _E("fail to get memory size"); //LCOV_EXCL_LINE - return -errno; + return -errno; //LCOV_EXCL_LINE System Error } memcpy(buf, &temp, sizeof(temp)); @@ -400,8 +400,10 @@ int storage_get_external_memory_size64_with_path(char *path, struct statvfs *buf ret = statvfs(ext_path, buf); if (ret) { + //LCOV_EXCL_START System Error _E("fail to get memory size"); return -errno; + //LCOV_EXCL_STOP } return 0; diff --git a/src/storage-common.c b/src/storage-common.c index c6321fd..ba76cc8 100644 --- a/src/storage-common.c +++ b/src/storage-common.c @@ -32,8 +32,10 @@ int is_compat_bind_mount(void) r = mnt_table_parse_mtab(t, NULL); if (r < 0) { + //LCOV_EXCL_START System Error mnt_free_table(t); return 0; + //LCOV_EXCL_STOP } fs = mnt_table_find_target(t, COMPAT_DIR, MNT_ITER_BACKWARD); @@ -43,6 +45,8 @@ int is_compat_bind_mount(void) return 1; } + //LCOV_EXCL_START System Error mnt_free_table(t); return 0; + //LCOV_EXCL_STOP } diff --git a/src/storage-external-dbus.c b/src/storage-external-dbus.c index a3a7c52..be20d3f 100755 --- a/src/storage-external-dbus.c +++ b/src/storage-external-dbus.c @@ -205,7 +205,7 @@ int storage_ext_get_list(dd_list **list) out: if (ret < 0) - storage_ext_release_list(list); + storage_ext_release_list(list); //LCOV_EXCL_LINE System Error g_variant_iter_free(iter); g_variant_unref(result); return ret; @@ -320,19 +320,19 @@ int storage_ext_register_device_change(storage_ext_changed_cb func, void *data) callback = (struct storage_ext_callback *)malloc(sizeof(struct storage_ext_callback)); if (!callback) { -//LCOV_EXCL_START System Error + //LCOV_EXCL_START System Error _E("malloc() failed"); return -ENOMEM; -//LCOV_EXCL_STOP + //LCOV_EXCL_STOP } conn = get_dbus_connection(); if (!conn) { -//LCOV_EXCL_START System Error + //LCOV_EXCL_START System Error free(callback); _E("Failed to get dbus connection"); return -EPERM; -//LCOV_EXCL_STOP + //LCOV_EXCL_STOP } block_id = g_dbus_connection_signal_subscribe(conn, @@ -346,9 +346,11 @@ int storage_ext_register_device_change(storage_ext_changed_cb func, void *data) NULL, NULL); if (block_id == 0) { + //LCOV_EXCL_START System Error free(callback); _E("Failed to subscrive bus signal"); return -EPERM; + //LCOV_EXCL_STOP } callback->func = func; diff --git a/src/storage-inhouse.c b/src/storage-inhouse.c index 6dfd4f1..636a9c1 100755 --- a/src/storage-inhouse.c +++ b/src/storage-inhouse.c @@ -60,8 +60,10 @@ API int storage_get_compat_internal_path(const char* origin, int len, char* comp // this API works on place where compat path is bind-mounted if (!is_compat_bind_mount()) { + //LCOV_EXCL_START System Error _E("No compat bind mount"); return -1; + //LCOV_EXCL_STOP } str = tzplatform_getenv(TZ_USER_CONTENT); @@ -73,8 +75,10 @@ API int storage_get_compat_internal_path(const char* origin, int len, char* comp r = snprintf(compat, len, "%s%s", COMPAT_DIR, origin + str_len); if (r < 0) { + //LCOV_EXCL_START System Error _E("Failed to create new path"); return -1; + //LCOV_EXCL_STOP } return 0; @@ -111,8 +115,10 @@ API int storage_get_origin_internal_path(const char* compat, int len, char* orig // this API works on place where compat path is bind-mounted if (!is_compat_bind_mount()) { + //LCOV_EXCL_START System Error _E("no compat bind mount"); return -1; + //LCOV_EXCL_STOP } compat_len = strlen(COMPAT_DIR); @@ -123,8 +129,10 @@ API int storage_get_origin_internal_path(const char* compat, int len, char* orig r = snprintf(origin, len, "%s%s", tzplatform_getenv(TZ_USER_CONTENT), compat + compat_len); if (r < 0) { + //LCOV_EXCL_START System Error _E("failed to create new path"); return -1; + //LCOV_EXCL_STOP } return 0; @@ -144,8 +152,10 @@ API int storage_get_primary_sdcard(int *storage_id, char **path) "GetMmcPrimary", NULL); if (!result) { + //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 } g_variant_get(result, "(issssssisibii)", @@ -163,7 +173,7 @@ API int storage_get_primary_sdcard(int *storage_id, char **path) *path = strdup(info.mount_point); if (*path == NULL) - return STORAGE_ERROR_OUT_OF_MEMORY; + return STORAGE_ERROR_OUT_OF_MEMORY; //LCOV_EXCL_LINE System Error *storage_id = info.storage_id; @@ -200,10 +210,10 @@ API int storage_get_type_dev(int storage_id, storage_type_e *type, storage_dev_e ext_dev = calloc(1, sizeof(storage_ext_device)); if (!ext_dev) { -//LCOV_EXCL_START System Error + //LCOV_EXCL_START System Error _E("calloc failed"); return STORAGE_ERROR_OUT_OF_MEMORY; -//LCOV_EXCL_STOP + //LCOV_EXCL_STOP } ret = storage_ext_get_device_info(storage_id, ext_dev); diff --git a/src/storage.c b/src/storage.c index 42aaec2..69dd87f 100644 --- a/src/storage.c +++ b/src/storage.c @@ -122,7 +122,7 @@ API int storage_get_root_directory(int storage_id, char **path) *path = strdup(root); if (!*path) { - _E("Failed to copy the root string : %d", errno); + _E("Failed to copy the root string : %d", errno); //LCOV_EXCL_LINE System Error return STORAGE_ERROR_OUT_OF_MEMORY; } @@ -263,6 +263,7 @@ API int storage_get_state(int storage_id, storage_state_e *state) return STORAGE_ERROR_NONE; } +//LCOV_EXCL_START Not called Callback static void compat_cb(int storage_id, storage_dev_e dev, storage_state_e state, const char *fstype, const char *fsuuid, const char *mountpath, @@ -275,6 +276,7 @@ static void compat_cb(int storage_id, DD_LIST_FOREACH(compat_cb_list, elem, ccb_info) ccb_info->user_cb(storage_id, state, ccb_info->user_data); } +//LCOV_EXCL_STOP API int storage_set_state_changed_cb(int storage_id, storage_state_changed_cb callback, void *user_data) {