}
if (!storage_ext_is_supported()) {
+ //LCOV_EXCL_START
_D("Block module is not enabled");
return STORAGE_ERROR_NONE;
+ //LCOV_EXCL_STOP
}
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;
+ return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
}
return STORAGE_ERROR_NONE;
/* external storage */
if (!storage_ext_is_supported()) {
+ //LCOV_EXCL_START
_D("Block module is not enabled");
return STORAGE_ERROR_NOT_SUPPORTED;
+ //LCOV_EXCL_STOP
}
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
+ _E("Failed to get root path of external storage(%d, %d", storage_id, ret_val);
if (ret_val == -ENODEV || ret_val == -EINVAL)
return STORAGE_ERROR_INVALID_PARAMETER;
+ //LCOV_EXCL_START
else if (ret_val == -ENOMEM)
return STORAGE_ERROR_OUT_OF_MEMORY;
else
return STORAGE_ERROR_OPERATION_FAILED;
+ //LCOV_EXCL_STOP
}
*path = strdup(root);
if (!*path) {
- _E("Failed to copy the root string : %d", errno); //LCOV_EXCL_LINE System Error
+ //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;
free(temp2);
} else {
if ((ret_val = snprintf(temp, PATH_MAX, "%s/%s", root, dir_path[type])) > PATH_MAX - 1) {
+ //LCOV_EXCL_START
_E("Path is longer than buffer. Need %d size of buffer.", ret_val + 1);
return STORAGE_ERROR_OUT_OF_MEMORY;
+ //LCOV_EXCL_STOP
}
}
/* external storage */
if (!storage_ext_is_supported()) {
+ //LCOV_EXCL_START
_D("Block module is not enabled");
return STORAGE_ERROR_NOT_SUPPORTED;
+ //LCOV_EXCL_STOP
}
if (type == STORAGE_DIRECTORY_SYSTEM_RINGTONES) {
- _E("Not support directory : id(%d) type(%d)", storage_id, type); //LCOV_EXCL_LINE
+ _E("Not support directory : id(%d) type(%d)", storage_id, type);
return STORAGE_ERROR_INVALID_PARAMETER;
}
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
+ _E("Failed to get root dir for external storage(id:%d, ret:%d)", storage_id, ret_val);
if (ret_val == -ENODEV || ret_val == -EINVAL)
return STORAGE_ERROR_INVALID_PARAMETER;
+ //LCOV_EXCL_START
else if (ret_val == -ENOMEM)
return STORAGE_ERROR_OUT_OF_MEMORY;
else
return STORAGE_ERROR_OPERATION_FAILED;
+ //LCOV_EXCL_STOP
}
/* The operation is not decided */
if (extendedint)
return STORAGE_ERROR_INVALID_PARAMETER;
if ((ret_val = snprintf(temp, sizeof(temp), "%s/%s", root, dir_path[type])) > sizeof(temp) - 1) {
+ //LCOV_EXCL_START
_E("Path is longer than buffer. Need %d size of buffer.", ret_val + 1);
return STORAGE_ERROR_OUT_OF_MEMORY;
+ //LCOV_EXCL_STOP
}
out:
*path = strdup(temp);
if (!*path) {
- _E("Failed to copy the directory(%d) string : %d", type, errno); //LCOV_EXCL_LINE
+ //LCOV_EXCL_START System error
+ _E("Failed to copy the directory(%d) string : %d", type, errno);
return STORAGE_ERROR_OUT_OF_MEMORY;
+ //LCOV_EXCL_STOP
}
return STORAGE_ERROR_NONE;
/* external storage */
if (!storage_ext_is_supported()) {
+ //LCOV_EXCL_START
_D("Block module is not enabled");
return STORAGE_ERROR_NOT_SUPPORTED;
+ //LCOV_EXCL_STOP
}
ret_val = storage_ext_get_root(storage_id, root, sizeof(root), &extendedint);
_E("Failed to get type of external storage");
if (ret_val == -ENODEV || ret_val == -EINVAL)
return STORAGE_ERROR_INVALID_PARAMETER;
+ //LCOV_EXCL_START
else if (ret_val == -ENOMEM)
return STORAGE_ERROR_OUT_OF_MEMORY;
else
return STORAGE_ERROR_OPERATION_FAILED;
+ //LCOV_EXCL_STOP
}
if (extendedint)
*type = STORAGE_TYPE_EXTENDED_INTERNAL;
/* external storage */
if (!storage_ext_is_supported()) {
+ //LCOV_EXCL_START
_D("Block module is not enabled");
return STORAGE_ERROR_NOT_SUPPORTED;
+ //LCOV_EXCL_STOP
}
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
+ _E("Failed to get state (storage id(%d), ret_val(%d))", storage_id, ret_val);
if (ret_val == -ENODEV || ret_val == -EINVAL)
return STORAGE_ERROR_INVALID_PARAMETER;
+ //LCOV_EXCL_START
else if (ret_val == -ENOMEM)
return STORAGE_ERROR_OUT_OF_MEMORY;
else
return STORAGE_ERROR_OPERATION_FAILED;
+ //LCOV_EXCL_STOP
}
*state = st;
return STORAGE_ERROR_INVALID_PARAMETER;
}
- /* For backward compatability */
+ /**
+ * storage_id is different from storage type, but this code handles
+ * incorrect storage_id usage (pass storage type instead of storage id)
+ * For backward compatability.
+ */
if (storage_id == STORAGE_TYPE_EXTERNAL) {
if (!storage_ext_is_supported()) {
+ //LCOV_EXCL_START
_D("Block module is not enabled");
return STORAGE_ERROR_NOT_SUPPORTED;
+ //LCOV_EXCL_STOP
}
if (!compat_cb_init) {
ccb_info = malloc(sizeof(struct compat_cb_info));
if (ccb_info == NULL)
- return STORAGE_ERROR_OPERATION_FAILED;
+ return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
ccb_info->user_cb = callback;
ccb_info->user_data = user_data;
SYS_G_LIST_APPEND(compat_cb_list, ccb_info);
/* external storage */
if (!storage_ext_is_supported()) {
+ //LCOV_EXCL_START
_D("Block module is not enabled");
return STORAGE_ERROR_NOT_SUPPORTED;
+ //LCOV_EXCL_STOP
}
info.id = storage_id;
ret = storage_ext_register_cb(STORAGE_CALLBACK_ID, &info);
if (ret < 0) {
- _E("Failed to register callback : id(%d)", storage_id); //LCOV_EXCL_LINE
+ //LCOV_EXCL_START
+ _E("Failed to register callback : id(%d)", storage_id);
return STORAGE_ERROR_OPERATION_FAILED;
+ //LCOV_EXCL_STOP
}
return STORAGE_ERROR_NONE;
return STORAGE_ERROR_INVALID_PARAMETER;
}
- /* For backward compatability */
+ /**
+ * storage_id is different from storage type, but this code handles
+ * incorrect storage_id usage (pass storage type instead of storage id)
+ * For backward compatability.
+ */
if (storage_id == STORAGE_TYPE_EXTERNAL) {
if (!storage_ext_is_supported()) {
+ //LCOV_EXCL_START
_D("Block module is not enabled");
return STORAGE_ERROR_NOT_SUPPORTED;
+ //LCOV_EXCL_STOP
}
GList *elem_n;
return STORAGE_ERROR_NONE;
}
}
- return STORAGE_ERROR_OPERATION_FAILED;
+
+ return STORAGE_ERROR_OPERATION_FAILED; //LCOV_EXCL_LINE
}
/* Internal storage does not support registering changed callback */
/* external storage */
if (!storage_ext_is_supported()) {
+ //LCOV_EXCL_START
_D("Block module is not enabled");
return STORAGE_ERROR_NOT_SUPPORTED;
+ //LCOV_EXCL_STOP
}
info.id = storage_id;
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
+ //LCOV_EXCL_START
+ _E("Failed to unregister callback : id(%d)", storage_id);
return STORAGE_ERROR_OPERATION_FAILED;
+ //LCOV_EXCL_STOP
}
return STORAGE_ERROR_NONE;
/* external storage */
if (!storage_ext_is_supported()) {
+ //LCOV_EXCL_START
_D("Block module is not enabled");
return STORAGE_ERROR_NOT_SUPPORTED;
+ //LCOV_EXCL_STOP
}
ret_val = storage_ext_get_space(storage_id, &total, NULL);
out:
if (ret_val < 0) {
- _E("Failed to get total memory : id(%d)", storage_id); //LCOV_EXCL_LINE
+ _E("Failed to get total memory : id(%d)", storage_id);
if (ret_val == -ENODEV || ret_val == -EINVAL)
return STORAGE_ERROR_INVALID_PARAMETER;
+ //LCOV_EXCL_START
else if (ret_val == -ENOMEM)
return STORAGE_ERROR_OUT_OF_MEMORY;
else
return STORAGE_ERROR_OPERATION_FAILED;
+ //LCOV_EXCL_STOP
}
*bytes = total;
/* external storage */
if (!storage_ext_is_supported()) {
+ //LCOV_EXCL_START
_D("Block module is not enabled");
return STORAGE_ERROR_NOT_SUPPORTED;
+ //LCOV_EXCL_STOP
}
ret_val = storage_ext_get_space(storage_id, NULL, &avail);
out:
if (ret_val < 0) {
- _E("Failed to get available memory : id(%d)", storage_id); //LCOV_EXCL_LINE
+ _E("Failed to get available memory : id(%d)", storage_id);
if (ret_val == -ENODEV || ret_val == -EINVAL)
return STORAGE_ERROR_INVALID_PARAMETER;
+ //LCOV_EXCL_START
else if (ret_val == -ENOMEM)
return STORAGE_ERROR_OUT_OF_MEMORY;
else
return STORAGE_ERROR_OPERATION_FAILED;
+ //LCOV_EXCL_STOP
}
*bytes = avail;
}
if (!storage_ext_is_supported()) {
+ //LCOV_EXCL_START
_E("Block module is not enabled");
return STORAGE_ERROR_NOT_SUPPORTED;
+ //LCOV_EXCL_STOP
}
/* external storage */
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
+ //LCOV_EXCL_START
+ _E("Failed to register storage callback(ret:%d)", ret_val);
return STORAGE_ERROR_OPERATION_FAILED;
+ //LCOV_EXCL_STOP
}
return STORAGE_ERROR_NONE;
}
if (!storage_ext_is_supported()) {
+ //LCOV_EXCL_START
_E("Block module is not enabled");
return STORAGE_ERROR_NOT_SUPPORTED;
+ //LCOV_EXCL_STOP
}
/* external storage */
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
+ //LCOV_EXCL_START
+ _E("Failed to unregister storage callback(ret:%d)", ret_val);
return STORAGE_ERROR_OPERATION_FAILED;
+ //LCOV_EXCL_STOP
}
return STORAGE_ERROR_NONE;
ret = storage_get_type(storage_id, type);
if (ret != STORAGE_ERROR_NONE) {
+ //LCOV_EXCL_START
_E("Failed to get storage type: %d", ret);
return ret;
+ //LCOV_EXCL_STOP
}
if (*type == STORAGE_TYPE_INTERNAL || *type == STORAGE_TYPE_EXTENDED_INTERNAL)
return STORAGE_ERROR_INVALID_PARAMETER;
if (!storage_ext_is_supported()) {
+ //LCOV_EXCL_START
_D("Block module is not enabled");
return STORAGE_ERROR_NOT_SUPPORTED;
+ //LCOV_EXCL_STOP
}
ext_dev = calloc(1, sizeof(storage_ext_device));
ret = STORAGE_ERROR_INVALID_PARAMETER;
goto out;
}
+ //LCOV_EXCL_START
ret = STORAGE_ERROR_OPERATION_FAILED;
goto out;
+ //LCOV_EXCL_STOP
}
if (ext_dev->type == STORAGE_EXT_SCSI)