mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
cleanup: swap return values
Use lvm standard return code for success/fail 1/0.
This commit is contained in:
parent
10ba799ab0
commit
b89963a7c3
@ -177,12 +177,12 @@ int override_config_tree_from_string(struct cmd_context *cmd,
|
|||||||
|
|
||||||
if (!(cft_new = dm_config_from_string(config_settings))) {
|
if (!(cft_new = dm_config_from_string(config_settings))) {
|
||||||
log_error("Failed to set overridden configuration entries.");
|
log_error("Failed to set overridden configuration entries.");
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd->cft = dm_config_insert_cascaded_tree(cft_new, cmd->cft);
|
cmd->cft = dm_config_insert_cascaded_tree(cft_new, cmd->cft);
|
||||||
|
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int config_file_read_fd(struct dm_config_tree *cft, struct device *dev,
|
int config_file_read_fd(struct dm_config_tree *cft, struct device *dev,
|
||||||
|
@ -822,18 +822,18 @@ int vgcreate_params_validate(struct cmd_context *cmd,
|
|||||||
if (!validate_new_vg_name(cmd, vp->vg_name)) {
|
if (!validate_new_vg_name(cmd, vp->vg_name)) {
|
||||||
log_error("New volume group name \"%s\" is invalid",
|
log_error("New volume group name \"%s\" is invalid",
|
||||||
vp->vg_name);
|
vp->vg_name);
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vp->alloc == ALLOC_INHERIT) {
|
if (vp->alloc == ALLOC_INHERIT) {
|
||||||
log_error("Volume Group allocation policy cannot inherit "
|
log_error("Volume Group allocation policy cannot inherit "
|
||||||
"from anything");
|
"from anything");
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!vp->extent_size) {
|
if (!vp->extent_size) {
|
||||||
log_error("Physical extent size may not be zero");
|
log_error("Physical extent size may not be zero");
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(cmd->fmt->features & FMT_UNLIMITED_VOLS)) {
|
if (!(cmd->fmt->features & FMT_UNLIMITED_VOLS)) {
|
||||||
@ -843,11 +843,11 @@ int vgcreate_params_validate(struct cmd_context *cmd,
|
|||||||
vp->max_pv = 255;
|
vp->max_pv = 255;
|
||||||
if (vp->max_lv > 255 || vp->max_pv > 255) {
|
if (vp->max_lv > 255 || vp->max_pv > 255) {
|
||||||
log_error("Number of volumes may not exceed 255");
|
log_error("Number of volumes may not exceed 255");
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -89,7 +89,7 @@ int lvm_config_reload(lvm_t libh)
|
|||||||
int lvm_config_override(lvm_t libh, const char *config_settings)
|
int lvm_config_override(lvm_t libh, const char *config_settings)
|
||||||
{
|
{
|
||||||
struct cmd_context *cmd = (struct cmd_context *)libh;
|
struct cmd_context *cmd = (struct cmd_context *)libh;
|
||||||
if (override_config_tree_from_string(cmd, config_settings))
|
if (!override_config_tree_from_string(cmd, config_settings))
|
||||||
return -1;
|
return -1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1066,7 +1066,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
set_cmd_name(cmd->command->name);
|
set_cmd_name(cmd->command->name);
|
||||||
|
|
||||||
if (arg_count(cmd, config_ARG))
|
if (arg_count(cmd, config_ARG))
|
||||||
if (override_config_tree_from_string(cmd, arg_str_value(cmd, config_ARG, ""))) {
|
if (!override_config_tree_from_string(cmd, arg_str_value(cmd, config_ARG, ""))) {
|
||||||
ret = EINVALID_CMD_LINE;
|
ret = EINVALID_CMD_LINE;
|
||||||
goto_out;
|
goto_out;
|
||||||
}
|
}
|
||||||
|
@ -1264,23 +1264,23 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd,
|
|||||||
|
|
||||||
if (arg_sign_value(cmd, physicalextentsize_ARG, SIGN_NONE) == SIGN_MINUS) {
|
if (arg_sign_value(cmd, physicalextentsize_ARG, SIGN_NONE) == SIGN_MINUS) {
|
||||||
log_error("Physical extent size may not be negative");
|
log_error("Physical extent size may not be negative");
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg_uint64_value(cmd, physicalextentsize_ARG, 0) > MAX_EXTENT_SIZE) {
|
if (arg_uint64_value(cmd, physicalextentsize_ARG, 0) > MAX_EXTENT_SIZE) {
|
||||||
log_error("Physical extent size cannot be larger than %s",
|
log_error("Physical extent size cannot be larger than %s",
|
||||||
display_size(cmd, (uint64_t) MAX_EXTENT_SIZE));
|
display_size(cmd, (uint64_t) MAX_EXTENT_SIZE));
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg_sign_value(cmd, maxlogicalvolumes_ARG, SIGN_NONE) == SIGN_MINUS) {
|
if (arg_sign_value(cmd, maxlogicalvolumes_ARG, SIGN_NONE) == SIGN_MINUS) {
|
||||||
log_error("Max Logical Volumes may not be negative");
|
log_error("Max Logical Volumes may not be negative");
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg_sign_value(cmd, maxphysicalvolumes_ARG, SIGN_NONE) == SIGN_MINUS) {
|
if (arg_sign_value(cmd, maxphysicalvolumes_ARG, SIGN_NONE) == SIGN_MINUS) {
|
||||||
log_error("Max Physical Volumes may not be negative");
|
log_error("Max Physical Volumes may not be negative");
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arg_count(cmd, metadatacopies_ARG)) {
|
if (arg_count(cmd, metadatacopies_ARG)) {
|
||||||
@ -1295,7 +1295,7 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd,
|
|||||||
DEFAULT_VGMETADATACOPIES);
|
DEFAULT_VGMETADATACOPIES);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lv_refresh(struct cmd_context *cmd, struct logical_volume *lv)
|
int lv_refresh(struct cmd_context *cmd, struct logical_volume *lv)
|
||||||
|
@ -43,10 +43,10 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
|
|
||||||
vgcreate_params_set_defaults(&vp_def, NULL);
|
vgcreate_params_set_defaults(&vp_def, NULL);
|
||||||
vp_def.vg_name = vg_name;
|
vp_def.vg_name = vg_name;
|
||||||
if (vgcreate_params_set_from_args(cmd, &vp_new, &vp_def))
|
if (!vgcreate_params_set_from_args(cmd, &vp_new, &vp_def))
|
||||||
return EINVALID_CMD_LINE;
|
return EINVALID_CMD_LINE;
|
||||||
|
|
||||||
if (vgcreate_params_validate(cmd, &vp_new))
|
if (!vgcreate_params_validate(cmd, &vp_new))
|
||||||
return EINVALID_CMD_LINE;
|
return EINVALID_CMD_LINE;
|
||||||
|
|
||||||
lvmcache_seed_infos_from_lvmetad(cmd);
|
lvmcache_seed_infos_from_lvmetad(cmd);
|
||||||
|
@ -383,12 +383,12 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
|
|||||||
} else {
|
} else {
|
||||||
vgcreate_params_set_defaults(&vp_def, vg_from);
|
vgcreate_params_set_defaults(&vp_def, vg_from);
|
||||||
vp_def.vg_name = vg_name_to;
|
vp_def.vg_name = vg_name_to;
|
||||||
if (vgcreate_params_set_from_args(cmd, &vp_new, &vp_def)) {
|
if (!vgcreate_params_set_from_args(cmd, &vp_new, &vp_def)) {
|
||||||
r = EINVALID_CMD_LINE;
|
r = EINVALID_CMD_LINE;
|
||||||
goto_bad;
|
goto_bad;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vgcreate_params_validate(cmd, &vp_new)) {
|
if (!vgcreate_params_validate(cmd, &vp_new)) {
|
||||||
r = EINVALID_CMD_LINE;
|
r = EINVALID_CMD_LINE;
|
||||||
goto_bad;
|
goto_bad;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user