summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunmin Lee <sunm.lee@samsung.com>2017-02-15 11:48:31 +0900
committerSunmin Lee <sunm.lee@samsung.com>2017-02-15 11:52:51 +0900
commit9af683a15d4e9a82af5ec6a62a4534040b7a385f (patch)
tree26673fb2e25cf2cf4bca2e55c4bf79f194054a52
parent4131a226d2ee25123a0bc6bf6a27a8d697dd248e (diff)
parent761468bf7854d7e5a366d9c651ba598de1a216cb (diff)
downloadlibstorage-9af683a15d4e9a82af5ec6a62a4534040b7a385f.tar.gz
libstorage-9af683a15d4e9a82af5ec6a62a4534040b7a385f.tar.bz2
libstorage-9af683a15d4e9a82af5ec6a62a4534040b7a385f.zip
- Apply line coverage comments - Change the name of Camera directory Change-Id: I82421e224682b8294a39f9ed87b62704d83e3e2b
-rw-r--r--src/statvfs.c10
-rw-r--r--src/storage-common.c4
-rwxr-xr-xsrc/storage-external-dbus.c12
-rwxr-xr-xsrc/storage-inhouse.c16
-rw-r--r--src/storage.c6
5 files changed, 34 insertions, 14 deletions
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..fa719ec 100644
--- a/src/storage.c
+++ b/src/storage.c
@@ -30,7 +30,7 @@ const char *dir_path[STORAGE_DIRECTORY_MAX] = {
[STORAGE_DIRECTORY_IMAGES] = "Images",
[STORAGE_DIRECTORY_SOUNDS] = "Sounds",
[STORAGE_DIRECTORY_VIDEOS] = "Videos",
- [STORAGE_DIRECTORY_CAMERA] = "Camera",
+ [STORAGE_DIRECTORY_CAMERA] = "DCIM",
[STORAGE_DIRECTORY_DOWNLOADS] = "Downloads",
[STORAGE_DIRECTORY_MUSIC] = "Music",
[STORAGE_DIRECTORY_DOCUMENTS] = "Documents",
@@ -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)
{