- 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>
/* 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;
}
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;
}
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)
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;
}
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;
}
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;
}
}
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;
}
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;
}
conn = get_dbus_connection();
if (!conn) {
- _E("fail to get dbus connection");
+ _E("fail to get dbus connection"); //LCOV_EXCL_LINE
return NULL;
}
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;
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;
}
elem = (storage_ext_device *)malloc(sizeof(storage_ext_device));
if (!elem) {
- _E("malloc() failed");
+ _E("malloc() failed"); //LCOV_EXCL_LINE
ret = -ENOMEM;
goto out;
}
return ret;
}
+//LCOV_EXCL_START Not called Callback
static char *get_devnode_from_path(char *path)
{
if (!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)
{
}
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;
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,
return;
}
}
+//LCOV_EXCL_STOP
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,
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;
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) {
"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;
}
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;
}
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;
}
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;
}
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;
return 0;
}
+//LCOV_EXCL_STOP
int storage_ext_register_cb(enum storage_cb_type type, struct storage_cb_info *info)
{
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;
}
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);
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;
}
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;
}
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;
}
/* 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;
}
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, '/');
/* 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;
}
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;
}
/* 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;
}
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;
}
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;
}
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;
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;