1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

cleanup: swap return values

Use lvm standard return code for success/fail  1/0.
This commit is contained in:
Zdenek Kabelac 2012-10-16 10:07:27 +02:00
parent 10ba799ab0
commit b89963a7c3
7 changed files with 18 additions and 18 deletions

View File

@ -177,12 +177,12 @@ int override_config_tree_from_string(struct cmd_context *cmd,
if (!(cft_new = dm_config_from_string(config_settings))) {
log_error("Failed to set overridden configuration entries.");
return 1;
return 0;
}
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,

View File

@ -822,18 +822,18 @@ int vgcreate_params_validate(struct cmd_context *cmd,
if (!validate_new_vg_name(cmd, vp->vg_name)) {
log_error("New volume group name \"%s\" is invalid",
vp->vg_name);
return 1;
return 0;
}
if (vp->alloc == ALLOC_INHERIT) {
log_error("Volume Group allocation policy cannot inherit "
"from anything");
return 1;
return 0;
}
if (!vp->extent_size) {
log_error("Physical extent size may not be zero");
return 1;
return 0;
}
if (!(cmd->fmt->features & FMT_UNLIMITED_VOLS)) {
@ -843,11 +843,11 @@ int vgcreate_params_validate(struct cmd_context *cmd,
vp->max_pv = 255;
if (vp->max_lv > 255 || vp->max_pv > 255) {
log_error("Number of volumes may not exceed 255");
return 1;
return 0;
}
}
return 0;
return 1;
}
/*

View File

@ -89,7 +89,7 @@ int lvm_config_reload(lvm_t libh)
int lvm_config_override(lvm_t libh, const char *config_settings)
{
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 0;
}

View File

@ -1066,7 +1066,7 @@ int lvm_run_command(struct cmd_context *cmd, int argc, char **argv)
set_cmd_name(cmd->command->name);
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;
goto_out;
}

View File

@ -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) {
log_error("Physical extent size may not be negative");
return 1;
return 0;
}
if (arg_uint64_value(cmd, physicalextentsize_ARG, 0) > MAX_EXTENT_SIZE) {
log_error("Physical extent size cannot be larger than %s",
display_size(cmd, (uint64_t) MAX_EXTENT_SIZE));
return 1;
return 0;
}
if (arg_sign_value(cmd, maxlogicalvolumes_ARG, SIGN_NONE) == SIGN_MINUS) {
log_error("Max Logical Volumes may not be negative");
return 1;
return 0;
}
if (arg_sign_value(cmd, maxphysicalvolumes_ARG, SIGN_NONE) == SIGN_MINUS) {
log_error("Max Physical Volumes may not be negative");
return 1;
return 0;
}
if (arg_count(cmd, metadatacopies_ARG)) {
@ -1295,7 +1295,7 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd,
DEFAULT_VGMETADATACOPIES);
}
return 0;
return 1;
}
int lv_refresh(struct cmd_context *cmd, struct logical_volume *lv)

View File

@ -43,10 +43,10 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)
vgcreate_params_set_defaults(&vp_def, NULL);
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;
if (vgcreate_params_validate(cmd, &vp_new))
if (!vgcreate_params_validate(cmd, &vp_new))
return EINVALID_CMD_LINE;
lvmcache_seed_infos_from_lvmetad(cmd);

View File

@ -383,12 +383,12 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)
} else {
vgcreate_params_set_defaults(&vp_def, vg_from);
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;
goto_bad;
}
if (vgcreate_params_validate(cmd, &vp_new)) {
if (!vgcreate_params_validate(cmd, &vp_new)) {
r = EINVALID_CMD_LINE;
goto_bad;
}