diff --git a/lib/activate/dev_manager.c b/lib/activate/dev_manager.c index 6e5eede51..263a7cab1 100644 --- a/lib/activate/dev_manager.c +++ b/lib/activate/dev_manager.c @@ -494,7 +494,7 @@ static percent_range_t _combine_percent(percent_t a, percent_t b, if (a == PERCENT_0 && b == PERCENT_0) return PERCENT_0; - return make_percent(numerator, denominator); + return (percent_range_t) make_percent(numerator, denominator); } static int _percent_run(struct dev_manager *dm, const char *name, diff --git a/libdm/libdm-common.c b/libdm/libdm-common.c index 48ef49c47..8e7bbf1ec 100644 --- a/libdm/libdm-common.c +++ b/libdm/libdm-common.c @@ -68,7 +68,7 @@ static char _default_uuid_prefix[DM_MAX_UUID_PREFIX_LEN + 1] = "LVM-"; static int _verbose = 0; static int _suspended_dev_counter = 0; -static int _name_mangling_mode = -1; +static dm_string_mangling_t _name_mangling_mode = DEFAULT_DM_NAME_MANGLING; #ifdef HAVE_SELINUX_LABEL_H static struct selabel_handle *_selabel_handle = NULL; diff --git a/tools/dmsetup.c b/tools/dmsetup.c index 0ae49c784..34f370d13 100644 --- a/tools/dmsetup.c +++ b/tools/dmsetup.c @@ -3614,7 +3614,7 @@ static int _process_switches(int *argc, char ***argv, const char *dev_dir) log_error("Unknown name mangling mode"); return 0; } - dm_set_name_mangling_mode(_int_args[MANGLENAME_ARG]); + dm_set_name_mangling_mode((dm_string_mangling_t) _int_args[MANGLENAME_ARG]); } if (ind == NAMEPREFIXES_ARG) _switches[NAMEPREFIXES_ARG]++; diff --git a/tools/lvchange.c b/tools/lvchange.c index 585819183..202a42abb 100644 --- a/tools/lvchange.c +++ b/tools/lvchange.c @@ -340,7 +340,7 @@ static int lvchange_alloc(struct cmd_context *cmd, struct logical_volume *lv) want_contiguous = strcmp(arg_str_value(cmd, contiguous_ARG, "n"), "n"); alloc = want_contiguous ? ALLOC_CONTIGUOUS : ALLOC_INHERIT; - alloc = arg_uint_value(cmd, alloc_ARG, alloc); + alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, alloc); if (alloc == lv->alloc) { log_error("Allocation policy of logical volume \"%s\" is " diff --git a/tools/lvconvert.c b/tools/lvconvert.c index 3ce739366..a8d355472 100644 --- a/tools/lvconvert.c +++ b/tools/lvconvert.c @@ -200,7 +200,7 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd, * versus an additional qualifying argument being added here. */ lp->mirrors = arg_uint_value(cmd, mirrors_ARG, 0); - lp->mirrors_sign = arg_sign_value(cmd, mirrors_ARG, 0); + lp->mirrors_sign = arg_sign_value(cmd, mirrors_ARG, SIGN_NONE); } lp->alloc = arg_uint_value(cmd, alloc_ARG, ALLOC_INHERIT); @@ -229,7 +229,7 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd, return 0; } - if (arg_sign_value(cmd, chunksize_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, chunksize_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Negative chunk size is invalid"); return 0; } @@ -288,7 +288,7 @@ static int _read_params(struct lvconvert_params *lp, struct cmd_context *cmd, */ if (arg_count(cmd, regionsize_ARG)) { - if (arg_sign_value(cmd, regionsize_ARG, 0) == + if (arg_sign_value(cmd, regionsize_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Negative regionsize is invalid"); return 0; diff --git a/tools/lvcreate.c b/tools/lvcreate.c index cd4bcfd2d..4feec87b7 100644 --- a/tools/lvcreate.c +++ b/tools/lvcreate.c @@ -321,7 +321,7 @@ static int _read_size_params(struct lvcreate_params *lp, } if (arg_count(cmd, extents_ARG)) { - if (arg_sign_value(cmd, extents_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, extents_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Negative number of extents is invalid"); return 0; } @@ -331,7 +331,7 @@ static int _read_size_params(struct lvcreate_params *lp, /* Size returned in kilobyte units; held in sectors */ if (arg_count(cmd, size_ARG)) { - if (arg_sign_value(cmd, size_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, size_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Negative size is invalid"); return 0; } @@ -348,7 +348,7 @@ static int _read_size_params(struct lvcreate_params *lp, log_error("--poolmetadatasize may only be specified when allocating the thin pool."); return 0; } - if (arg_sign_value(cmd, poolmetadatasize_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, poolmetadatasize_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Negative poolmetadatasize is invalid."); return 0; } @@ -361,7 +361,7 @@ static int _read_size_params(struct lvcreate_params *lp, log_error("Virtual size in incompatible with thin_pool segment type."); return 0; } - if (arg_sign_value(cmd, virtualsize_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, virtualsize_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Negative virtual origin size is invalid"); return 0; } @@ -443,7 +443,7 @@ static int _read_mirror_params(struct lvcreate_params *lp, lp->nosync = arg_is_set(cmd, nosync_ARG); if (arg_count(cmd, regionsize_ARG)) { - if (arg_sign_value(cmd, regionsize_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, regionsize_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Negative regionsize is invalid"); return 0; } @@ -542,7 +542,8 @@ static int _read_activation_params(struct lvcreate_params *lp, struct cmd_contex { unsigned pagesize; - lp->activate = arg_uint_value(cmd, available_ARG, CHANGE_AY); + lp->activate = (activation_change_t) + arg_uint_value(cmd, available_ARG, CHANGE_AY); if (lp->activate == CHANGE_AN || lp->activate == CHANGE_ALN) { if (lp->zero && !seg_is_thin(lp)) { @@ -688,7 +689,7 @@ static int _lvcreate_params(struct lvcreate_params *lp, } log_print("Redundant mirrors argument: default is 0"); } - if (arg_sign_value(cmd, mirrors_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, mirrors_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Mirrors argument may not be negative"); return 0; } @@ -743,7 +744,7 @@ static int _lvcreate_params(struct lvcreate_params *lp, if (arg_count(cmd, chunksize_ARG)) log_warn("WARNING: Ignoring --chunksize when using an existing pool."); } else if (lp->snapshot || lp->create_thin_pool) { - if (arg_sign_value(cmd, chunksize_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, chunksize_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Negative chunk size is invalid"); return 0; } @@ -796,7 +797,7 @@ static int _lvcreate_params(struct lvcreate_params *lp, lp->alloc = contiguous ? ALLOC_CONTIGUOUS : ALLOC_INHERIT; - lp->alloc = arg_uint_value(cmd, alloc_ARG, lp->alloc); + lp->alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, lp->alloc); if (contiguous && (lp->alloc != ALLOC_CONTIGUOUS)) { log_error("Conflicting contiguous and alloc arguments"); diff --git a/tools/lvresize.c b/tools/lvresize.c index bf2388e18..200d08978 100644 --- a/tools/lvresize.c +++ b/tools/lvresize.c @@ -50,7 +50,7 @@ static int _validate_stripesize(struct cmd_context *cmd, const struct volume_group *vg, struct lvresize_params *lp) { - if (arg_sign_value(cmd, stripesize_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, stripesize_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Stripesize may not be negative."); return 0; } @@ -415,7 +415,7 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg, lp->mirrors = arg_uint_value(cmd, mirrors_ARG, 1) + 1; else log_warn("Mirrors not supported. Ignoring."); - if (arg_sign_value(cmd, mirrors_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, mirrors_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Mirrors argument may not be negative"); return EINVALID_CMD_LINE; } @@ -452,7 +452,7 @@ static int _lvresize(struct cmd_context *cmd, struct volume_group *vg, return ECMD_FAILED; } - alloc = arg_uint_value(cmd, alloc_ARG, lv->alloc); + alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, lv->alloc); if (lp->size) { if (lp->size % vg->extent_size) { diff --git a/tools/polldaemon.c b/tools/polldaemon.c index 3103c2bbd..82b9f2475 100644 --- a/tools/polldaemon.c +++ b/tools/polldaemon.c @@ -310,7 +310,7 @@ int poll_daemon(struct cmd_context *cmd, const char *name, const char *uuid, parms.aborting = arg_is_set(cmd, abort_ARG); parms.background = background; - interval_sign = arg_sign_value(cmd, interval_ARG, 0); + interval_sign = arg_sign_value(cmd, interval_ARG, SIGN_NONE); if (interval_sign == SIGN_MINUS) log_error("Argument to --interval cannot be negative"); parms.interval = arg_uint_value(cmd, interval_ARG, diff --git a/tools/pvcreate.c b/tools/pvcreate.c index 01e5634a6..5c12acbc1 100644 --- a/tools/pvcreate.c +++ b/tools/pvcreate.c @@ -78,7 +78,7 @@ static int pvcreate_restore_params_validate(struct cmd_context *cmd, release_vg(vg); } - if (arg_sign_value(cmd, physicalvolumesize_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, physicalvolumesize_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Physical volume size may not be negative"); return 0; } diff --git a/tools/pvmove.c b/tools/pvmove.c index 1e62f69c7..31bb739a3 100644 --- a/tools/pvmove.c +++ b/tools/pvmove.c @@ -492,7 +492,7 @@ static int _set_up_pvmove(struct cmd_context *cmd, const char *pv_name, &pv_name_arg, 0))) goto_out; - alloc = arg_uint_value(cmd, alloc_ARG, ALLOC_INHERIT); + alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, ALLOC_INHERIT); if (alloc == ALLOC_INHERIT) alloc = vg->alloc; diff --git a/tools/pvresize.c b/tools/pvresize.c index 549661a56..ff1981175 100644 --- a/tools/pvresize.c +++ b/tools/pvresize.c @@ -162,7 +162,7 @@ int pvresize(struct cmd_context *cmd, int argc, char **argv) return EINVALID_CMD_LINE; } - if (arg_sign_value(cmd, physicalvolumesize_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, physicalvolumesize_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Physical volume size may not be negative"); return 0; } diff --git a/tools/toollib.c b/tools/toollib.c index 0190b5b86..d68624998 100644 --- a/tools/toollib.c +++ b/tools/toollib.c @@ -1257,7 +1257,7 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd, /* Default depends on current locking type */ vp_new->clustered = locking_is_clustered(); - if (arg_sign_value(cmd, physicalextentsize_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, physicalextentsize_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Physical extent size may not be negative"); return 1; } @@ -1268,12 +1268,12 @@ int vgcreate_params_set_from_args(struct cmd_context *cmd, return 1; } - if (arg_sign_value(cmd, maxlogicalvolumes_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, maxlogicalvolumes_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Max Logical Volumes may not be negative"); return 1; } - if (arg_sign_value(cmd, maxphysicalvolumes_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, maxphysicalvolumes_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Max Physical Volumes may not be negative"); return 1; } @@ -1435,7 +1435,7 @@ int pvcreate_params_validate(struct cmd_context *cmd, if (arg_count(cmd, zero_ARG)) pp->zero = strcmp(arg_str_value(cmd, zero_ARG, "y"), "n"); - if (arg_sign_value(cmd, dataalignment_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, dataalignment_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Physical volume data alignment may not be negative"); return 0; } @@ -1454,7 +1454,7 @@ int pvcreate_params_validate(struct cmd_context *cmd, pp->data_alignment = 0; } - if (arg_sign_value(cmd, dataalignmentoffset_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, dataalignmentoffset_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Physical volume data alignment offset may not be negative"); return 0; } @@ -1472,7 +1472,7 @@ int pvcreate_params_validate(struct cmd_context *cmd, pp->data_alignment_offset = 0; } - if (arg_sign_value(cmd, metadatasize_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, metadatasize_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Metadata size may not be negative"); return 0; } @@ -1562,7 +1562,7 @@ int get_stripe_params(struct cmd_context *cmd, uint32_t *stripes, uint32_t *stri *stripe_size = arg_uint_value(cmd, stripesize_ARG, 0); if (*stripe_size) { - if (arg_sign_value(cmd, stripesize_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, stripesize_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Negative stripesize is invalid"); return 0; } diff --git a/tools/vgchange.c b/tools/vgchange.c index e4933eae3..d8a8eee9c 100644 --- a/tools/vgchange.c +++ b/tools/vgchange.c @@ -280,7 +280,7 @@ static int _vgchange_alloc(struct cmd_context *cmd, struct volume_group *vg) { alloc_policy_t alloc; - alloc = arg_uint_value(cmd, alloc_ARG, ALLOC_NORMAL); + alloc = (alloc_policy_t) arg_uint_value(cmd, alloc_ARG, ALLOC_NORMAL); /* FIXME: make consistent with vg_set_alloc_policy() */ if (alloc == vg->alloc) { @@ -596,13 +596,13 @@ int vgchange(struct cmd_context *cmd, int argc, char **argv) } if (arg_count(cmd, maxphysicalvolumes_ARG) && - arg_sign_value(cmd, maxphysicalvolumes_ARG, 0) == SIGN_MINUS) { + arg_sign_value(cmd, maxphysicalvolumes_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("MaxPhysicalVolumes may not be negative"); return EINVALID_CMD_LINE; } if (arg_count(cmd, physicalextentsize_ARG) && - arg_sign_value(cmd, physicalextentsize_ARG, 0) == SIGN_MINUS) { + arg_sign_value(cmd, physicalextentsize_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Physical extent size may not be negative"); return EINVALID_CMD_LINE; } diff --git a/tools/vgconvert.c b/tools/vgconvert.c index 0a8b9bf50..1106724b6 100644 --- a/tools/vgconvert.c +++ b/tools/vgconvert.c @@ -42,7 +42,7 @@ static int vgconvert_single(struct cmd_context *cmd, const char *vg_name, } if (cmd->fmt->features & FMT_MDAS) { - if (arg_sign_value(cmd, metadatasize_ARG, 0) == SIGN_MINUS) { + if (arg_sign_value(cmd, metadatasize_ARG, SIGN_NONE) == SIGN_MINUS) { log_error("Metadata size may not be negative"); return EINVALID_CMD_LINE; }