Add comments for line/function coverage analysis 28/71128/1
authorpr.jung <pr.jung@samsung.com>
Tue, 24 May 2016 07:34:34 +0000 (16:34 +0900)
committerpr.jung <pr.jung@samsung.com>
Tue, 24 May 2016 07:34:34 +0000 (16:34 +0900)
- Remove system error, not called callback and logs.
- Drops the exclusion reason for Logs

Change-Id: Iaf43a37cfd62be23bd9799feac7c64fc6161edbe
Signed-off-by: pr.jung <pr.jung@samsung.com>
src/statvfs.c
src/storage-external-dbus.c
src/storage-external.c
src/storage.c

index dd038af..80984d1 100644 (file)
@@ -112,7 +112,7 @@ static int config_parse(const char *file_name, int cb(struct parse_result *resul
        /* open conf file */
        f = fopen(file_name, "r");
        if (!f) {
-               _E("Failed to open file %s", file_name);
+               _E("Failed to open file %s", file_name); //LCOV_EXCL_LINE
                ret = -EIO;
                goto error;
        }
@@ -172,7 +172,7 @@ static int config_parse(const char *file_name, int cb(struct parse_result *resul
 error:
        if (f)
                fclose(f);
-       _E("Failed to read %s:%d!", file_name, lineno);
+       _E("Failed to read %s:%d!", file_name, lineno); //LCOV_EXCL_LINE
        return ret;
 }
 
@@ -210,7 +210,7 @@ static void storage_config_load(struct storage_config_info *info)
 
        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);
+               _E("Failed to load %s, %d Use default value!", STORAGE_CONF_FILE, ret); //LCOV_EXCL_LINE
 }
 
 static int get_memory_size(const char *path, struct statvfs_32 *buf)
@@ -254,7 +254,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");
+               _E("fail to get memory size"); //LCOV_EXCL_LINE
                return -errno;
        }
 
@@ -281,13 +281,13 @@ API int storage_get_internal_memory_size64(struct statvfs *buf)
        int ret;
 
        if (!buf) {
-               _E("input param error");
+               _E("input param error"); //LCOV_EXCL_LINE
                return -EINVAL;
        }
 
        ret = statvfs(tzplatform_getenv(TZ_SYS_HOME), buf);
        if (ret) {
-               _E("fail to get memory size");
+               _E("fail to get memory size"); //LCOV_EXCL_LINE
                return -errno;
        }
 
@@ -350,7 +350,7 @@ int storage_get_external_memory_size_with_path(char *path, struct statvfs *buf)
                if (ret == -ENODEV)
                        goto out_nodev;
                if (ret < 0) {
-                       _E("Failed to get external path(%d)", ret);
+                       _E("Failed to get external path(%d)", ret); //LCOV_EXCL_LINE
                        return ret;
                }
        }
@@ -360,7 +360,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");
+               _E("fail to get memory size"); //LCOV_EXCL_LINE
                return -errno;
        }
 
index 2d86e3c..60a439e 100755 (executable)
@@ -103,12 +103,14 @@ static GDBusConnection *get_dbus_connection(void)
 
        conn = g_bus_get_sync(G_BUS_TYPE_SYSTEM, NULL, &err);
        if (!conn) {
+//LCOV_EXCL_START System Error
                if (err) {
                        _E("fail to get dbus connection : %s", err->message);
                        g_clear_error(&err);
                } else
                        _E("fail to get dbus connection");
                return NULL;
+//LCOV_EXCL_STOP
        }
        return conn;
 }
@@ -125,7 +127,7 @@ static GVariant *dbus_method_call_sync(const gchar *dest, const gchar *path,
 
        conn = get_dbus_connection();
        if (!conn) {
-               _E("fail to get dbus connection");
+               _E("fail to get dbus connection"); //LCOV_EXCL_LINE
                return NULL;
        }
 
@@ -134,12 +136,14 @@ static GVariant *dbus_method_call_sync(const gchar *dest, const gchar *path,
                        param, NULL, G_DBUS_CALL_FLAGS_NONE,
                        -1, NULL, &err);
        if (!ret) {
+//LCOV_EXCL_START System Error
                if (err) {
                        _E("dbus method sync call failed(%s)", err->message);
                        g_clear_error(&err);
                } else
                        _E("g_dbus_connection_call_sync() failed");
                return NULL;
+//LCOV_EXCL_STOP
        }
 
        return ret;
@@ -161,7 +165,7 @@ int storage_ext_get_list(dd_list **list)
                        STORAGE_EXT_GET_LIST,
                        g_variant_new("(s)", "all"));
        if (!result) {
-               _E("Failed to get storage_ext device info");
+               _E("Failed to get storage_ext device info"); //LCOV_EXCL_LINE
                return -EIO;
        }
 
@@ -177,7 +181,7 @@ int storage_ext_get_list(dd_list **list)
 
                elem = (storage_ext_device *)malloc(sizeof(storage_ext_device));
                if (!elem) {
-                       _E("malloc() failed");
+                       _E("malloc() failed"); //LCOV_EXCL_LINE
                        ret = -ENOMEM;
                        goto out;
                }
@@ -209,6 +213,7 @@ out:
        return ret;
 }
 
+//LCOV_EXCL_START Not called Callback
 static char *get_devnode_from_path(char *path)
 {
        if (!path)
@@ -216,7 +221,9 @@ static char *get_devnode_from_path(char *path)
        /* 1 means '/' */
        return path + strlen(STORAGE_EXT_PATH_DEVICES) + 1;
 }
+//LCOV_EXCL_STOP
 
+//LCOV_EXCL_START Not called Callback
 static void storage_ext_object_path_changed(enum storage_ext_state state,
                GVariant *params, gpointer user_data)
 {
@@ -261,17 +268,23 @@ out:
        }
        free(path);
 }
+//LCOV_EXCL_STOP
 
+//LCOV_EXCL_START Not called Callback
 static void storage_ext_device_added(GVariant *params, gpointer user_data)
 {
        storage_ext_object_path_changed(STORAGE_EXT_ADDED, params, user_data);
 }
+//LCOV_EXCL_STOP
 
+//LCOV_EXCL_START Not called Callback
 static void storage_ext_device_removed(GVariant *params, gpointer user_data)
 {
        storage_ext_object_path_changed(STORAGE_EXT_REMOVED, params, user_data);
 }
+//LCOV_EXCL_STOP
 
+//LCOV_EXCL_START Not called Callback
 static void storage_ext_device_changed(GVariant *params, gpointer user_data)
 {
        storage_ext_device *dev;
@@ -311,7 +324,9 @@ static void storage_ext_device_changed(GVariant *params, gpointer user_data)
 
        storage_ext_release_device(&dev);
 }
+//LCOV_EXCL_STOP
 
+//LCOV_EXCL_START Not called Callback
 static void storage_ext_changed(GDBusConnection *conn,
                const gchar *sender,
                const gchar *path,
@@ -342,6 +357,7 @@ static void storage_ext_changed(GDBusConnection *conn,
                return;
        }
 }
+//LCOV_EXCL_STOP
 
 int storage_ext_register_device_change(storage_ext_changed_cb func, void *data)
 {
@@ -364,15 +380,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
                _E("malloc() failed");
                return -ENOMEM;
+//LCOV_EXCL_STOP
        }
 
        conn = get_dbus_connection();
        if (!conn) {
+//LCOV_EXCL_START System Error
                free(callback);
                _E("Failed to get dbus connection");
                return -EPERM;
+//LCOV_EXCL_STOP
        }
 
        block_id = g_dbus_connection_signal_subscribe(conn,
@@ -402,9 +422,11 @@ int storage_ext_register_device_change(storage_ext_changed_cb func, void *data)
                        NULL,
                        NULL);
        if (blockmanager_id == 0) {
+//LCOV_EXCL_START System Error
                free(callback);
                _E("Failed to subscrive bus signal");
                return -EPERM;
+//LCOV_EXCL_STOP
        }
 
        callback->func = func;
@@ -428,8 +450,10 @@ void storage_ext_unregister_device_change(storage_ext_changed_cb func)
 
        conn = get_dbus_connection();
        if (!conn) {
+//LCOV_EXCL_START System Error
                _E("fail to get dbus connection");
                return;
+//LCOV_EXCL_STOP
        }
 
        DD_LIST_FOREACH(changed_list, elem, callback) {
@@ -455,7 +479,7 @@ int storage_ext_get_device_info(int storage_id, storage_ext_device *info)
                        "GetDeviceInfoByID",
                        g_variant_new("(i)", storage_id));
        if (!result) {
-               _E("There is no storage with the storage id (%d)", storage_id);
+               _E("There is no storage with the storage id (%d)", storage_id); //LCOV_EXCL_LINE
                return -ENODEV;
        }
 
index bd9a8e1..c23153d 100755 (executable)
@@ -74,19 +74,21 @@ int storage_ext_get_space(int storage_id,
 
        dev = calloc(1, sizeof(storage_ext_device));
        if (!dev) {
+//LCOV_EXCL_START System Error
                _E("calloc failed");
                return -ENOMEM;
+//LCOV_EXCL_STOP
        }
 
        ret = storage_ext_get_device_info(storage_id, dev);
        if (ret < 0) {
-               _E("Cannot get the storage with id (%d, ret:%d)", storage_id, ret);
+               _E("Cannot get the storage with id (%d, ret:%d)", storage_id, ret); //LCOV_EXCL_LINE
                goto out;
        }
 
        ret = storage_ext_get_dev_state(dev, STORAGE_EXT_CHANGED, &state);
        if (ret < 0) {
-               _E("Failed to get state of storage (id:%d, ret:%d)", storage_id, ret);
+               _E("Failed to get state of storage (id:%d, ret:%d)", storage_id, ret); //LCOV_EXCL_LINE
                goto out;
        }
 
@@ -97,7 +99,7 @@ int storage_ext_get_space(int storage_id,
                ret = storage_get_external_memory_size64_with_path(dev->mount_point, &s);
 #endif
                if (ret < 0) {
-                       _E("Failed to get external memory size of (%s)(ret:%d)", dev->mount_point, ret);
+                       _E("Failed to get external memory size of (%s)(ret:%d)", dev->mount_point, ret); //LCOV_EXCL_LINE
                        goto out;
                }
 
@@ -129,14 +131,14 @@ int storage_ext_foreach_device_list(storage_device_supported_cb callback, void *
 
        ret = storage_ext_get_list(&list);
        if (ret < 0) {
-               _E("Failed to get external storage list from deviced (%d)", errno);
+               _E("Failed to get external storage list from deviced (%d)", errno); //LCOV_EXCL_LINE
                return ret;
        }
 
        DD_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);
+                       _E("Failed to get storage state (devnode:%s, ret:%d)", dev->devnode, ret); //LCOV_EXCL_LINE
                        continue;
                }
 
@@ -151,6 +153,7 @@ int storage_ext_foreach_device_list(storage_device_supported_cb callback, void *
        return 0;
 }
 
+//LCOV_EXCL_START Not called Callback
 static int storage_ext_state_changed(storage_ext_device *dev, enum storage_ext_state blk_state, void *data)
 {
        enum storage_cb_type type = (enum storage_cb_type)data;
@@ -176,6 +179,7 @@ static int storage_ext_state_changed(storage_ext_device *dev, enum storage_ext_s
 
        return 0;
 }
+//LCOV_EXCL_STOP
 
 int storage_ext_register_cb(enum storage_cb_type type, struct storage_cb_info *info)
 {
@@ -262,13 +266,15 @@ int storage_ext_get_root(int storage_id, char *path, size_t len)
 
        dev = calloc(1, sizeof(storage_ext_device));
        if (!dev) {
+//LCOV_EXCL_START System Error
                _E("calloc failed");
                return -ENOMEM;
+//LCOV_EXCL_STOP
        }
 
        ret = storage_ext_get_device_info(storage_id, dev);
        if (ret < 0) {
-               _E("Cannot get the storage with id (%d, ret:%d)", storage_id, ret);
+               _E("Cannot get the storage with id (%d, ret:%d)", storage_id, ret); //LCOV_EXCL_LINE
                goto out;
        }
 
@@ -293,19 +299,21 @@ int storage_ext_get_state(int storage_id, storage_state_e *state)
 
        dev = calloc(1, sizeof(storage_ext_device));
        if (!dev) {
+//LCOV_EXCL_START System Error
                _E("calloc failed");
                return -ENOMEM;
+//LCOV_EXCL_STOP
        }
 
        ret = storage_ext_get_device_info(storage_id, dev);
        if (ret < 0) {
-               _E("Cannot get the storage with id (%d, ret:%d)", storage_id, ret);
+               _E("Cannot get the storage with id (%d, ret:%d)", storage_id, ret); //LCOV_EXCL_LINE
                goto out;
        }
 
        ret = storage_ext_get_dev_state(dev, STORAGE_EXT_CHANGED, state);
        if (ret < 0)
-               _E("Failed to get state of storage id (%d, ret:%d)", storage_id, ret);
+               _E("Failed to get state of storage id (%d, ret:%d)", storage_id, ret); //LCOV_EXCL_LINE
 
 out:
        storage_ext_release_device(&dev);
@@ -320,7 +328,7 @@ int storage_ext_get_primary_mmc_path(char *path, size_t len)
 
        ret = storage_ext_get_list(&list);
        if (ret < 0) {
-               _E("Failed to get external storage list from deviced (%d)", errno);
+               _E("Failed to get external storage list from deviced (%d)", errno); //LCOV_EXCL_LINE
                return ret;
        }
 
index b98fded..c8cfc11 100644 (file)
@@ -71,7 +71,7 @@ API int storage_foreach_device_supported(storage_device_supported_cb callback, v
 
        ret = storage_ext_foreach_device_list(callback, user_data);
        if (ret < 0) {
-               _E("Failed to iterate external devices (%d)", ret);
+               _E("Failed to iterate external devices (%d)", ret); //LCOV_EXCL_LINE
                return STORAGE_ERROR_OPERATION_FAILED;
        }
 
@@ -99,8 +99,10 @@ API int storage_get_root_directory(int storage_id, char **path)
                        continue;
                *path = strdup(st->root());
                if (!*path) {
+//LCOV_EXCL_START System Error
                        _E("Failed to copy the root string : %d", errno);
                        return STORAGE_ERROR_OUT_OF_MEMORY;
+//LCOV_EXCL_STOP
                }
                return STORAGE_ERROR_NONE;
        }
@@ -108,7 +110,7 @@ API int storage_get_root_directory(int storage_id, char **path)
        /* external storage */
        ret = storage_ext_get_root(storage_id, root, sizeof(root));
        if (ret < 0) {
-               _E("Failed to get root path of external storage(%d, %d", storage_id, ret);
+               _E("Failed to get root path of external storage(%d, %d", storage_id, ret); //LCOV_EXCL_LINE
                return STORAGE_ERROR_INVALID_PARAMETER;
        }
 
@@ -158,7 +160,7 @@ API int storage_get_directory(int storage_id, storage_directory_e type, char **p
                if (type == STORAGE_DIRECTORY_SYSTEM_RINGTONES) {
                        ret = system_settings_get_value_string(SYSTEM_SETTINGS_KEY_INCOMING_CALL_RINGTONE, &temp2);
                        if (ret < 0) {
-                               _E("Failed to get ringtone path : %d", ret);
+                               _E("Failed to get ringtone path : %d", ret); //LCOV_EXCL_LINE
                                return STORAGE_ERROR_OPERATION_FAILED;
                        }
                        end = strrchr(temp2, '/');
@@ -174,13 +176,13 @@ API int storage_get_directory(int storage_id, storage_directory_e type, char **p
 
        /* external storage */
        if (type == STORAGE_DIRECTORY_SYSTEM_RINGTONES) {
-               _E("Not support directory : id(%d) type(%d)", storage_id, type);
+               _E("Not support directory : id(%d) type(%d)", storage_id, type); //LCOV_EXCL_LINE
                return STORAGE_ERROR_NOT_SUPPORTED;
        }
 
        ret = storage_ext_get_root(storage_id, root, sizeof(root));
        if (ret < 0) {
-               _E("Failed to get root dir for external storage(id:%d, ret:%d)", storage_id, ret);
+               _E("Failed to get root dir for external storage(id:%d, ret:%d)", storage_id, ret); //LCOV_EXCL_LINE
                return STORAGE_ERROR_OPERATION_FAILED;
        }
 
@@ -189,7 +191,7 @@ API int storage_get_directory(int storage_id, storage_directory_e type, char **p
 out:
        *path = strdup(temp);
        if (!*path) {
-               _E("Failed to copy the directory(%d) string : %d", type, errno);
+               _E("Failed to copy the directory(%d) string : %d", type, errno); //LCOV_EXCL_LINE
                return STORAGE_ERROR_OUT_OF_MEMORY;
        }
 
@@ -249,7 +251,7 @@ API int storage_get_state(int storage_id, storage_state_e *state)
        /* external storage */
        ret = storage_ext_get_state(storage_id, &st);
        if (ret < 0) {
-               _E("Failed to get state (storage id(%d), ret(%d))", storage_id, ret);
+               _E("Failed to get state (storage id(%d), ret(%d))", storage_id, ret); //LCOV_EXCL_LINE
                return STORAGE_ERROR_OPERATION_FAILED;
        }
 
@@ -284,7 +286,7 @@ API int storage_set_state_changed_cb(int storage_id, storage_state_changed_cb ca
 
        ret = storage_ext_register_cb(STORAGE_CALLBACK_STATE, &info);
        if (ret < 0) {
-               _E("Failed to register callback : id(%d)", storage_id);
+               _E("Failed to register callback : id(%d)", storage_id); //LCOV_EXCL_LINE
                return STORAGE_ERROR_OPERATION_FAILED;
        }
 
@@ -317,7 +319,7 @@ API int storage_unset_state_changed_cb(int storage_id, storage_state_changed_cb
 
        ret = storage_ext_unregister_cb(STORAGE_CALLBACK_STATE, &info);
        if (ret < 0) {
-               _E("Failed to unregister callback : id(%d)", storage_id);
+               _E("Failed to unregister callback : id(%d)", storage_id); //LCOV_EXCL_LINE
                return STORAGE_ERROR_OPERATION_FAILED;
        }
 
@@ -352,7 +354,7 @@ API int storage_get_total_space(int storage_id, unsigned long long *bytes)
 
 out:
        if (ret < 0) {
-               _E("Failed to get total memory : id(%d)", storage_id);
+               _E("Failed to get total memory : id(%d)", storage_id); //LCOV_EXCL_LINE
                if (ret == -ENOTSUP)
                        return STORAGE_ERROR_NOT_SUPPORTED;
                return STORAGE_ERROR_OPERATION_FAILED;
@@ -390,7 +392,7 @@ API int storage_get_available_space(int storage_id, unsigned long long *bytes)
 
 out:
        if (ret < 0) {
-               _E("Failed to get available memory : id(%d)", storage_id);
+               _E("Failed to get available memory : id(%d)", storage_id); //LCOV_EXCL_LINE
                if (ret == -ENOTSUP)
                        return STORAGE_ERROR_NOT_SUPPORTED;
                return STORAGE_ERROR_OPERATION_FAILED;