master - tools: Use arg_is_set instead of arg_count.
Gitweb: http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7e671e5dd0af699244902d5ce71a7159253c9e2b Commit: 7e671e5dd0af699244902d5ce71a7159253c9e2b Parent: 6c269e639a121329fc035685f944816a763b23cf Author: Alasdair G Kergon <[email protected]> AuthorDate: Tue Jun 21 22:24:52 2016 +0100 Committer: Alasdair G Kergon <[email protected]> CommitterDate: Tue Jun 21 22:24:52 2016 +0100
tools: Use arg_is_set instead of arg_count.
--- tools/dumpconfig.c | 62 +++++++++++++------------- tools/lvchange.c | 116 ++++++++++++++++++++++++------------------------ tools/lvconvert.c | 122 +++++++++++++++++++++++++------------------------- tools/lvcreate.c | 18 ++++---- tools/lvdisplay.c | 26 +++++----- tools/lvmcmdline.c | 98 ++++++++++++++++++++-------------------- tools/lvmdiskscan.c | 6 +- tools/lvresize.c | 22 +++++----- tools/lvscan.c | 6 +- tools/pvchange.c | 26 +++++----- tools/pvcreate.c | 12 +++--- tools/pvdisplay.c | 32 +++++++------- tools/pvmove.c | 4 +- tools/pvscan.c | 24 +++++----- tools/reporter.c | 42 +++++++++--------- tools/toollib.c | 46 +++++++++--------- tools/vgcfgbackup.c | 2 +- tools/vgcfgrestore.c | 8 ++-- tools/vgchange.c | 98 ++++++++++++++++++++-------------------- tools/vgconvert.c | 10 ++-- tools/vgcreate.c | 2 +- tools/vgdisplay.c | 36 +++++++------- tools/vgexport.c | 4 +- tools/vgextend.c | 6 +- tools/vgimport.c | 6 +- tools/vgmknodes.c | 2 +- tools/vgreduce.c | 10 ++-- tools/vgscan.c | 2 +- tools/vgsplit.c | 16 +++--- 29 files changed, 432 insertions(+), 432 deletions(-)
tools/dumpconfig.c +31 -31
@@ -20,9 +20,9 @@ static int _get_vsn(struct cmd_context *cmd, uint16_t *version_int)const char *vsn;unsigned int major, minor, patchlevel; -if (arg_count (cmd, atversion_ARG)) +if (arg_is_set (cmd, atversion_ARG)) vsn =arg_str_value (cmd, atversion_ARG,NULL ); -else if (arg_count (cmd, sinceversion_ARG)) +else if (arg_is_set (cmd, sinceversion_ARG)) vsn =arg_str_value (cmd, sinceversion_ARG,NULL );else vsn =LVM_VERSION ;
@@ -98,7 +98,7 @@ static int _config_validate(struct cmd_context *cmd, struct dm_config_tree *cft)int dumpconfig (struct cmd_context *cmd,int argc,char **argv) {const char *file =arg_str_value (cmd, file_ARG,NULL ); -const char *type =arg_str_value (cmd, configtype_ARG,arg_count (cmd, list_ARG) ?"list" :"current" ); +const char *type =arg_str_value (cmd, configtype_ARG,arg_is_set (cmd, list_ARG) ?"list" :"current" );struct config_def_tree_spec tree_spec = {0 };struct dm_config_tree *cft =NULL ;struct cft_check_handle *cft_check_handle =NULL ;
@@ -107,43 +107,43 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv) tree_spec.cmd = cmd; -if (arg_count (cmd, configtype_ARG) &&arg_count (cmd, validate_ARG)) { +if (arg_is_set (cmd, configtype_ARG) &&arg_is_set (cmd, validate_ARG)) {log_error ("Only one of --type and --validate permitted." );return EINVALID_CMD_LINE ; } -if (arg_count (cmd, configtype_ARG) &&arg_count (cmd, list_ARG)) { +if (arg_is_set (cmd, configtype_ARG) &&arg_is_set (cmd, list_ARG)) {log_error ("Only one of --type and --list permitted." );return EINVALID_CMD_LINE ; } -if (arg_count (cmd, atversion_ARG)) { -if (arg_count (cmd, sinceversion_ARG)) { +if (arg_is_set (cmd, atversion_ARG)) { +if (arg_is_set (cmd, sinceversion_ARG)) {log_error ("Only one of --atversion and --sinceversion permitted." );return EINVALID_CMD_LINE ; } -if (!arg_count (cmd, configtype_ARG) && !arg_count (cmd, list_ARG)) { +if (!arg_is_set (cmd, configtype_ARG) && !arg_is_set (cmd, list_ARG)) {log_error ("--atversion requires --type or --list" );return EINVALID_CMD_LINE ; } - }else if (arg_count (cmd, sinceversion_ARG)) { -if (!arg_count (cmd, configtype_ARG) ||strcmp (type,"new" )) { + }else if (arg_is_set (cmd, sinceversion_ARG)) { +if (!arg_is_set (cmd, configtype_ARG) ||strcmp (type,"new" )) {log_error ("--sinceversion requires --type new" );return EINVALID_CMD_LINE ; } } -if (arg_count (cmd, ignoreadvanced_ARG)) +if (arg_is_set (cmd, ignoreadvanced_ARG)) tree_spec.ignoreadvanced =1 ; -if (arg_count (cmd, ignoreunsupported_ARG)) { -if (arg_count (cmd, showunsupported_ARG)) { +if (arg_is_set (cmd, ignoreunsupported_ARG)) { +if (arg_is_set (cmd, showunsupported_ARG)) {log_error ("Only one of --ignoreunsupported and --showunsupported permitted." );return EINVALID_CMD_LINE ; } tree_spec.ignoreunsupported =1 ; - }else if (arg_count (cmd, showunsupported_ARG)) { + }else if (arg_is_set (cmd, showunsupported_ARG)) { tree_spec.ignoreunsupported =0 ; }else if (strcmp (type,"current" ) &&strcmp (type,"diff" )) {/*
@@ -165,28 +165,28 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)* is lower than the version in which the * setting was deprecated. */ -if (!arg_count (cmd, showdeprecated_ARG)) +if (!arg_is_set (cmd, showdeprecated_ARG)) tree_spec.ignoredeprecated =1 ; } -if (arg_count (cmd, ignorelocal_ARG)) +if (arg_is_set (cmd, ignorelocal_ARG)) tree_spec.ignorelocal =1 ;if (!strcmp (type,"current" ) || !strcmp (type,"full" )) { -if (arg_count (cmd, atversion_ARG)) { +if (arg_is_set (cmd, atversion_ARG)) {log_error ("--atversion has no effect with --type %s" , type);return EINVALID_CMD_LINE ; } -if ((arg_count (cmd, ignoreunsupported_ARG) || -arg_count (cmd, ignoreadvanced_ARG)) && +if ((arg_is_set (cmd, ignoreunsupported_ARG) || +arg_is_set (cmd, ignoreadvanced_ARG)) && !strcmp (type,"current" )) {/* FIXME: allow these even for --type current */ log_error ("--ignoreadvanced and --ignoreunsupported has " "no effect with --type current" );return EINVALID_CMD_LINE ; } - }else if (arg_count (cmd, mergedconfig_ARG)) { + }else if (arg_is_set (cmd, mergedconfig_ARG)) {log_error ("--mergedconfig has no effect without --type current or --type full" );return EINVALID_CMD_LINE ; }
@@ -199,7 +199,7 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)* but it is used just for dumping the profile content and not for * application. */ -if (arg_count (cmd, profile_ARG) && +if (arg_is_set (cmd, profile_ARG) && (!(profile =add_profile (cmd,arg_str_value (cmd, profile_ARG,NULL ),CONFIG_PROFILE_COMMAND )) || !override_config_tree_from_profile (cmd, profile))) {log_error ("Failed to load profile %s." ,arg_str_value (cmd, profile_ARG,NULL ));
@@ -210,7 +210,7 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv)* Set the 'cft' to work with based on whether we need the plain * config tree or merged config tree cascade if --mergedconfig is used. */ -if ((arg_count (cmd, mergedconfig_ARG) || !strcmp (type,"full" ) || !strcmp (type,"diff" )) && cmd->cft->cascade) { +if ((arg_is_set (cmd, mergedconfig_ARG) || !strcmp (type,"full" ) || !strcmp (type,"diff" )) && cmd->cft->cascade) {if (!_merge_config_cascade (cmd, cmd->cft, &cft)) {log_error ("Failed to merge configuration." ); r =ECMD_FAILED ;
@@ -220,7 +220,7 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv) cft = cmd->cft; tree_spec.current_cft = cft; -if (arg_count (cmd, validate_ARG)) { +if (arg_is_set (cmd, validate_ARG)) {if (_config_validate (cmd, cft)) {log_print ("LVM configuration valid." ); goto out;
@@ -231,9 +231,9 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv) } } -if (!strcmp (type,"list" ) ||arg_count (cmd, list_ARG)) { +if (!strcmp (type,"list" ) ||arg_is_set (cmd, list_ARG)) { tree_spec.type =CFG_DEF_TREE_LIST ; -if (arg_count (cmd, withcomments_ARG)) { +if (arg_is_set (cmd, withcomments_ARG)) {log_error ("--withcomments has no effect with --type list" );return EINVALID_CMD_LINE ; }
@@ -270,7 +270,7 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv) } }else if (!strcmp (type,"new" )) { - tree_spec.type =arg_count (cmd, sinceversion_ARG) ?CFG_DEF_TREE_NEW_SINCE + tree_spec.type =arg_is_set (cmd, sinceversion_ARG) ?CFG_DEF_TREE_NEW_SINCE :CFG_DEF_TREE_NEW ;/* new type does not require check status */ }
@@ -294,17 +294,17 @@ int dumpconfig(struct cmd_context *cmd, int argc, char **argv) goto out; } -if (arg_count (cmd, withsummary_ARG) ||arg_count (cmd, list_ARG)) +if (arg_is_set (cmd, withsummary_ARG) ||arg_is_set (cmd, list_ARG)) tree_spec.withsummary =1 ; -if (arg_count (cmd, withcomments_ARG)) +if (arg_is_set (cmd, withcomments_ARG)) tree_spec.withcomments =1 ; -if (arg_count (cmd, unconfigured_ARG)) +if (arg_is_set (cmd, unconfigured_ARG)) tree_spec.unconfigured =1 ; -if (arg_count (cmd, withversions_ARG)) +if (arg_is_set (cmd, withversions_ARG)) tree_spec.withversions =1 ; -if (arg_count (cmd, withspaces_ARG)) +if (arg_is_set (cmd, withspaces_ARG)) tree_spec.withspaces =1 ;if (cft_check_handle)
tools/lvchange.c +58 -58
364 lines not on this page · raw message
tools/lvconvert.c +61 -61
402 lines not on this page · raw message
tools/lvcreate.c +9 -9
@@ -131,7 +131,7 @@ static int _lvcreate_name_params(struct cmd_context *cmd, "in one command is not yet supported.");return 0 ; } - }else if (lp->snapshot && !arg_count (cmd, virtualsize_ARG)) { + }else if (lp->snapshot && !arg_is_set (cmd, virtualsize_ARG)) {/* argv[0] might be [vg/]origin */ if (!argc) { log_error("Please specify a logical volume to act as "
@@ -414,14 +414,14 @@ static int _read_size_params(struct cmd_context *cmd, lcp->virtual_size =arg_uint64_value (cmd, virtualsize_ARG,UINT64_C (0 )); -if (arg_count (cmd, extents_ARG)) { -if (arg_count (cmd, size_ARG)) { +if (arg_is_set (cmd, extents_ARG)) { +if (arg_is_set (cmd, size_ARG)) {log_error ("Please specify either size or extents (not both)." );return 0 ; } lp->extents =arg_uint_value (cmd, extents_ARG,0 ); lcp->percent =arg_percent_value (cmd, extents_ARG,PERCENT_NONE ); - }else if (arg_count (cmd, size_ARG)) { + }else if (arg_is_set (cmd, size_ARG)) { lcp->size =arg_uint64_value (cmd, size_ARG,UINT64_C (0 )); lcp->percent =PERCENT_NONE ; }else if (!lp->snapshot && !seg_is_thin_volume (lp)) {
@@ -459,7 +459,7 @@ static int _read_raid_params(struct cmd_context *cmd, struct lvcreate_params *lp) {if ((lp->stripes <2 ) &&segtype_is_raid10 (lp->segtype)) { -if (arg_count (cmd, stripes_ARG)) { +if (arg_is_set (cmd, stripes_ARG)) {/* User supplied the bad argument */ log_error ("Segment type 'raid10' requires 2 or more stripes." );return 0 ;
@@ -479,7 +479,7 @@ static int _read_raid_params(struct cmd_context *cmd,return 0 ; } -if (arg_count (cmd, mirrors_ARG) &&segtype_is_raid (lp->segtype) && +if (arg_is_set (cmd, mirrors_ARG) &&segtype_is_raid (lp->segtype) && !segtype_is_raid1 (lp->segtype) && !segtype_is_raid10 (lp->segtype)) {log_error ("Mirror argument cannot be used with segment type, %s" , lp->segtype->name);
@@ -509,7 +509,7 @@ static int _read_mirror_and_raid_params(struct cmd_context *cmd,const char *segtype_name;/* Common mirror and raid params */ -if (arg_count (cmd, mirrors_ARG)) { +if (arg_is_set (cmd, mirrors_ARG)) { lp->mirrors =arg_uint_value (cmd, mirrors_ARG,0 ) +1 ;if (segtype_is_raid1 (lp->segtype)) { segtype_name =SEG_TYPE_NAME_RAID1 ;
@@ -1228,7 +1228,7 @@ static int _check_raid_parameters(struct volume_group *vg,* If number of devices was not supplied, we can infer from * the PVs given. */ -if (!arg_count (cmd, stripes_ARG) && +if (!arg_is_set (cmd, stripes_ARG) && (devs >2 * lp->segtype->parity_devs)) lp->stripes = devs - lp->segtype->parity_devs;
@@ -1239,7 +1239,7 @@ static int _check_raid_parameters(struct volume_group *vg,return 0 ; } }else if (segtype_is_raid10 (lp->segtype)) { -if (!arg_count (cmd, stripes_ARG)) +if (!arg_is_set (cmd, stripes_ARG)) lp->stripes = devs / lp->mirrors;if (lp->stripes <2 ) { log_error("Unable to create RAID10 LV,"
tools/lvdisplay.c +13 -13
@@ -18,14 +18,14 @@static int _lvdisplay_single (struct cmd_context *cmd,struct logical_volume *lv,struct processing_handle *handle __attribute__ ((unused))) { -if (!arg_count (cmd, all_ARG) && !lv_is_visible (lv)) +if (!arg_is_set (cmd, all_ARG) && !lv_is_visible (lv))return ECMD_PROCESSED ; -if (arg_count (cmd, colon_ARG)) +if (arg_is_set (cmd, colon_ARG))lvdisplay_colons (lv);else {lvdisplay_full (cmd, lv,NULL ); -if (arg_count (cmd, maps_ARG)) +if (arg_is_set (cmd, maps_ARG))lvdisplay_segments (lv); }
@@ -34,26 +34,26 @@ static int _lvdisplay_single(struct cmd_context *cmd, struct logical_volume *lv,int lvdisplay (struct cmd_context *cmd,int argc,char **argv) { -if (arg_count (cmd, columns_ARG)) { -if (arg_count (cmd, colon_ARG) ||arg_count (cmd, maps_ARG)) { +if (arg_is_set (cmd, columns_ARG)) { +if (arg_is_set (cmd, colon_ARG) ||arg_is_set (cmd, maps_ARG)) {log_error ("Incompatible options selected" );return EINVALID_CMD_LINE ; }return lvs (cmd, argc, argv); } -if (arg_count (cmd, aligned_ARG) || -arg_count (cmd, binary_ARG) || -arg_count (cmd, noheadings_ARG) || -arg_count (cmd, options_ARG) || -arg_count (cmd, separator_ARG) || -arg_count (cmd, sort_ARG) || -arg_count (cmd, unbuffered_ARG)) { +if (arg_is_set (cmd, aligned_ARG) || +arg_is_set (cmd, binary_ARG) || +arg_is_set (cmd, noheadings_ARG) || +arg_is_set (cmd, options_ARG) || +arg_is_set (cmd, separator_ARG) || +arg_is_set (cmd, sort_ARG) || +arg_is_set (cmd, unbuffered_ARG)) {log_error ("Incompatible options selected." );return EINVALID_CMD_LINE ; } -if (arg_count (cmd, colon_ARG) &&arg_count (cmd, maps_ARG)) { +if (arg_is_set (cmd, colon_ARG) &&arg_is_set (cmd, maps_ARG)) {log_error ("Options -c and -m are incompatible." );return EINVALID_CMD_LINE ; }
tools/lvmcmdline.c +49 -49
319 lines not on this page · raw message
tools/lvmdiskscan.c +3 -3
@@ -108,7 +108,7 @@ int lvmdiskscan(struct cmd_context *cmd, int argc __attribute__((unused)), pv_disks_found =0 ; pv_parts_found =0 ; -if (arg_count (cmd, lvmpartition_ARG)) +if (arg_is_set (cmd, lvmpartition_ARG))log_warn ("WARNING: only considering LVM devices" ); max_len =_get_max_dev_name_len (cmd->full_filter);
@@ -132,7 +132,7 @@ int lvmdiskscan(struct cmd_context *cmd, int argc __attribute__((unused)),continue ; }/* If user just wants PVs we are done */ -if (arg_count (cmd, lvmpartition_ARG)) +if (arg_is_set (cmd, lvmpartition_ARG))continue ;/* What other device is it? */
@@ -142,7 +142,7 @@ int lvmdiskscan(struct cmd_context *cmd, int argc __attribute__((unused)),dev_iter_destroy (iter);/* Display totals */ -if (!arg_count (cmd, lvmpartition_ARG)) { +if (!arg_is_set (cmd, lvmpartition_ARG)) {log_print ("%d disk%s" , disks_found, disks_found ==1 ?"" :"s" ); log_print("%d partition%s",
tools/lvresize.c +11 -11
@@ -20,7 +20,7 @@ static int _lvresize_params(struct cmd_context *cmd, int argc, char **argv, {const char *cmd_name;char *st; -int use_policy =arg_count (cmd, usepolicies_ARG); +int use_policy =arg_is_set (cmd, usepolicies_ARG); lp->sign =SIGN_NONE ; lp->poolmetadatasign =SIGN_NONE ;
@@ -45,7 +45,7 @@ static int _lvresize_params(struct cmd_context *cmd, int argc, char **argv,* If only --poolmetadatasize is specified with list of PVs, * then metadata will be extended there. */ - lp->sizeargs =arg_count (cmd, extents_ARG) +arg_count (cmd, size_ARG); + lp->sizeargs =arg_is_set (cmd, extents_ARG) +arg_is_set (cmd, size_ARG); if (arg_from_list_is_zero(cmd, "may not be zero", chunksize_ARG, extents_ARG,
@@ -57,7 +57,7 @@ static int _lvresize_params(struct cmd_context *cmd, int argc, char **argv, -1)) return_0; -if (arg_count (cmd, poolmetadatasize_ARG)) { +if (arg_is_set (cmd, poolmetadatasize_ARG)) { lp->poolmetadatasize =arg_uint64_value (cmd, poolmetadatasize_ARG,0 ); lp->poolmetadatasign =arg_sign_value (cmd, poolmetadatasize_ARG,SIGN_NONE );if (lp->poolmetadatasign ==SIGN_MINUS ) {
@@ -73,20 +73,20 @@ static int _lvresize_params(struct cmd_context *cmd, int argc, char **argv, lp->sizeargs = !lp->poolmetadatasize ?1 :0 ; }else if ((lp->sizeargs !=1 ) && ((lp->sizeargs ==2 ) || - !arg_count (cmd, poolmetadatasize_ARG))) { + !arg_is_set (cmd, poolmetadatasize_ARG))) {log_error ("Please specify either size or extents but not " "both." );return 0 ; } -if (arg_count (cmd, extents_ARG)) { +if (arg_is_set (cmd, extents_ARG)) { lp->extents =arg_uint_value (cmd, extents_ARG,0 ); lp->sign =arg_sign_value (cmd, extents_ARG,SIGN_NONE ); lp->percent =arg_percent_value (cmd, extents_ARG,PERCENT_NONE ); }/* Size returned in kilobyte units; held in sectors */ -if (arg_count (cmd, size_ARG)) { +if (arg_is_set (cmd, size_ARG)) { lp->size =arg_uint64_value (cmd, size_ARG,0 ); lp->sign =arg_sign_value (cmd, size_ARG,SIGN_NONE ); lp->percent =PERCENT_NONE ;
@@ -134,15 +134,15 @@ static int _lvresize_params(struct cmd_context *cmd, int argc, char **argv, lp->argc = argc; lp->argv = argv; - lp->ac_policy =arg_count (cmd, usepolicies_ARG); - lp->ac_stripes =arg_count (cmd, stripes_ARG); + lp->ac_policy =arg_is_set (cmd, usepolicies_ARG); + lp->ac_stripes =arg_is_set (cmd, stripes_ARG);if (lp->ac_stripes) { lp->ac_stripes_value =arg_uint_value (cmd, stripes_ARG,1 ); }else { lp->ac_stripes_value =0 ; } - lp->ac_mirrors =arg_count (cmd, mirrors_ARG); + lp->ac_mirrors =arg_is_set (cmd, mirrors_ARG);if (lp->ac_mirrors) {if (arg_sign_value (cmd, mirrors_ARG,SIGN_NONE ) ==SIGN_MINUS ) {
@@ -155,7 +155,7 @@ static int _lvresize_params(struct cmd_context *cmd, int argc, char **argv, lp->ac_mirrors_value =0 ; } - lp->ac_stripesize =arg_count (cmd, stripesize_ARG); + lp->ac_stripesize =arg_is_set (cmd, stripesize_ARG);if (lp->ac_stripesize) {if (arg_sign_value (cmd, stripesize_ARG,SIGN_NONE ) ==SIGN_MINUS ) {log_error ("Stripesize may not be negative." );
@@ -165,7 +165,7 @@ static int _lvresize_params(struct cmd_context *cmd, int argc, char **argv, lp->ac_stripesize_value =arg_uint64_value (cmd, stripesize_ARG,0 ); } - lp->ac_no_sync =arg_count (cmd, nosync_ARG); + lp->ac_no_sync =arg_is_set (cmd, nosync_ARG); lp->ac_alloc = (alloc_policy_t )arg_uint_value (cmd, alloc_ARG,0 ); lp->ac_type =arg_str_value (cmd, type_ARG,NULL );
tools/lvscan.c +3 -3
@@ -54,10 +54,10 @@ static int lvscan_single(struct cmd_context *cmd, struct logical_volume *lv,const char *active_str, *snapshot_str; -if (arg_count (cmd, cache_long_ARG)) +if (arg_is_set (cmd, cache_long_ARG))return _lvscan_single_lvmetad (cmd, lv); -if (!arg_count (cmd, all_ARG) && !lv_is_visible (lv)) +if (!arg_is_set (cmd, all_ARG) && !lv_is_visible (lv))return ECMD_PROCESSED ; inkernel =lv_info (cmd, lv,0 , &info,0 ,0 ) && info.exists;
@@ -93,7 +93,7 @@ int lvscan(struct cmd_context *cmd, int argc, char **argv) {const char *reason =NULL ; -if (argc && !arg_count (cmd, cache_long_ARG)) { +if (argc && !arg_is_set (cmd, cache_long_ARG)) {log_error ("No additional command line arguments allowed" );return EINVALID_CMD_LINE ; }
tools/pvchange.c +13 -13
@@ -31,7 +31,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct volume_group *vg,int allocatable =arg_int_value (cmd, allocatable_ARG,0 );int mda_ignore =arg_int_value (cmd, metadataignore_ARG,0 ); -int tagargs =arg_count (cmd, addtag_ARG) +arg_count (cmd, deltag_ARG); +int tagargs =arg_is_set (cmd, addtag_ARG) +arg_is_set (cmd, deltag_ARG); params->total++;
@@ -51,7 +51,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct volume_group *vg, vg->name); goto bad; } -if (arg_count (cmd, uuid_ARG)) { +if (arg_is_set (cmd, uuid_ARG)) {log_error ("Resolve duplicate PV UUIDs with vgimportclone (or filters)." ); goto bad; }
@@ -64,7 +64,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct volume_group *vg, "support tags", pv_name); goto bad; } -if (arg_count (cmd, uuid_ARG) &&lvs_in_vg_activated (vg)) { +if (arg_is_set (cmd, uuid_ARG) &&lvs_in_vg_activated (vg)) {log_error ("Volume group containing %s has active " "logical volumes" , pv_name); goto bad;
@@ -88,7 +88,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct volume_group *vg, } } -if (arg_count (cmd, allocatable_ARG)) { +if (arg_is_set (cmd, allocatable_ARG)) {if (is_orphan (pv) && !(pv->fmt->features &FMT_ORPHAN_ALLOCATABLE )) { log_error("Allocatability not supported by orphan "
@@ -129,16 +129,16 @@ static int _pvchange_single(struct cmd_context *cmd, struct volume_group *vg,if (tagargs) {/* tag or deltag */ -if (arg_count (cmd, addtag_ARG) && !change_tag (cmd,NULL ,NULL , pv, addtag_ARG)) +if (arg_is_set (cmd, addtag_ARG) && !change_tag (cmd,NULL ,NULL , pv, addtag_ARG)) goto_bad; -if (arg_count (cmd, deltag_ARG) && !change_tag (cmd,NULL ,NULL , pv, deltag_ARG)) +if (arg_is_set (cmd, deltag_ARG) && !change_tag (cmd,NULL ,NULL , pv, deltag_ARG)) goto_bad; done =1 ; } - if (arg_count(cmd, metadataignore_ARG)) { + if (arg_is_set(cmd, metadataignore_ARG)) { if ((vg_mda_copies(vg) != VGMETADATACOPIES_UNMANAGED) && (arg_count(cmd, force_ARG) == PROMPT) && yes_no_prompt("Override preferred number of copies "
@@ -151,7 +151,7 @@ static int _pvchange_single(struct cmd_context *cmd, struct volume_group *vg, done =1 ; } -if (arg_count (cmd, uuid_ARG)) { +if (arg_is_set (cmd, uuid_ARG)) {/* --uuid: Change PV ID randomly */ memcpy (&pv->old_id, &pv->id,sizeof (pv->id));if (!id_create (&pv->id)) {
@@ -207,9 +207,9 @@ int pvchange(struct cmd_context *cmd, int argc, char **argv)struct processing_handle *handle =NULL ;int ret; -if (!(arg_count (cmd, allocatable_ARG) +arg_is_set (cmd, addtag_ARG) + -arg_is_set (cmd, deltag_ARG) +arg_count (cmd, uuid_ARG) + -arg_count (cmd, metadataignore_ARG))) { +if (!(arg_is_set (cmd, allocatable_ARG) +arg_is_set (cmd, addtag_ARG) + +arg_is_set (cmd, deltag_ARG) +arg_is_set (cmd, uuid_ARG) + +arg_is_set (cmd, metadataignore_ARG))) {log_error ("Please give one or more of -x, -uuid, " "--addtag, --deltag or --metadataignore" ); ret =EINVALID_CMD_LINE ;
@@ -224,13 +224,13 @@ int pvchange(struct cmd_context *cmd, int argc, char **argv) handle->custom_handle = ¶ms; -if (!(arg_count (cmd, all_ARG)) && !argc && !handle->internal_report_for_select) { +if (!(arg_is_set (cmd, all_ARG)) && !argc && !handle->internal_report_for_select) {log_error ("Please give a physical volume path or use --select for selection." ); ret =EINVALID_CMD_LINE ; goto out; } -if (arg_count (cmd, all_ARG) && argc) { +if (arg_is_set (cmd, all_ARG) && argc) {log_error ("Option --all and PhysicalVolumePath are exclusive." ); ret =EINVALID_CMD_LINE ; goto out;
tools/pvcreate.c +6 -6
@@ -27,25 +27,25 @@ static int pvcreate_restore_params_from_args(struct cmd_context *cmd, int argc, { pp->restorefile =arg_str_value (cmd, restorefile_ARG,NULL ); -if (arg_count (cmd, restorefile_ARG) && !arg_count (cmd, uuidstr_ARG)) { +if (arg_is_set (cmd, restorefile_ARG) && !arg_is_set (cmd, uuidstr_ARG)) {log_error ("--uuid is required with --restorefile" );return 0 ; } -if (!arg_count (cmd, restorefile_ARG) &&arg_count (cmd, uuidstr_ARG)) { -if (!arg_count (cmd, norestorefile_ARG) && +if (!arg_is_set (cmd, restorefile_ARG) &&arg_is_set (cmd, uuidstr_ARG)) { +if (!arg_is_set (cmd, norestorefile_ARG) &&find_config_tree_bool (cmd, devices_require_restorefile_with_uuid_CFG,NULL )) {log_error ("--restorefile is required with --uuid" );return 0 ; } } -if (arg_count (cmd, uuidstr_ARG) && argc !=1 ) { +if (arg_is_set (cmd, uuidstr_ARG) && argc !=1 ) {log_error ("Can only set uuid on one volume at once" );return 0 ; } -if (arg_count (cmd, uuidstr_ARG)) { +if (arg_is_set (cmd, uuidstr_ARG)) { pp->uuid_str =arg_str_value (cmd, uuidstr_ARG,"" );if (!id_read_format (&pp->pva.id, pp->uuid_str))return 0 ;
@@ -58,7 +58,7 @@ static int pvcreate_restore_params_from_args(struct cmd_context *cmd, int argc, } pp->pva.size =arg_uint64_value (cmd, physicalvolumesize_ARG,UINT64_C (0 )); -if (arg_count (cmd, restorefile_ARG) ||arg_count (cmd, uuidstr_ARG)) +if (arg_is_set (cmd, restorefile_ARG) ||arg_is_set (cmd, uuidstr_ARG)) pp->zero =0 ;return 1 ; }
tools/pvdisplay.c +16 -16
@@ -30,7 +30,7 @@ static int _pvdisplay_single(struct cmd_context *cmd, size = (uint64_t )(pv_pe_count (pv) -pv_pe_alloc_count (pv)) *pv_pe_size (pv); -if (arg_count (cmd, short_ARG)) { +if (arg_is_set (cmd, short_ARG)) {log_print ("Device \"%s\" has a capacity of %s" , pv_name,display_size (cmd, size)); goto out;
@@ -44,14 +44,14 @@ static int _pvdisplay_single(struct cmd_context *cmd,log_print_unless_silent ("\"%s\" is a new physical volume of \"%s\"" , pv_name,display_size (cmd, size)); -if (arg_count (cmd, colon_ARG)) { +if (arg_is_set (cmd, colon_ARG)) {pvdisplay_colons (pv); goto out; }pvdisplay_full (cmd, pv,NULL ); -if (arg_count (cmd, maps_ARG)) +if (arg_is_set (cmd, maps_ARG))pvdisplay_segments (pv); out:
@@ -63,33 +63,33 @@ int pvdisplay(struct cmd_context *cmd, int argc, char **argv)int lock_global =0 ;int ret; -if (arg_count (cmd, columns_ARG)) { -if (arg_count (cmd, colon_ARG) ||arg_count (cmd, maps_ARG) || -arg_count (cmd, short_ARG)) { +if (arg_is_set (cmd, columns_ARG)) { +if (arg_is_set (cmd, colon_ARG) ||arg_is_set (cmd, maps_ARG) || +arg_is_set (cmd, short_ARG)) {log_error ("Incompatible options selected" );return EINVALID_CMD_LINE ; }return pvs (cmd, argc, argv); } -if (arg_count (cmd, aligned_ARG) || -arg_count (cmd, all_ARG) || -arg_count (cmd, binary_ARG) || -arg_count (cmd, noheadings_ARG) || -arg_count (cmd, options_ARG) || -arg_count (cmd, separator_ARG) || -arg_count (cmd, sort_ARG) || -arg_count (cmd, unbuffered_ARG)) { +if (arg_is_set (cmd, aligned_ARG) || +arg_is_set (cmd, all_ARG) || +arg_is_set (cmd, binary_ARG) || +arg_is_set (cmd, noheadings_ARG) || +arg_is_set (cmd, options_ARG) || +arg_is_set (cmd, separator_ARG) || +arg_is_set (cmd, sort_ARG) || +arg_is_set (cmd, unbuffered_ARG)) {log_error ("Incompatible options selected" );return EINVALID_CMD_LINE ; } -if (arg_count (cmd, colon_ARG) &&arg_count (cmd, maps_ARG)) { +if (arg_is_set (cmd, colon_ARG) &&arg_is_set (cmd, maps_ARG)) {log_error ("Option -c not allowed with option -m" );return EINVALID_CMD_LINE ; } -if (arg_count (cmd, colon_ARG) &&arg_count (cmd, short_ARG)) { +if (arg_is_set (cmd, colon_ARG) &&arg_is_set (cmd, short_ARG)) {log_error ("Option -c is not allowed with option -s" );return EINVALID_CMD_LINE ; }
tools/pvmove.c +2 -2
@@ -493,7 +493,7 @@ static struct logical_volume *_set_up_pvmove_lv(struct cmd_context *cmd,if (!lv_add_mirrors (cmd, lv_mirr,1 ,1 ,0 ,0 , log_count, allocatable_pvs, alloc, - (arg_count (cmd, atomic_ARG)) ? + (arg_is_set (cmd, atomic_ARG)) ?MIRROR_BY_SEGMENTED_LV :MIRROR_BY_SEG )) {log_error ("Failed to convert pvmove LV to mirrored" ); return_NULL;
@@ -862,7 +862,7 @@ int pvmove(struct cmd_context *cmd, int argc, char **argv) pp.pv_count = argc; pp.pv_names = argv; -if (arg_count (cmd, name_ARG)) { +if (arg_is_set (cmd, name_ARG)) {if (!(pp.lv_name_arg =dm_pool_strdup (cmd->mem,arg_value (cmd, name_ARG)))) {log_error ("Failed to clone LV name." );return ECMD_FAILED ;
tools/pvscan.c +12 -12
@@ -46,7 +46,7 @@ static int _pvscan_display_single(struct cmd_context *cmd,const char *pvdevname =pv_dev_name (pv);/* short listing? */ -if (arg_count (cmd, short_ARG) >0 ) { +if (arg_is_set (cmd, short_ARG)) {log_print_unless_silent ("%s" , pvdevname);return ECMD_PROCESSED ; }
@@ -65,7 +65,7 @@ static int _pvscan_display_single(struct cmd_context *cmd, pv_len = params->pv_max_name_len;memset (params->pv_tmp_name,0 , params->pv_tmp_namelen); -if (arg_count (cmd, uuid_ARG)) { +if (arg_is_set (cmd, uuid_ARG)) {if (!id_write_format (&pv->id, uuid,sizeof (uuid))) { stack;return ECMD_FAILED ;
@@ -106,8 +106,8 @@ static int _pvscan_single(struct cmd_context *cmd, struct volume_group *vg, {struct pvscan_params *params = (struct pvscan_params *)handle->custom_handle; -if ((arg_count (cmd, exported_ARG) && !(pv_status (pv) &EXPORTED_VG )) || - (arg_count (cmd, novolumegroup_ARG) && (!is_orphan (pv)))) { +if ((arg_is_set (cmd, exported_ARG) && !(pv_status (pv) &EXPORTED_VG )) || + (arg_is_set (cmd, novolumegroup_ARG) && (!is_orphan (pv)))) {return ECMD_PROCESSED ; }
@@ -332,10 +332,10 @@ static int _pvscan_cache(struct cmd_context *cmd, int argc, char **argv)return ret; } -if (arg_count (cmd, major_ARG) +arg_count (cmd, minor_ARG)) +if (arg_is_set (cmd, major_ARG) +arg_is_set (cmd, minor_ARG)) devno_args =1 ; -if (devno_args && (!arg_count (cmd, major_ARG) || !arg_count (cmd, minor_ARG))) { +if (devno_args && (!arg_is_set (cmd, major_ARG) || !arg_is_set (cmd, minor_ARG))) {log_error ("Both --major and --minor required to identify devices." );return EINVALID_CMD_LINE ; }
@@ -587,7 +587,7 @@ int pvscan(struct cmd_context *cmd, int argc, char **argv)const char *reason =NULL ;int ret; -if (arg_count (cmd, cache_long_ARG)) +if (arg_is_set (cmd, cache_long_ARG))return _pvscan_cache (cmd, argc, argv);if (argc) {
@@ -595,24 +595,24 @@ int pvscan(struct cmd_context *cmd, int argc, char **argv)return EINVALID_CMD_LINE ; } -if (arg_count (cmd, activate_ARG)) { +if (arg_is_set (cmd, activate_ARG)) {log_error ("--activate is only valid with --cache." );return EINVALID_CMD_LINE ; } -if (arg_count (cmd, major_ARG) ||arg_count (cmd, minor_ARG)) { +if (arg_is_set (cmd, major_ARG) ||arg_is_set (cmd, minor_ARG)) {log_error ("--major and --minor are only valid with --cache." );return EINVALID_CMD_LINE ; } -if (arg_count (cmd, novolumegroup_ARG) &&arg_count (cmd, exported_ARG)) { +if (arg_is_set (cmd, novolumegroup_ARG) &&arg_is_set (cmd, exported_ARG)) {log_error ("Options -e and -n are incompatible" );return EINVALID_CMD_LINE ; } -if (arg_count (cmd, exported_ARG) ||arg_count (cmd, novolumegroup_ARG)) +if (arg_is_set (cmd, exported_ARG) ||arg_is_set (cmd, novolumegroup_ARG))log_warn ("WARNING: only considering physical volumes %s" , -arg_count (cmd, exported_ARG) ? +arg_is_set (cmd, exported_ARG) ?"of exported volume group(s)" :"in no volume group" );/* Needed because this command has NO_LVMETAD_AUTOSCAN. */
tools/reporter.c +21 -21
140 lines not on this page · raw message
tools/toollib.c +23 -23
132 lines not on this page · raw message
tools/vgcfgbackup.c +1 -1
@@ -54,7 +54,7 @@ static int vg_backup_single(struct cmd_context *cmd, const char *vg_name,char **last_filename = (char **)handle->custom_handle;char *filename; -if (arg_count (cmd, file_ARG)) { +if (arg_is_set (cmd, file_ARG)) {if (!(filename =_expand_filename (arg_value (cmd, file_ARG), vg->name, last_filename))) return_ECMD_FAILED;
tools/vgcfgrestore.c +4 -4
@@ -28,7 +28,7 @@ int vgcfgrestore(struct cmd_context *cmd, int argc, char **argv)log_error ("Volume group name \"%s\" is invalid" , vg_name);return EINVALID_CMD_LINE ; } - }else if (!(arg_count (cmd, list_ARG) &&arg_count (cmd, file_ARG))) { + }else if (!(arg_is_set (cmd, list_ARG) &&arg_is_set (cmd, file_ARG))) {log_error ("Please specify a *single* volume group to restore." );return EINVALID_CMD_LINE ; }
@@ -37,8 +37,8 @@ int vgcfgrestore(struct cmd_context *cmd, int argc, char **argv)* FIXME: overloading the -l arg for now to display a * list of archive files for a particular vg */ -if (arg_count (cmd, list_ARG)) { -if (!(arg_count (cmd,file_ARG) ? +if (arg_is_set (cmd, list_ARG)) { +if (!(arg_is_set (cmd,file_ARG) ?archive_display_file (cmd,arg_str_value (cmd, file_ARG,"" )) :archive_display (cmd, vg_name)))
@@ -76,7 +76,7 @@ int vgcfgrestore(struct cmd_context *cmd, int argc, char **argv) cmd->handles_unknown_segments =1 ; - if (!(arg_count(cmd, file_ARG) ? + if (!(arg_is_set(cmd, file_ARG) ? backup_restore_from_file(cmd, vg_name, arg_str_value(cmd, file_ARG, ""), arg_count(cmd, force_long_ARG)) :
tools/vgchange.c +49 -49
221 lines not on this page · raw message
tools/vgconvert.c +5 -5
@@ -157,26 +157,26 @@ int vgconvert(struct cmd_context *cmd, int argc, char **argv)return EINVALID_CMD_LINE ; } -if (arg_count (cmd, metadatacopies_ARG)) { +if (arg_is_set (cmd, metadatacopies_ARG)) {log_error ("Invalid option --metadatacopies, " "use --pvmetadatacopies instead." );return EINVALID_CMD_LINE ; }if (!(cmd->fmt->features &FMT_MDAS ) && - (arg_count (cmd, pvmetadatacopies_ARG) || -arg_count (cmd, metadatasize_ARG))) { + (arg_is_set (cmd, pvmetadatacopies_ARG) || +arg_is_set (cmd, metadatasize_ARG))) {log_error ("Metadata parameters only apply to text format" );return EINVALID_CMD_LINE ; } -if (arg_count (cmd, pvmetadatacopies_ARG) && +if (arg_is_set (cmd, pvmetadatacopies_ARG) &&arg_int_value (cmd, pvmetadatacopies_ARG,-1 ) >2 ) {log_error ("Metadatacopies may only be 0, 1 or 2" );return EINVALID_CMD_LINE ; }if (!(cmd->fmt->features &FMT_BAS ) && -arg_count (cmd, bootloaderareasize_ARG)) { +arg_is_set (cmd, bootloaderareasize_ARG)) {log_error ("Bootloader area parameters only apply to text format" );return EINVALID_CMD_LINE ; }
tools/vgcreate.c +1 -1
@@ -141,7 +141,7 @@ int vgcreate(struct cmd_context *cmd, int argc, char **argv)log_warn ("WARNING: Setting maxphysicalvolumes to %d " "(0 means unlimited)" , vg->max_pv); -if (arg_count (cmd, addtag_ARG)) { +if (arg_is_set (cmd, addtag_ARG)) { dm_list_iterate_items(current_group, &cmd->arg_value_groups) {if (!grouped_arg_is_set (current_group->arg_values, addtag_ARG))continue ;
tools/vgdisplay.c +18 -18
@@ -19,22 +19,22 @@ static int vgdisplay_single(struct cmd_context *cmd, const char *vg_name,struct volume_group *vg, struct processing_handle *handle __attribute__((unused))) { -if (arg_count (cmd, activevolumegroups_ARG) && !lvs_in_vg_activated (vg)) +if (arg_is_set (cmd, activevolumegroups_ARG) && !lvs_in_vg_activated (vg))return ECMD_PROCESSED ; -if (arg_count (cmd, colon_ARG)) { +if (arg_is_set (cmd, colon_ARG)) {vgdisplay_colons (vg);return ECMD_PROCESSED ; } -if (arg_count (cmd, short_ARG)) { +if (arg_is_set (cmd, short_ARG)) {vgdisplay_short (vg);return ECMD_PROCESSED ; }vgdisplay_full (vg);/* was vg_show */ -if (arg_count (cmd, verbose_ARG)) { +if (arg_is_set (cmd, verbose_ARG)) {vgdisplay_extents (vg); process_each_lv_in_vg(cmd, vg, NULL, NULL, 0, NULL,
@@ -52,30 +52,30 @@ static int vgdisplay_single(struct cmd_context *cmd, const char *vg_name,int vgdisplay (struct cmd_context *cmd,int argc,char **argv) { -if (arg_count (cmd, columns_ARG)) { -if (arg_count (cmd, colon_ARG) || -arg_count (cmd, activevolumegroups_ARG) || -arg_count (cmd, short_ARG)) { +if (arg_is_set (cmd, columns_ARG)) { +if (arg_is_set (cmd, colon_ARG) || +arg_is_set (cmd, activevolumegroups_ARG) || +arg_is_set (cmd, short_ARG)) {log_error ("Incompatible options selected" );return EINVALID_CMD_LINE ; }return vgs (cmd, argc, argv); - }else if (arg_count (cmd, aligned_ARG) || -arg_count (cmd, binary_ARG) || -arg_count (cmd, noheadings_ARG) || -arg_count (cmd, options_ARG) || -arg_count (cmd, separator_ARG) || -arg_count (cmd, sort_ARG) ||arg_count (cmd, unbuffered_ARG)) { + }else if (arg_is_set (cmd, aligned_ARG) || +arg_is_set (cmd, binary_ARG) || +arg_is_set (cmd, noheadings_ARG) || +arg_is_set (cmd, options_ARG) || +arg_is_set (cmd, separator_ARG) || +arg_is_set (cmd, sort_ARG) ||arg_is_set (cmd, unbuffered_ARG)) {log_error ("Incompatible options selected" );return EINVALID_CMD_LINE ; } -if (arg_count (cmd, colon_ARG) &&arg_count (cmd, short_ARG)) { +if (arg_is_set (cmd, colon_ARG) &&arg_is_set (cmd, short_ARG)) {log_error ("Option -c is not allowed with option -s" );return EINVALID_CMD_LINE ; } -if (argc &&arg_count (cmd, activevolumegroups_ARG)) { +if (argc &&arg_is_set (cmd, activevolumegroups_ARG)) {log_error ("Option -A is not allowed with volume group names" );return EINVALID_CMD_LINE ; }
@@ -93,11 +93,11 @@ int vgdisplay(struct cmd_context *cmd, int argc, char **argv) vgdisplay_single);/******** FIXME Need to count number processed -Add this to process_each_vg if arg_count(cmd,activevolumegroups_ARG) ? +Add this to process_each_vg if arg_is_set(cmd,activevolumegroups_ARG) ? if (opt == argc) { log_print("no "); -if (arg_count(cmd,activevolumegroups_ARG)) +if (arg_is_set(cmd,activevolumegroups_ARG)) printf("active "); printf("volume groups found\n\n"); return LVM_E_NO_VG;
tools/vgexport.c +2 -2
@@ -70,12 +70,12 @@ bad:int vgexport (struct cmd_context *cmd,int argc,char **argv) { -if (!argc && !arg_count (cmd, all_ARG) && !arg_is_set (cmd, select_ARG)) { +if (!argc && !arg_is_set (cmd, all_ARG) && !arg_is_set (cmd, select_ARG)) {log_error ("Please supply volume groups or use --select for selection or use -a for all." );return EINVALID_CMD_LINE ; } -if (arg_count (cmd, all_ARG) && (argc ||arg_is_set (cmd, select_ARG))) { +if (arg_is_set (cmd, all_ARG) && (argc ||arg_is_set (cmd, select_ARG))) {log_error ("No arguments permitted when using -a for all." );return EINVALID_CMD_LINE ; }
tools/vgextend.c +3 -3
@@ -82,7 +82,7 @@ static int _vgextend_single(struct cmd_context *cmd, const char *vg_name,uint32_t mda_used;int ret =ECMD_FAILED ; -if (arg_count (cmd, metadataignore_ARG) && +if (arg_is_set (cmd, metadataignore_ARG) && (pp->force ==PROMPT ) && !pp->yes && (vg_mda_copies (vg) !=VGMETADATACOPIES_UNMANAGED ) && (yes_no_prompt ("Override preferred number of copies of VG %s metadata? [y/n]: " , vg_name) =='n' )) {
@@ -96,7 +96,7 @@ static int _vgextend_single(struct cmd_context *cmd, const char *vg_name,if (!vg_extend_each_pv (vg, pp)) goto_out; -if (arg_count (cmd, metadataignore_ARG)) { +if (arg_is_set (cmd, metadataignore_ARG)) { mda_copies =vg_mda_copies (vg); mda_used =vg_mda_used_count (vg);
@@ -136,7 +136,7 @@ int vgextend(struct cmd_context *cmd, int argc, char **argv)return EINVALID_CMD_LINE ; } -if (arg_count (cmd, metadatacopies_ARG)) { +if (arg_is_set (cmd, metadatacopies_ARG)) {log_error ("Invalid option --metadatacopies, " "use --pvmetadatacopies instead." );return EINVALID_CMD_LINE ;
tools/vgimport.c +3 -3
@@ -63,17 +63,17 @@ int vgimport(struct cmd_context *cmd, int argc, char **argv) {const char *reason =NULL ; -if (!argc && !arg_count (cmd, all_ARG) && !arg_is_set (cmd, select_ARG)) { +if (!argc && !arg_is_set (cmd, all_ARG) && !arg_is_set (cmd, select_ARG)) {log_error ("Please supply volume groups or -S for selection or use -a for all." );return EINVALID_CMD_LINE ; } -if (arg_count (cmd, all_ARG) && (argc ||arg_is_set (cmd, select_ARG))) { +if (arg_is_set (cmd, all_ARG) && (argc ||arg_is_set (cmd, select_ARG))) {log_error ("No arguments permitted when using -a for all." );return EINVALID_CMD_LINE ; } -if (arg_count (cmd, force_ARG)) { +if (arg_is_set (cmd, force_ARG)) {/* * The volume group cannot be repaired unless it is first * imported. If we don't allow the user a way to import the
tools/vgmknodes.c +1 -1
@@ -18,7 +18,7 @@static int _vgmknodes_single (struct cmd_context *cmd,struct logical_volume *lv,struct processing_handle *handle __attribute__((unused))) { -if (arg_count (cmd, refresh_ARG) &&lv_is_visible (lv)) +if (arg_is_set (cmd, refresh_ARG) &&lv_is_visible (lv))if (!lv_refresh (cmd, lv)) return_ECMD_FAILED;
tools/vgreduce.c +5 -5
@@ -107,7 +107,7 @@ static int _make_vg_consistent(struct cmd_context *cmd, struct volume_group *vg) goto restart; } -if (arg_count (cmd, mirrorsonly_ARG) && !lv_is_mirrored (lv)) { +if (arg_is_set (cmd, mirrorsonly_ARG) && !lv_is_mirrored (lv)) {log_error ("Non-mirror-image LV %s found: can't remove." , lv->name);continue ; }
@@ -177,7 +177,7 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)struct processing_handle *handle;struct vgreduce_params vp = {0 };const char *vg_name; -int repairing =arg_count (cmd, removemissing_ARG); +int repairing =arg_is_set (cmd, removemissing_ARG);int saved_ignore_suspended_devices =ignore_suspended_devices ();int ret;
@@ -192,17 +192,17 @@ int vgreduce(struct cmd_context *cmd, int argc, char **argv)return EINVALID_CMD_LINE ; } -if (arg_count (cmd, mirrorsonly_ARG) && !repairing) { +if (arg_is_set (cmd, mirrorsonly_ARG) && !repairing) {log_error ("--mirrorsonly requires --removemissing" );return EINVALID_CMD_LINE ; } -if (argc ==1 && !arg_count (cmd, all_ARG) && !repairing) { +if (argc ==1 && !arg_is_set (cmd, all_ARG) && !repairing) {log_error ("Please enter physical volume paths or option -a" );return EINVALID_CMD_LINE ; } -if (argc >1 &&arg_count (cmd, all_ARG)) { +if (argc >1 &&arg_is_set (cmd, all_ARG)) {log_error ("Option -a and physical volume paths mutually " "exclusive" );return EINVALID_CMD_LINE ;
tools/vgscan.c +1 -1
@@ -119,7 +119,7 @@ int vgscan(struct cmd_context *cmd, int argc, char **argv) maxret =process_each_vg (cmd, argc, argv,NULL ,NULL ,0 ,0 ,NULL , &vgscan_single); -if (arg_count (cmd, mknodes_ARG)) { +if (arg_is_set (cmd, mknodes_ARG)) { ret =vgmknodes (cmd, argc, argv);if (ret > maxret) maxret = ret;
tools/vgsplit.c +8 -8
@@ -468,11 +468,11 @@ static struct volume_group *_vgsplit_from(struct cmd_context *cmd,*/ static int new_vg_option_specified (struct cmd_context *cmd) { -return (arg_count (cmd, clustered_ARG) || -arg_count (cmd, alloc_ARG) || -arg_count (cmd, maxphysicalvolumes_ARG) || -arg_count (cmd, maxlogicalvolumes_ARG) || -arg_count (cmd, vgmetadatacopies_ARG)); +return (arg_is_set (cmd, clustered_ARG) || +arg_is_set (cmd, alloc_ARG) || +arg_is_set (cmd, maxphysicalvolumes_ARG) || +arg_is_set (cmd, maxlogicalvolumes_ARG) || +arg_is_set (cmd, vgmetadatacopies_ARG)); }int vgsplit (struct cmd_context *cmd,int argc,char **argv)
@@ -487,13 +487,13 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)const char *lv_name;int lock_vg_from_first =1 ; -if ((arg_count (cmd, name_ARG) + argc) <3 ) { +if ((arg_is_set (cmd, name_ARG) + argc) <3 ) {log_error ("Existing VG, new VG and either physical volumes " "or logical volume required." );return EINVALID_CMD_LINE ; } -if (arg_count (cmd, name_ARG) && (argc >2 )) { +if (arg_is_set (cmd, name_ARG) && (argc >2 )) {log_error ("A logical volume name cannot be given with " "physical volumes." );return ECMD_FAILED ;
@@ -503,7 +503,7 @@ int vgsplit(struct cmd_context *cmd, int argc, char **argv)if (!lockd_gl (cmd,"ex" ,LDGL_UPDATE_NAMES )) return_ECMD_FAILED; -if (arg_count (cmd, name_ARG)) +if (arg_is_set (cmd, name_ARG)) lv_name =arg_value (cmd, name_ARG);else lv_name =NULL ;