1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-10-06 11:33:14 +03:00

Compare commits

..

1 Commits

Author SHA1 Message Date
David Teigland
46430c242b commands: new method for defining commands 2016-09-26 16:43:33 -05:00
8 changed files with 3336 additions and 3250 deletions

View File

@@ -84,6 +84,11 @@
# maxrecoveryrate (raidmaxrecoveryrate)
# writebehind (raidwritebehind)
#
# DESC: describe what the command does, with a separate
# sentence ending in '.' for each unique operation.
# A new line is printed after each '.' so be careful
# about where '.' is used.
#
#
# For efficiency, sets of options can be defined and reused
@@ -121,7 +126,7 @@ OO_REPORT: --aligned, --all, --binary, --configreport String, --foreign,
--nameprefixes, --noheadings, --nolocking, --nosuffix,
--options String, --partial, --readonly, --reportformat String, --rows,
--select String, --separator String, --shared, --sort String,
--trustcache, --unbuffered, --units String, --unquoted
--trustcache, --unbuffered, --units Units, --unquoted
#
# config, dumpconfig, lvmconfig
@@ -170,12 +175,12 @@ OO_LVCHANGE: --autobackup Bool, --force, --ignorelockingfailure,
# because it can function as a required opt.
#
OO_LVCHANGE_META: --addtag Tag, --deltag Tag,
--alloc String, --contiguous Bool,
--alloc Alloc, --contiguous Bool,
--detachprofile, --metadataprofile String, --profile String,
--permission, --readahead Number|String, --setactivationskip Bool,
--errorwhenfull Bool, --discards String, --zero Bool,
--cachemode String, --cachepolicy String, --cachesettings String,
--minrecoveryrate Number, --maxrecoveryrate Number,
--permission Permission, --readahead Readahead, --setactivationskip Bool,
--errorwhenfull Bool, --discards Discards, --zero Bool,
--cachemode CacheMode, --cachepolicy String, --cachesettings String,
--minrecoveryrate SizeKB, --maxrecoveryrate SizeKB,
--writebehind Number, --writemostly PV
lvchange OO_LVCHANGE_META VG|LV|Tag|Select ...
@@ -190,8 +195,8 @@ OO: OO_LVCHANGE_META, OO_LVCHANGE
lvchange --rebuild PV VG|LV|Tag|Select ...
OO: OO_LVCHANGE_META, OO_LVCHANGE
lvchange --activate String VG|LV|Tag|Select ...
OO: --activationmode String, --partial, --ignoreactivationskip, OO_LVCHANGE_META, OO_LVCHANGE
lvchange --activate Active VG|LV|Tag|Select ...
OO: --activationmode ActivationMode, --partial, --ignoreactivationskip, OO_LVCHANGE_META, OO_LVCHANGE
lvchange --refresh VG|LV|Tag|Select ...
OO: OO_LVCHANGE_META, OO_LVCHANGE
@@ -206,13 +211,13 @@ lvchange --persistent Bool VG|LV|Tag|Select ...
OO: --minor Number, --major Number, OO_LVCHANGE_META, OO_LVCHANGE
OO_LVCONVERT_RAID: --mirrors Number, --stripes_long Number,
--stripesize Number, --regionsize Number
OO_LVCONVERT_RAID: --mirrors SNumber, --stripes_long Number,
--stripesize SizeKB, --regionsize SizeMB
OO_LVCONVERT_POOL: --poolmetadata LV, --poolmetadatasize Number,
--poolmetadataspare Bool, --readahead Number|String, --chunksize Number
OO_LVCONVERT_POOL: --poolmetadata LV, --poolmetadatasize SizeMB,
--poolmetadataspare Bool, --readahead Readahead, --chunksize SizeKB
OO_LVCONVERT: --alloc String, --background, --force, --noudevsync,
OO_LVCONVERT: --alloc Alloc, --background, --force, --noudevsync,
--test, --usepolicies
# FIXME: use different option names for different operations
@@ -223,7 +228,7 @@ DESC: Merge thin LV into its origin LV.
DESC: Merge COW snapshot LV into its origin.
lvconvert --type snapshot LV_linear|LV_striped|LV_raid LV_snapshot
OO: --chunksize Number, --zero Bool, OO_LVCONVERT
OO: --chunksize SizeKB, --zero Bool, OO_LVCONVERT
DESC: Combine LV with a previously split snapshot LV.
lvconvert --type thin --thinpool LV LV_linear|LV_striped|LV_raid
@@ -245,7 +250,7 @@ OO: --type cache, --cachepolicy String, --cachesettings String, OO_LVCONVERT_POO
DESC: Convert LV to type cache (infers --type cache).
lvconvert --type thin-pool LV_linear|LV_striped|LV_raid|LV_cache
OO: --discards String, --zero Bool, OO_LVCONVERT_POOL, OO_LVCONVERT
OO: --discards Discards, --zero Bool, OO_LVCONVERT_POOL, OO_LVCONVERT
DESC: Convert LV to type thin-pool.
lvconvert --type cache-pool LV_linear|LV_striped|LV_raid
@@ -263,12 +268,12 @@ OP: PV ...
DESC: Convert LV to type raid.
DESC: Change LV raid type.
lvconvert --mirrors Number LV_raid|LV_mirror
lvconvert --mirrors SNumber LV_raid|LV_mirror
OO: OO_LVCONVERT
OP: PV ...
DESC: Change the number of mirror images in the LV.
lvconvert --mirrors Number LV_linear|LV_striped
lvconvert --mirrors SNumber LV_linear|LV_striped
OO: OO_LVCONVERT_RAID, OO_LVCONVERT
OP: PV ...
DESC: Alternate form to convert LV to type raid1 or mirror (use --type raid1|mirror).
@@ -300,7 +305,7 @@ lvconvert --type linear LV_raid|LV_mirror
OO: OO_LVCONVERT
DESC: Convert LV to type linear.
lvconvert --mirrorlog String LV_mirror
lvconvert --mirrorlog MirrorLog LV_mirror
OO: OO_LVCONVERT
DESC: Change the type of log used by LV.
@@ -338,71 +343,71 @@ DESC: Swap metadata LV in a thin pool or cache pool (temporary command).
# --extents or --size are interchangable
OO_LVCREATE: --addtag Tag, --alloc String, --autobackup Bool, --activate String,
OO_LVCREATE: --addtag Tag, --alloc Alloc, --autobackup Bool, --activate Active,
--contiguous Bool, --ignoreactivationskip, --ignoremonitoring, --major Number,
--metadataprofile String, --minor Number, --monitor Bool, --name String, --nosync,
--noudevsync, --permission, --persistent Bool, --readahead Number|String,
--noudevsync, --permission Permission, --persistent Bool, --readahead Readahead,
--reportformat String, --setactivationskip Bool, --test, --wipesignatures Bool,
--zero Bool
OO_LVCREATE_CACHE: --cachemode String, --cachepolicy String, --cachesettings String
OO_LVCREATE_CACHE: --cachemode CacheMode, --cachepolicy String, --cachesettings String
OO_LVCREATE_POOL: --poolmetadatasize Number, --poolmetadataspare Bool, --chunksize Number
OO_LVCREATE_POOL: --poolmetadatasize SizeMB, --poolmetadataspare Bool, --chunksize SizeKB
OO_LVCREATE_THIN: --discards String, --errorwhenfull Bool
OO_LVCREATE_THIN: --discards Discards, --errorwhenfull Bool
OO_LVCREATE_RAID: --mirrors Number, --stripes Number, --stripesize Number,
--regionsize Number, --minrecoveryrate Number, --maxrecoveryrate Number
OO_LVCREATE_RAID: --mirrors SNumber, --stripes Number, --stripesize SizeKB,
--regionsize SizeMB, --minrecoveryrate SizeKB, --maxrecoveryrate SizeKB
lvcreate --type error --size Number VG
lvcreate --type error --size SizeMB VG
OO: OO_LVCREATE
DESC: Create an LV that returns errors when used.
lvcreate --type zero --size Number VG
lvcreate --type zero --size SizeMB VG
OO: OO_LVCREATE
DESC: Create an LV that returns zeros when read.
lvcreate --type linear --size Number VG
lvcreate --type linear --size SizeMB VG
OO: OO_LVCREATE
OP: PV ...
DESC: Create a linear LV.
lvcreate --type striped --size Number VG
OO: --stripes Number, --stripesize Number, OO_LVCREATE
lvcreate --type striped --size SizeMB VG
OO: --stripes Number, --stripesize SizeKB, OO_LVCREATE
OP: PV ...
DESC: Create a striped LV.
lvcreate --type mirror --size Number VG
OO: --mirrors Number, --mirrorlog String, --corelog, --regionsize Number, OO_LVCREATE
lvcreate --type mirror --size SizeMB VG
OO: --mirrors SNumber, --mirrorlog MirrorLog, --corelog, --regionsize SizeMB, OO_LVCREATE
OP: PV ...
DESC: Create a mirror LV.
lvcreate --type raid --size Number VG
lvcreate --type raid --size SizeMB VG
OO: OO_LVCREATE_RAID, OO_LVCREATE
OP: PV ...
DESC: Create a raid LV (a specific raid level must be used, e.g. raid1).
DESC: Create a raid LV (a specific raid level must be used, for example, raid1).
lvcreate --type snapshot --size Number LV
lvcreate --type snapshot --size SizeMB LV
OO: OO_LVCREATE
OP: PV ...
DESC: Create a COW snapshot from an origin LV.
lvcreate --type snapshot --size Number --virtualsize Number VG
OO: --virtualoriginsize Number, OO_LVCREATE
lvcreate --type snapshot --size SizeMB --virtualsize SizeMB VG
OO: --virtualoriginsize SizeMB, OO_LVCREATE
OP: PV ...
DESC: Create a sparse COW snapshot LV of a virtual origin LV.
lvcreate --type thin-pool --size Number VG
lvcreate --type thin-pool --size SizeMB VG
OO: OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE
OP: PV ...
DESC: Create a thin pool.
lvcreate --type cache-pool --size Number VG
lvcreate --type cache-pool --size SizeMB VG
OO: OO_LVCREATE_POOL, OO_LVCREATE_CACHE, OO_LVCREATE
OP: PV ...
DESC: Create a cache pool.
lvcreate --type thin --virtualsize Number --thinpool LV_thinpool
lvcreate --type thin --virtualsize SizeMB --thinpool LV_thinpool
OO: OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE
DESC: Create a thin LV in a thin pool.
@@ -414,96 +419,96 @@ lvcreate --type thin --snapshot --thinpool LV_thinpool LV
OO: OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE
DESC: Create a thin LV that is a snapshot of an external origin LV named in arg pos 1.
lvcreate --type thin --virtualsize Number --size Number --thinpool LV_new
lvcreate --type thin --virtualsize SizeMB --size SizeMB --thinpool LV_new
OO: OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE
OP: PV ...
DESC: Create a thin LV, first creating a thin pool for it, where the new thin pool is named by the --thinpool arg.
lvcreate --type thin --virtualsize Number --size Number LV_new
lvcreate --type thin --virtualsize SizeMB --size SizeMB LV_new
OO: OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE
OP: PV ...
DESC: Create a thin LV, first creating a thin pool for it, where the new thin pool is named in arg pos 1.
lvcreate --type thin --virtualsize Number --size Number VG
lvcreate --type thin --virtualsize SizeMB --size SizeMB VG
OO: OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE
OP: PV ...
DESC: Create a thin LV, first creating a thin pool for it.
# FIXME: this should be done by lvconvert, and this command deprecated
lvcreate --type cache --size Number LV
lvcreate --type cache --size SizeMB LV
OO: OO_LVCREATE_POOL, OO_LVCREATE_CACHE, OO_LVCREATE
OP: PV ...
DESC: Convert the specified LV to type cache after creating a new cache pool LV to use.
lvcreate --type cache --size Number --cachepool LV_cachepool
lvcreate --type cache --size SizeMB --cachepool LV_cachepool
OO: OO_LVCREATE_POOL, OO_LVCREATE_CACHE, OO_LVCREATE
OP: PV ...
DESC: Create a cache LV, first creating a new origin LV, then combining it with the existing cache pool in arg pos 1.
lvcreate --size Number VG
lvcreate --size SizeMB VG
OO: --type linear, OO_LVCREATE
OP: PV ...
DESC: Create a linear LV. (default --type linear)
lvcreate --stripes Number --size Number VG
OO: --type striped, --stripesize Number, OO_LVCREATE
lvcreate --stripes Number --size SizeMB VG
OO: --type striped, --stripesize SizeKB, OO_LVCREATE
OP: PV ...
DESC: Create a striped LV. (infers --type striped)
DESC: Create a striped LV (infers --type striped).
lvcreate --mirrors Number --size Number VG
OO: --type raid1|mirror, --mirrorlog String, --corelog, OO_LVCREATE_RAID, OO_LVCREATE
lvcreate --mirrors SNumber --size SizeMB VG
OO: --type raid1, --type mirror, --mirrorlog MirrorLog, --corelog, OO_LVCREATE_RAID, OO_LVCREATE
OP: PV ...
DESC: Create a raid1 or mirror LV. (infers --type raid1|mirror)
DESC: Create a raid1 or mirror LV (infers --type raid1|mirror).
lvcreate --snapshot --size Number LV
lvcreate --snapshot --size SizeMB LV
OO: --type snapshot, OO_LVCREATE
OP: PV ...
DESC: Create a COW snapshot LV of the origin LV in arg pos 1. (infers --type snapshot)
lvcreate --thin --size Number VG
lvcreate --thin --size SizeMB VG
OO: --type thin-pool, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE
OP: PV ...
DESC: Create a thin pool. (infers --type thin-pool)
DESC: Create a thin pool (infers --type thin-pool).
lvcreate --cache --size Number VG
lvcreate --cache --size SizeMB VG
OO: --type cache-pool, OO_LVCREATE_POOL, OO_LVCREATE_CACHE, OO_LVCREATE
OP: PV ...
DESC: Create a cache pool. (infers --type cache-pool)
DESC: Create a cache pool (infers --type cache-pool).
lvcreate --snapshot LV_thin
OO: --type thin, OO_LVCREATE_THIN, OO_LVCREATE
DESC: Create a thin LV that is a snapshot of an existing thin LV. (infers --type thin)
DESC: Create a thin LV that is a snapshot of an existing thin LV (infers --type thin).
lvcreate --snapshot --thinpool LV_thinpool LV
OO: --type thin, OO_LVCREATE_THIN, OO_LVCREATE
DESC: Create a thin LV that is a snapshot of an external origin LV. (infers --type thin)
DESC: Create a thin LV that is a snapshot of an external origin LV (infers --type thin).
lvcreate --virtualsize Number --thinpool LV_thinpool
lvcreate --virtualsize SizeMB --thinpool LV_thinpool
OO: --type thin, OO_LVCREATE_THIN, OO_LVCREATE
DESC: Create a thin LV in a thin pool. (infers --type thin)
DESC: Create a thin LV in a thin pool (infers --type thin).
lvcreate --size Number --cachepool LV_cachepool
lvcreate --size SizeMB --cachepool LV_cachepool
OO: --type cache, OO_LVCREATE_CACHE, OO_LVCREATE
OP: PV ...
DESC: Create a new origin LV, combining it with an existing cache pool to create a new cache LV. (infers --type cache)
DESC: Create a new origin LV, combining it with an existing cache pool to create a new cache LV (infers --type cache).
lvcreate --thin --virtualsize Number --size Number --thinpool LV_new
lvcreate --thin --virtualsize SizeMB --size SizeMB --thinpool LV_new
OO: --type thin, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE
OP: PV ...
DESC: Create a thin LV, first creating a thin pool for it, where the new thin pool is named by the --thinpool arg. (infers --type thin)
DESC: Create a thin LV, first creating a thin pool for it, where the new thin pool is named by the --thinpool arg (infers --type thin).
lvcreate --thin --virtualsize Number --size Number LV_new
lvcreate --thin --virtualsize SizeMB --size SizeMB LV_new
OO: --type thin, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE
OP: PV ...
DESC: Create a thin LV, first creating a thin pool for it, where the new thin pool is named in arg pos 1. (infers --type thin)
DESC: Create a thin LV, first creating a thin pool for it, where the new thin pool is named in arg pos 1 (infers --type thin).
lvcreate --size Number --virtualsize Number VG
lvcreate --size SizeMB --virtualsize SizeMB VG
OO: --type thin, --type snapshot, --thin, --snapshot,
--virtualoriginsize Number, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE
--virtualoriginsize SizeMB, OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE
OP: PV ...
DESC: Create a thin LV, first creating a thin pool for it. (infers --type thin)
DESC: Create a sparse snapshot of a virtual origin LV. (infers --type snapshot)
DESC: (infers --type thin or --type snapshot according to sparse_segtype_default)
DESC: Create a thin LV, first creating a thin pool for it (infers --type thin).
DESC: Create a sparse snapshot of a virtual origin LV (infers --type snapshot).
DESC: Infers --type thin or --type snapshot according to sparse_segtype_default.
lvdisplay
OO: --aligned, --all, --binary, --colon, --columns,
@@ -511,31 +516,31 @@ OO: --aligned, --all, --binary, --colon, --columns,
--ignoreskippedcluster, --logonly, --maps, --noheadings,
--nosuffix, --options String, --sort String, --partial, --readonly,
--reportformat String, --segments, --select String, --separator String,
--shared, --unbuffered, --units String
--shared, --unbuffered, --units Units
OP: VG|LV|Tag ...
# --extents or --size are interchangable
lvextend --size Number LV
OO: --alloc String, --autobackup Bool, --force, --mirrors Number,
lvextend --size SizeMB LV
OO: --alloc Alloc, --autobackup Bool, --force, --mirrors SNumber,
--nofsck, --nosync, --noudevsync, --reportformat String, --resizefs,
--stripes Number, --stripesize Number, --test, --poolmetadatasize Number
--stripes Number, --stripesize SizeKB, --test, --poolmetadatasize SizeMB
OP: PV ...
lvextend LV PV ...
OO: --alloc String, --autobackup Bool, --force, --mirrors Number,
OO: --alloc Alloc, --autobackup Bool, --force, --mirrors SNumber,
--nofsck, --nosync, --noudevsync,
--reportformat String, --resizefs, --stripes Number, --stripesize Number,
--reportformat String, --resizefs, --stripes Number, --stripesize SizeKB,
--test
lvextend --poolmetadatasize Number LV_thinpool
OO: --alloc String, --autobackup Bool, --force, --mirrors Number,
lvextend --poolmetadatasize SizeMB LV_thinpool
OO: --alloc Alloc, --autobackup Bool, --force, --mirrors SNumber,
--nofsck, --nosync, --noudevsync,
--reportformat String, --stripes Number, --stripesize Number,
--reportformat String, --stripes Number, --stripesize SizeKB,
--test
OP: PV ...
lvextend --usepolicies LV_thinpool|LV_snapshot
OO: --alloc String, --autobackup Bool, --force, --mirrors Number,
OO: --alloc Alloc, --autobackup Bool, --force, --mirrors SNumber,
--nofsck, --nosync, --noudevsync,
--reportformat String, --resizefs,
--test
@@ -554,7 +559,7 @@ lvmsar
OO: --full, --stdin
# --extents or --size are interchangable
lvreduce --size Number LV
lvreduce --size SizeMB LV
OO: --autobackup Bool, --force, --nofsck, --noudevsync,
--reportformat String, --resizefs, --test
@@ -569,22 +574,22 @@ lvrename LV LV_new
OO: --autobackup Bool, --noudevsync, --reportformat String, --test
# --extents or --size are interchangable
lvresize --size Number LV
OO: --alloc String, --autobackup Bool, --force,
lvresize --size SizeMB LV
OO: --alloc Alloc, --autobackup Bool, --force,
--nofsck, --nosync, --noudevsync, --reportformat String, --resizefs,
--stripes Number, --stripesize Number, --test, --poolmetadatasize Number
--stripes Number, --stripesize SizeKB, --test, --poolmetadatasize SizeMB
OP: PV ...
lvresize LV PV ...
OO: --alloc String, --autobackup Bool, --force,
OO: --alloc Alloc, --autobackup Bool, --force,
--nofsck, --nosync, --noudevsync,
--reportformat String, --resizefs, --stripes Number, --stripesize Number,
--reportformat String, --resizefs, --stripes Number, --stripesize SizeKB,
--test
lvresize --poolmetadatasize Number LV_thinpool
OO: --alloc String, --autobackup Bool, --force,
lvresize --poolmetadatasize SizeMB LV_thinpool
OO: --alloc Alloc, --autobackup Bool, --force,
--nofsck, --nosync, --noudevsync,
--reportformat String, --stripes Number, --stripesize Number,
--reportformat String, --stripes Number, --stripesize SizeKB,
--test
OP: PV ...
@@ -616,7 +621,7 @@ pvchange OO_PVCHANGE_META PV|Select ...
OO: --select String, OO_PVCHANGE
pvresize PV ...
OO: --setphysicalvolumesize Number, --reportformat String, --test
OO: --setphysicalvolumesize SizeMB, --reportformat String, --test
pvck PV ...
OO: --labelsector Number
@@ -626,10 +631,10 @@ OO: --labelsector Number
# which is actually --uuid string on the command line.
#
pvcreate PV ...
OO: --dataalignment Number, --dataalignmentoffset Number, --bootloaderareasize Number,
--force, --test, --labelsector Number, --metadatatype String,
--pvmetadatacopies Number, --metadatasize Number, --metadataignore Bool,
--norestorefile, --setphysicalvolumesize Number,
OO: --dataalignment SizeKB, --dataalignmentoffset SizeKB, --bootloaderareasize SizeMB,
--force, --test, --labelsector Number, --metadatatype MetadataType,
--pvmetadatacopies Number, --metadatasize SizeMB, --metadataignore Bool,
--norestorefile, --setphysicalvolumesize SizeMB,
--reportformat String, --restorefile String, --uuidstr String, --zero Bool
pvdata
@@ -639,11 +644,11 @@ OO: --aligned, --all, --binary, --colon, --columns, --configreport String,
--foreign, --ignorelockingfailure, --ignoreskippedcluster,
--logonly, --maps, --noheadings, --nosuffix, --options String,
--readonly, --reportformat String, --select String, --separator String, --shared,
--short, --sort String, --unbuffered, --units String
--short, --sort String, --unbuffered, --units Units
OP: PV|Tag ...
pvmove PV
OO: --abort, --alloc String, --atomic, --autobackup Bool, --background,
OO: --abort, --alloc Alloc, --atomic, --autobackup Bool, --background,
--interval Number, --name LV, --noudevsync, --reportformat String, --test
OP: PV ...
@@ -666,7 +671,7 @@ OO: --ignorelockingfailure, --reportformat String, --exported, --novolumegroup,
pvscan --cache_long
OO: --ignorelockingfailure, --reportformat String, --background,
--activate String, --major Number, --minor Number,
--activate Active, --major Number, --minor Number,
OP: PV|String ...
segtypes
@@ -680,7 +685,7 @@ OO: --file String, --foreign, --ignorelockingfailure, --partial, --readonly,
--reportformat String
vgcfgrestore VG
OO: --file String, --force_long, --list, --metadatatype String, --test
OO: --file String, --force_long, --list, --metadatatype MetadataType, --test
vgcfgrestore --list --file String
@@ -696,9 +701,9 @@ OO_VGCHANGE: --autobackup Bool, --ignoremonitoring, --ignoreskippedcluster,
# because it can function as a required opt.
#
OO_VGCHANGE_META: --addtag Tag, --deltag Tag,
--logicalvolume Number, --maxphysicalvolumes Number, --alloc String, --uuid,
--clustered Bool, --metadatacopies Number, --vgmetadatacopies Number|String,
--physicalextentsize Number, --resizeable Bool, --systemid String, --locktype String,
--logicalvolume Number, --maxphysicalvolumes Number, --alloc Alloc, --uuid,
--clustered Bool, --metadatacopies MetadataCopies, --vgmetadatacopies MetadataCopies,
--physicalextentsize SizeMB, --resizeable Bool, --systemid String, --locktype LockType,
--profile String, --detachprofile, --metadataprofile String,
vgchange OO_VGCHANGE_META
@@ -713,8 +718,8 @@ vgchange --poll Bool
OO: --ignorelockingfailure, OO_VGCHANGE_META, OO_VGCHANGE
OP: VG|Tag ...
vgchange --activate String
OO: --activationmode String, --ignoreactivationskip, --partial, --sysinit,
vgchange --activate Active
OO: --activationmode ActivationMode, --ignoreactivationskip, --partial, --sysinit,
--ignorelockingfailure, --monitor Bool, --poll Bool, OO_VGCHANGE_META, OO_VGCHANGE
OP: VG|Tag ...
@@ -735,24 +740,24 @@ OO: --reportformat String
OP: VG|Tag ...
vgconvert VG ...
OO: --force, --test, --labelsector Number, --bootloaderareasize Number,
--metadatatype String, --pvmetadatacopies Number,
--metadatasize Number, --reportformat String
OO: --force, --test, --labelsector Number, --bootloaderareasize SizeMB,
--metadatatype MetadataType, --pvmetadatacopies Number,
--metadatasize SizeMB, --reportformat String
vgcreate VG_new PV ...
OO: --addtag Tag, --alloc String, --autobackup Bool, --clustered Bool, --maxlogicalvolumes Number,
--maxphysicalvolumes Number, --metadataprofile String, --metadatatype String,
--physicalextentsize Number, --test, --force, --zero Bool, --labelsector Number,
--metadatasize Number, --pvmetadatacopies Number, --reportformat String, --metadatacopies Number,
--vgmetadatacopies Number|String, --dataalignment Number, --dataalignmentoffset Number,
--shared, --systemid String, --locktype String, --lockopt String
OO: --addtag Tag, --alloc Alloc, --autobackup Bool, --clustered Bool, --maxlogicalvolumes Number,
--maxphysicalvolumes Number, --metadataprofile String, --metadatatype MetadataType,
--physicalextentsize SizeMB, --test, --force, --zero Bool, --labelsector Number,
--metadatasize SizeMB, --pvmetadatacopies Number, --reportformat String, --metadatacopies MetadataCopies,
--vgmetadatacopies MetadataCopies, --dataalignment SizeKB, --dataalignmentoffset SizeKB,
--shared, --systemid String, --locktype LockType, --lockopt String
vgdisplay
OO: --activevolumegroups, --aligned, --binary, --colon, --columns,
--configreport String, --foreign, --ignorelockingfailure,
--ignoreskippedcluster, --logonly, --noheadings, --nosuffix,
--options String, --partial, --readonly, --reportformat String, --select String,
--shared, --short, --separator String, --sort String, --unbuffered, --units String
--shared, --short, --separator String, --sort String, --unbuffered, --units Units
OP: VG|Tag ...
OO_VGEXPORT: --reportformat String, --test
@@ -765,9 +770,9 @@ OO: OO_VGEXPORT
vgextend VG PV ...
OO: --autobackup Bool, --test,
--force, --zero Bool, --labelsector Number, --metadatatype String,
--metadatasize Number, --pvmetadatacopies Number,
--metadataignore Bool, --dataalignment Number, --dataalignmentoffset Number,
--force, --zero Bool, --labelsector Number, --metadatatype MetadataType,
--metadatasize SizeMB, --pvmetadatacopies Number,
--metadataignore Bool, --dataalignment SizeKB, --dataalignmentoffset SizeKB,
--reportformat String, --restoremissing
OO_VGIMPORT: --force, --reportformat String, --test
@@ -818,9 +823,9 @@ OO: --cache_long, --ignorelockingfailure, --mknodes, --notifydbus,
OO_VGSPLIT: --autobackup Bool, --test
OO_VGSPLIT_NEW: --alloc String, --clustered Bool,
OO_VGSPLIT_NEW: --alloc Alloc, --clustered Bool,
--maxlogicalvolumes Number, --maxphysicalvolumes Number,
--metadatatype String, --vgmetadatacopies Number|String
--metadatatype MetadataType, --vgmetadatacopies MetadataCopies
vgsplit VG VG PV ...
OO: OO_VGSPLIT

File diff suppressed because it is too large Load Diff

View File

@@ -17,215 +17,214 @@
* Put all long args that don't have a corresponding short option first.
*/
/* *INDENT-OFF* */
arg(abort_ARG, '\0', "abort", NULL, 0, 0)
arg(activationmode_ARG, '\0', "activationmode", string_arg, 0, 0)
arg(addtag_ARG, '\0', "addtag", tag_arg, ARG_GROUPABLE, 0)
arg(aligned_ARG, '\0', "aligned", NULL, 0, 0)
arg(alloc_ARG, '\0', "alloc", alloc_arg, 0, 0)
arg(atomic_ARG, '\0', "atomic", NULL, 0, 0)
arg(atversion_ARG, '\0', "atversion", string_arg, 0, 0)
arg(binary_ARG, '\0', "binary", NULL, 0, 0)
arg(bootloaderareasize_ARG, '\0', "bootloaderareasize", size_mb_arg, 0, 0)
arg(cache_long_ARG, '\0', "cache", NULL, 0, 0)
arg(cachemode_ARG, '\0', "cachemode", cachemode_arg, 0, 0)
arg(cachepool_ARG, '\0', "cachepool", string_arg, 0, 0)
arg(commandprofile_ARG, '\0', "commandprofile", string_arg, 0, 0)
arg(config_ARG, '\0', "config", string_arg, 0, 0)
arg(configreport_ARG, '\0', "configreport", string_arg, ARG_GROUPABLE, 1)
arg(configtype_ARG, '\0', "typeconfig", string_arg, 0, 0)
arg(corelog_ARG, '\0', "corelog", NULL, 0, 0)
arg(dataalignment_ARG, '\0', "dataalignment", size_kb_arg, 0, 0)
arg(dataalignmentoffset_ARG, '\0', "dataalignmentoffset", size_kb_arg, 0, 0)
arg(deltag_ARG, '\0', "deltag", tag_arg, ARG_GROUPABLE, 0)
arg(detachprofile_ARG, '\0', "detachprofile", NULL, 0, 0)
arg(discards_ARG, '\0', "discards", discards_arg, 0, 0)
arg(driverloaded_ARG, '\0', "driverloaded", yes_no_arg, 0, 0)
arg(errorwhenfull_ARG, '\0', "errorwhenfull", yes_no_arg, 0, 0)
arg(force_long_ARG, '\0', "force", NULL, ARG_COUNTABLE, 0)
arg(foreign_ARG, '\0', "foreign", NULL, 0, 0)
arg(handlemissingpvs_ARG, '\0', "handlemissingpvs", NULL, 0, 0)
arg(ignoreadvanced_ARG, '\0', "ignoreadvanced", NULL, 0, 0)
arg(ignorelocal_ARG, '\0', "ignorelocal", NULL, 0, 0)
arg(ignorelockingfailure_ARG, '\0', "ignorelockingfailure", NULL, 0, 0)
arg(ignoremonitoring_ARG, '\0', "ignoremonitoring", NULL, 0, 0)
arg(ignoreskippedcluster_ARG, '\0', "ignoreskippedcluster", NULL, 0, 0)
arg(ignoreunsupported_ARG, '\0', "ignoreunsupported", NULL, 0, 0)
arg(labelsector_ARG, '\0', "labelsector", int_arg, 0, 0)
arg(lockopt_ARG, '\0', "lockopt", string_arg, 0, 0)
arg(lockstart_ARG, '\0', "lockstart", NULL, 0, 0)
arg(lockstop_ARG, '\0', "lockstop", NULL, 0, 0)
arg(locktype_ARG, '\0', "locktype", locktype_arg, 0, 0)
arg(logonly_ARG, '\0', "logonly", NULL, 0, 0)
arg(maxrecoveryrate_ARG, '\0', "maxrecoveryrate", size_kb_arg, 0, 0)
arg(merge_ARG, '\0', "merge", NULL, 0, 0)
arg(mergedconfig_ARG, '\0', "mergedconfig", NULL, 0, 0)
arg(metadatacopies_ARG, '\0', "metadatacopies", metadatacopies_arg, 0, 0)
arg(metadataignore_ARG, '\0', "metadataignore", yes_no_arg, 0, 0)
arg(metadataprofile_ARG, '\0', "metadataprofile", string_arg, 0, 0)
arg(metadatasize_ARG, '\0', "metadatasize", size_mb_arg, 0, 0)
arg(minor_ARG, '\0', "minor", int_arg, ARG_GROUPABLE, 0)
arg(minrecoveryrate_ARG, '\0', "minrecoveryrate", size_kb_arg, 0, 0)
arg(mirrorlog_ARG, '\0', "mirrorlog", mirrorlog_arg, 0, 0)
arg(mirrorsonly_ARG, '\0', "mirrorsonly", NULL, 0, 0)
arg(mknodes_ARG, '\0', "mknodes", NULL, 0, 0)
arg(monitor_ARG, '\0', "monitor", yes_no_arg, 0, 0)
arg(nameprefixes_ARG, '\0', "nameprefixes", NULL, 0, 0)
arg(noheadings_ARG, '\0', "noheadings", NULL, 0, 0)
arg(nohistory_ARG, '\0', "nohistory", NULL, 0, 0)
arg(nolocking_ARG, '\0', "nolocking", NULL, 0, 0)
arg(norestorefile_ARG, '\0', "norestorefile", NULL, 0, 0)
arg(nosuffix_ARG, '\0', "nosuffix", NULL, 0, 0)
arg(nosync_ARG, '\0', "nosync", NULL, 0, 0)
arg(notifydbus_ARG, '\0', "notifydbus", NULL, 0, 0)
arg(noudevsync_ARG, '\0', "noudevsync", NULL, 0, 0)
arg(originname_ARG, '\0', "originname", string_arg, 0, 0)
arg(physicalvolumesize_ARG, '\0', "setphysicalvolumesize", size_mb_arg, 0, 0)
arg(poll_ARG, '\0', "poll", yes_no_arg, 0, 0)
arg(polloperation_ARG, '\0', "polloperation", string_arg, 0, 0)
arg(pooldatasize_ARG, '\0', "pooldatasize", size_mb_arg, 0, 0)
arg(poolmetadata_ARG, '\0', "poolmetadata", string_arg, 0, 0)
arg(poolmetadatasize_ARG, '\0', "poolmetadatasize", size_mb_arg, 0, 0)
arg(poolmetadataspare_ARG, '\0', "poolmetadataspare", yes_no_arg, 0, 0)
arg(profile_ARG, '\0', "profile", string_arg, 0, 0)
arg(pvmetadatacopies_ARG, '\0', "pvmetadatacopies", int_arg, 0, 0)
arg(raidrebuild_ARG, '\0', "raidrebuild", string_arg, ARG_GROUPABLE, 0)
arg(raidmaxrecoveryrate_ARG, '\0', "raidmaxrecoveryrate", size_kb_arg, 0, 0)
arg(raidminrecoveryrate_ARG, '\0', "raidminrecoveryrate", size_kb_arg, 0, 0)
arg(raidsyncaction_ARG, '\0', "raidsyncaction", string_arg, 0, 0)
arg(raidwritebehind_ARG, '\0', "raidwritebehind", int_arg, 0, 0)
arg(raidwritemostly_ARG, '\0', "raidwritemostly", string_arg, ARG_GROUPABLE, 0)
arg(readonly_ARG, '\0', "readonly", NULL, 0, 0)
arg(refresh_ARG, '\0', "refresh", NULL, 0, 0)
arg(removemissing_ARG, '\0', "removemissing", NULL, 0, 0)
arg(rebuild_ARG, '\0', "rebuild", string_arg, ARG_GROUPABLE, 0)
arg(repair_ARG, '\0', "repair", NULL, 0, 0)
arg(replace_ARG, '\0', "replace", string_arg, ARG_GROUPABLE, 0)
arg(reportformat_ARG, '\0', "reportformat", string_arg, 0, 0)
arg(restorefile_ARG, '\0', "restorefile", string_arg, 0, 0)
arg(restoremissing_ARG, '\0', "restoremissing", NULL, 0, 0)
arg(resync_ARG, '\0', "resync", NULL, 0, 0)
arg(rows_ARG, '\0', "rows", NULL, 0, 0)
arg(segments_ARG, '\0', "segments", NULL, 0, 0)
arg(separator_ARG, '\0', "separator", string_arg, 0, 0)
arg(shared_ARG, '\0', "shared", NULL, 0, 0)
arg(sinceversion_ARG, '\0', "sinceversion", string_arg, 0, 0)
arg(split_ARG, '\0', "split", NULL, 0, 0)
arg(splitcache_ARG, '\0', "splitcache", NULL, 0, 0)
arg(splitmirrors_ARG, '\0', "splitmirrors", int_arg, 0, 0)
arg(splitsnapshot_ARG, '\0', "splitsnapshot", NULL, 0, 0)
arg(showdeprecated_ARG, '\0', "showdeprecated", NULL, 0, 0)
arg(showunsupported_ARG, '\0', "showunsupported", NULL, 0, 0)
arg(stripes_long_ARG, '\0', "stripes", int_arg, 0, 0)
arg(syncaction_ARG, '\0', "syncaction", string_arg, 0, 0) /* FIXME Use custom validation fn */
arg(sysinit_ARG, '\0', "sysinit", NULL, 0, 0)
arg(systemid_ARG, '\0', "systemid", string_arg, 0, 0)
arg(thinpool_ARG, '\0', "thinpool", string_arg, 0, 0)
arg(trackchanges_ARG, '\0', "trackchanges", NULL, 0, 0)
arg(trustcache_ARG, '\0', "trustcache", NULL, 0, 0)
arg(type_ARG, '\0', "type", segtype_arg, 0, 0)
arg(unbuffered_ARG, '\0', "unbuffered", NULL, 0, 0)
arg(uncache_ARG, '\0', "uncache", NULL, 0, 0)
arg(cachepolicy_ARG, '\0', "cachepolicy", string_arg, 0, 0)
arg(cachesettings_ARG, '\0', "cachesettings", string_arg, ARG_GROUPABLE, 0)
arg(unconfigured_ARG, '\0', "unconfigured", NULL, 0, 0)
arg(units_ARG, '\0', "units", string_arg, 0, 0)
arg(unquoted_ARG, '\0', "unquoted", NULL, 0, 0)
arg(usepolicies_ARG, '\0', "usepolicies", NULL, 0, 0)
arg(validate_ARG, '\0', "validate", NULL, 0, 0)
arg(version_ARG, '\0', "version", NULL, 0, 0)
arg(vgmetadatacopies_ARG, '\0', "vgmetadatacopies", metadatacopies_arg, 0, 0)
arg(virtualoriginsize_ARG, '\0', "virtualoriginsize", size_mb_arg, 0, 0)
arg(withsummary_ARG, '\0', "withsummary", NULL, 0, 0)
arg(withcomments_ARG, '\0', "withcomments", NULL, 0, 0)
arg(withspaces_ARG, '\0', "withspaces", NULL, 0, 0)
arg(withversions_ARG, '\0', "withversions", NULL, 0, 0)
arg(writebehind_ARG, '\0', "writebehind", int_arg, 0, 0)
arg(writemostly_ARG, '\0', "writemostly", string_arg, ARG_GROUPABLE, 0)
arg(abort_ARG, '\0', "abort", 0, 0, 0)
arg(activationmode_ARG, '\0', "activationmode", activationmode_VAL, 0, 0)
arg(addtag_ARG, '\0', "addtag", tag_VAL, ARG_GROUPABLE, 0)
arg(aligned_ARG, '\0', "aligned", 0, 0, 0)
arg(alloc_ARG, '\0', "alloc", alloc_VAL, 0, 0)
arg(atomic_ARG, '\0', "atomic", 0, 0, 0)
arg(atversion_ARG, '\0', "atversion", string_VAL, 0, 0)
arg(binary_ARG, '\0', "binary", 0, 0, 0)
arg(bootloaderareasize_ARG, '\0', "bootloaderareasize", sizemb_VAL, 0, 0)
arg(cache_long_ARG, '\0', "cache", 0, 0, 0)
arg(cachemode_ARG, '\0', "cachemode", cachemode_VAL, 0, 0)
arg(cachepool_ARG, '\0', "cachepool", lv_VAL, 0, 0)
arg(commandprofile_ARG, '\0', "commandprofile", string_VAL, 0, 0)
arg(config_ARG, '\0', "config", string_VAL, 0, 0)
arg(configreport_ARG, '\0', "configreport", string_VAL, ARG_GROUPABLE, 1)
arg(configtype_ARG, '\0', "typeconfig", string_VAL, 0, 0)
arg(corelog_ARG, '\0', "corelog", 0, 0, 0)
arg(dataalignment_ARG, '\0', "dataalignment", sizekb_VAL, 0, 0)
arg(dataalignmentoffset_ARG, '\0', "dataalignmentoffset", sizekb_VAL, 0, 0)
arg(deltag_ARG, '\0', "deltag", tag_VAL, ARG_GROUPABLE, 0)
arg(detachprofile_ARG, '\0', "detachprofile", 0, 0, 0)
arg(discards_ARG, '\0', "discards", discards_VAL, 0, 0)
arg(driverloaded_ARG, '\0', "driverloaded", bool_VAL, 0, 0)
arg(errorwhenfull_ARG, '\0', "errorwhenfull", bool_VAL, 0, 0)
arg(force_long_ARG, '\0', "force", 0, ARG_COUNTABLE, 0)
arg(foreign_ARG, '\0', "foreign", 0, 0, 0)
arg(handlemissingpvs_ARG, '\0', "handlemissingpvs", 0, 0, 0)
arg(ignoreadvanced_ARG, '\0', "ignoreadvanced", 0, 0, 0)
arg(ignorelocal_ARG, '\0', "ignorelocal", 0, 0, 0)
arg(ignorelockingfailure_ARG, '\0', "ignorelockingfailure", 0, 0, 0)
arg(ignoremonitoring_ARG, '\0', "ignoremonitoring", 0, 0, 0)
arg(ignoreskippedcluster_ARG, '\0', "ignoreskippedcluster", 0, 0, 0)
arg(ignoreunsupported_ARG, '\0', "ignoreunsupported", 0, 0, 0)
arg(labelsector_ARG, '\0', "labelsector", number_VAL, 0, 0)
arg(lockopt_ARG, '\0', "lockopt", string_VAL, 0, 0)
arg(lockstart_ARG, '\0', "lockstart", 0, 0, 0)
arg(lockstop_ARG, '\0', "lockstop", 0, 0, 0)
arg(locktype_ARG, '\0', "locktype", locktype_VAL, 0, 0)
arg(logonly_ARG, '\0', "logonly", 0, 0, 0)
arg(maxrecoveryrate_ARG, '\0', "maxrecoveryrate", sizekb_VAL, 0, 0)
arg(merge_ARG, '\0', "merge", 0, 0, 0)
arg(mergedconfig_ARG, '\0', "mergedconfig", 0, 0, 0)
arg(metadatacopies_ARG, '\0', "metadatacopies", metadatacopies_VAL, 0, 0)
arg(metadataignore_ARG, '\0', "metadataignore", bool_VAL, 0, 0)
arg(metadataprofile_ARG, '\0', "metadataprofile", string_VAL, 0, 0)
arg(metadatasize_ARG, '\0', "metadatasize", sizemb_VAL, 0, 0)
arg(minor_ARG, '\0', "minor", number_VAL, ARG_GROUPABLE, 0)
arg(minrecoveryrate_ARG, '\0', "minrecoveryrate", sizekb_VAL, 0, 0)
arg(mirrorlog_ARG, '\0', "mirrorlog", mirrorlog_VAL, 0, 0)
arg(mirrorsonly_ARG, '\0', "mirrorsonly", 0, 0, 0)
arg(mknodes_ARG, '\0', "mknodes", 0, 0, 0)
arg(monitor_ARG, '\0', "monitor", bool_VAL, 0, 0)
arg(nameprefixes_ARG, '\0', "nameprefixes", 0, 0, 0)
arg(noheadings_ARG, '\0', "noheadings", 0, 0, 0)
arg(nohistory_ARG, '\0', "nohistory", 0, 0, 0)
arg(nolocking_ARG, '\0', "nolocking", 0, 0, 0)
arg(norestorefile_ARG, '\0', "norestorefile", 0, 0, 0)
arg(nosuffix_ARG, '\0', "nosuffix", 0, 0, 0)
arg(nosync_ARG, '\0', "nosync", 0, 0, 0)
arg(notifydbus_ARG, '\0', "notifydbus", 0, 0, 0)
arg(noudevsync_ARG, '\0', "noudevsync", 0, 0, 0)
arg(originname_ARG, '\0', "originname", lv_VAL, 0, 0)
arg(physicalvolumesize_ARG, '\0', "setphysicalvolumesize", sizemb_VAL, 0, 0)
arg(poll_ARG, '\0', "poll", bool_VAL, 0, 0)
arg(polloperation_ARG, '\0', "polloperation", string_VAL, 0, 0)
arg(pooldatasize_ARG, '\0', "pooldatasize", sizemb_VAL, 0, 0)
arg(poolmetadata_ARG, '\0', "poolmetadata", lv_VAL, 0, 0)
arg(poolmetadatasize_ARG, '\0', "poolmetadatasize", sizemb_VAL, 0, 0)
arg(poolmetadataspare_ARG, '\0', "poolmetadataspare", bool_VAL, 0, 0)
arg(profile_ARG, '\0', "profile", string_VAL, 0, 0)
arg(pvmetadatacopies_ARG, '\0', "pvmetadatacopies", number_VAL, 0, 0)
arg(raidrebuild_ARG, '\0', "raidrebuild", string_VAL, ARG_GROUPABLE, 0)
arg(raidmaxrecoveryrate_ARG, '\0', "raidmaxrecoveryrate", sizekb_VAL, 0, 0)
arg(raidminrecoveryrate_ARG, '\0', "raidminrecoveryrate", sizekb_VAL, 0, 0)
arg(raidsyncaction_ARG, '\0', "raidsyncaction", string_VAL, 0, 0)
arg(raidwritebehind_ARG, '\0', "raidwritebehind", number_VAL, 0, 0)
arg(raidwritemostly_ARG, '\0', "raidwritemostly", string_VAL, ARG_GROUPABLE, 0)
arg(readonly_ARG, '\0', "readonly", 0, 0, 0)
arg(refresh_ARG, '\0', "refresh", 0, 0, 0)
arg(removemissing_ARG, '\0', "removemissing", 0, 0, 0)
arg(rebuild_ARG, '\0', "rebuild", pv_VAL, ARG_GROUPABLE, 0)
arg(repair_ARG, '\0', "repair", 0, 0, 0)
arg(replace_ARG, '\0', "replace", pv_VAL, ARG_GROUPABLE, 0)
arg(reportformat_ARG, '\0', "reportformat", string_VAL, 0, 0)
arg(restorefile_ARG, '\0', "restorefile", string_VAL, 0, 0)
arg(restoremissing_ARG, '\0', "restoremissing", 0, 0, 0)
arg(resync_ARG, '\0', "resync", 0, 0, 0)
arg(rows_ARG, '\0', "rows", 0, 0, 0)
arg(segments_ARG, '\0', "segments", 0, 0, 0)
arg(separator_ARG, '\0', "separator", string_VAL, 0, 0)
arg(shared_ARG, '\0', "shared", 0, 0, 0)
arg(sinceversion_ARG, '\0', "sinceversion", string_VAL, 0, 0)
arg(split_ARG, '\0', "split", 0, 0, 0)
arg(splitcache_ARG, '\0', "splitcache", 0, 0, 0)
arg(splitmirrors_ARG, '\0', "splitmirrors", number_VAL, 0, 0)
arg(splitsnapshot_ARG, '\0', "splitsnapshot", 0, 0, 0)
arg(showdeprecated_ARG, '\0', "showdeprecated", 0, 0, 0)
arg(showunsupported_ARG, '\0', "showunsupported", 0, 0, 0)
arg(stripes_long_ARG, '\0', "stripes", number_VAL, 0, 0)
arg(syncaction_ARG, '\0', "syncaction", string_VAL, 0, 0) /* FIXME Use custom VAL */
arg(sysinit_ARG, '\0', "sysinit", 0, 0, 0)
arg(systemid_ARG, '\0', "systemid", string_VAL, 0, 0)
arg(thinpool_ARG, '\0', "thinpool", lv_VAL, 0, 0)
arg(trackchanges_ARG, '\0', "trackchanges", 0, 0, 0)
arg(trustcache_ARG, '\0', "trustcache", 0, 0, 0)
arg(type_ARG, '\0', "type", segtype_VAL, 0, 0)
arg(unbuffered_ARG, '\0', "unbuffered", 0, 0, 0)
arg(uncache_ARG, '\0', "uncache", 0, 0, 0)
arg(cachepolicy_ARG, '\0', "cachepolicy", string_VAL, 0, 0)
arg(cachesettings_ARG, '\0', "cachesettings", string_VAL, ARG_GROUPABLE, 0)
arg(unconfigured_ARG, '\0', "unconfigured", 0, 0, 0)
arg(units_ARG, '\0', "units", units_VAL, 0, 0)
arg(unquoted_ARG, '\0', "unquoted", 0, 0, 0)
arg(usepolicies_ARG, '\0', "usepolicies", 0, 0, 0)
arg(validate_ARG, '\0', "validate", 0, 0, 0)
arg(version_ARG, '\0', "version", 0, 0, 0)
arg(vgmetadatacopies_ARG, '\0', "vgmetadatacopies", metadatacopies_VAL, 0, 0)
arg(virtualoriginsize_ARG, '\0', "virtualoriginsize", sizemb_VAL, 0, 0)
arg(withsummary_ARG, '\0', "withsummary", 0, 0, 0)
arg(withcomments_ARG, '\0', "withcomments", 0, 0, 0)
arg(withspaces_ARG, '\0', "withspaces", 0, 0, 0)
arg(withversions_ARG, '\0', "withversions", 0, 0, 0)
arg(writebehind_ARG, '\0', "writebehind", number_VAL, 0, 0)
arg(writemostly_ARG, '\0', "writemostly", string_VAL, ARG_GROUPABLE, 0)
/* Allow some variations */
arg(allocation_ARG, '\0', "allocation", yes_no_arg, 0, 0)
arg(available_ARG, '\0', "available", activation_arg, 0, 0)
arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0, 0)
arg(allocation_ARG, '\0', "allocation", bool_VAL, 0, 0)
arg(available_ARG, '\0', "available", activation_VAL, 0, 0)
arg(resizable_ARG, '\0', "resizable", bool_VAL, 0, 0)
/*
* ... and now the short args.
*/
arg(activate_ARG, 'a', "activate", activation_arg, 0, 0)
arg(all_ARG, 'a', "all", NULL, 0, 0)
arg(autobackup_ARG, 'A', "autobackup", yes_no_arg, 0, 0)
arg(activevolumegroups_ARG, 'A', "activevolumegroups", NULL, 0, 0)
arg(background_ARG, 'b', "background", NULL, 0, 0)
arg(backgroundfork_ARG, 'b', "background", NULL, 0, 0)
arg(basevgname_ARG, 'n', "basevgname", string_arg, 0, 0)
arg(blockdevice_ARG, 'b', "blockdevice", NULL, 0, 0)
arg(chunksize_ARG, 'c', "chunksize", size_kb_arg, 0, 0)
arg(clustered_ARG, 'c', "clustered", yes_no_arg, 0, 0)
arg(colon_ARG, 'c', "colon", NULL, 0, 0)
arg(columns_ARG, 'C', "columns", NULL, 0, 0)
arg(contiguous_ARG, 'C', "contiguous", yes_no_arg, 0, 0)
arg(debug_ARG, 'd', "debug", NULL, ARG_COUNTABLE, 0)
arg(exported_ARG, 'e', "exported", NULL, 0, 0)
arg(physicalextent_ARG, 'E', "physicalextent", NULL, 0, 0)
arg(file_ARG, 'f', "file", string_arg, 0, 0)
arg(force_ARG, 'f', "force", NULL, ARG_COUNTABLE, 0)
arg(full_ARG, 'f', "full", NULL, 0, 0)
arg(help_ARG, 'h', "help", NULL, ARG_COUNTABLE, 0)
arg(cache_ARG, 'H', "cache", NULL, 0, 0)
arg(history_ARG, 'H', "history", NULL, 0, 0)
arg(help2_ARG, '?', "", NULL, 0, 0)
arg(import_ARG, 'i', "import", NULL, 0, 0)
arg(interval_ARG, 'i', "interval", int_arg, 0, 0)
arg(iop_version_ARG, 'i', "iop_version", NULL, 0, 0)
arg(stripes_ARG, 'i', "stripes", int_arg, 0, 0)
arg(stripesize_ARG, 'I', "stripesize", size_kb_arg, 0, 0)
arg(logicalvolume_ARG, 'l', "logicalvolume", int_arg, 0, 0)
arg(maxlogicalvolumes_ARG, 'l', "maxlogicalvolumes", int_arg, 0, 0)
arg(extents_ARG, 'l', "extents", int_arg_with_sign_and_percent, 0, 0)
arg(list_ARG, 'l', "list", NULL, 0, 0)
arg(lvmpartition_ARG, 'l', "lvmpartition", NULL, 0, 0)
arg(logicalextent_ARG, 'L', "logicalextent", int_arg_with_sign, 0, 0)
arg(size_ARG, 'L', "size", size_mb_arg, 0, 0)
arg(persistent_ARG, 'M', "persistent", yes_no_arg, 0, 0)
arg(major_ARG, 'j', "major", int_arg, ARG_GROUPABLE, 0)
arg(setactivationskip_ARG, 'k', "setactivationskip", yes_no_arg, 0, 0)
arg(ignoreactivationskip_ARG, 'K', "ignoreactivationskip", NULL, 0, 0)
arg(maps_ARG, 'm', "maps", NULL, 0, 0)
arg(mirrors_ARG, 'm', "mirrors", int_arg_with_sign, 0, 0)
arg(metadatatype_ARG, 'M', "metadatatype", metadatatype_arg, 0, 0)
arg(name_ARG, 'n', "name", string_arg, 0, 0)
arg(nofsck_ARG, 'n', "nofsck", NULL, 0, 0)
arg(novolumegroup_ARG, 'n', "novolumegroup", NULL, 0, 0)
arg(oldpath_ARG, 'n', "oldpath", NULL, 0, 0)
arg(options_ARG, 'o', "options", string_arg, ARG_GROUPABLE, 0)
arg(sort_ARG, 'O', "sort", string_arg, ARG_GROUPABLE, 0)
arg(maxphysicalvolumes_ARG, 'p', "maxphysicalvolumes", int_arg, 0, 0)
arg(permission_ARG, 'p', "permission", permission_arg, 0, 0)
arg(partial_ARG, 'P', "partial", NULL, 0, 0)
arg(physicalvolume_ARG, 'P', "physicalvolume", NULL, 0, 0)
arg(quiet_ARG, 'q', "quiet", NULL, ARG_COUNTABLE, 0)
arg(readahead_ARG, 'r', "readahead", readahead_arg, 0, 0)
arg(resizefs_ARG, 'r', "resizefs", NULL, 0, 0)
arg(reset_ARG, 'R', "reset", NULL, 0, 0)
arg(regionsize_ARG, 'R', "regionsize", size_mb_arg, 0, 0)
arg(physicalextentsize_ARG, 's', "physicalextentsize", size_mb_arg, 0, 0)
arg(snapshot_ARG, 's', "snapshot", NULL, 0, 0)
arg(short_ARG, 's', "short", NULL, 0, 0)
arg(stdin_ARG, 's', "stdin", NULL, 0, 0)
arg(select_ARG, 'S', "select", string_arg, ARG_GROUPABLE, 0)
arg(test_ARG, 't', "test", NULL, 0, 0)
arg(thin_ARG, 'T', "thin", NULL, 0, 0)
arg(uuid_ARG, 'u', "uuid", NULL, 0, 0)
arg(uuidstr_ARG, 'u', "uuid", string_arg, 0, 0)
arg(uuidlist_ARG, 'U', "uuidlist", NULL, 0, 0)
arg(verbose_ARG, 'v', "verbose", NULL, ARG_COUNTABLE, 0)
arg(volumegroup_ARG, 'V', "volumegroup", NULL, 0, 0)
arg(virtualsize_ARG, 'V', "virtualsize", size_mb_arg, 0, 0)
arg(wipesignatures_ARG, 'W', "wipesignatures", yes_no_arg, 0, 0)
arg(allocatable_ARG, 'x', "allocatable", yes_no_arg, 0, 0)
arg(resizeable_ARG, 'x', "resizeable", yes_no_arg, 0, 0)
arg(yes_ARG, 'y', "yes", NULL, 0, 0)
arg(zero_ARG, 'Z', "zero", yes_no_arg, 0, 0)
arg(activate_ARG, 'a', "activate", activation_VAL, 0, 0)
arg(all_ARG, 'a', "all", 0, 0, 0)
arg(autobackup_ARG, 'A', "autobackup", bool_VAL, 0, 0)
arg(activevolumegroups_ARG, 'A', "activevolumegroups", 0, 0, 0)
arg(background_ARG, 'b', "background", 0, 0, 0)
arg(backgroundfork_ARG, 'b', "background", 0, 0, 0)
arg(basevgname_ARG, 'n', "basevgname", string_VAL, 0, 0)
arg(blockdevice_ARG, 'b', "blockdevice", 0, 0, 0)
arg(chunksize_ARG, 'c', "chunksize", sizekb_VAL, 0, 0)
arg(clustered_ARG, 'c', "clustered", bool_VAL, 0, 0)
arg(colon_ARG, 'c', "colon", 0, 0, 0)
arg(columns_ARG, 'C', "columns", 0, 0, 0)
arg(contiguous_ARG, 'C', "contiguous", bool_VAL, 0, 0)
arg(debug_ARG, 'd', "debug", 0, ARG_COUNTABLE, 0)
arg(exported_ARG, 'e', "exported", 0, 0, 0)
arg(physicalextent_ARG, 'E', "physicalextent", 0, 0, 0)
arg(file_ARG, 'f', "file", string_VAL, 0, 0)
arg(force_ARG, 'f', "force", 0, ARG_COUNTABLE, 0)
arg(full_ARG, 'f', "full", 0, 0, 0)
arg(help_ARG, 'h', "help", 0, ARG_COUNTABLE, 0)
arg(cache_ARG, 'H', "cache", 0, 0, 0)
arg(history_ARG, 'H', "history", 0, 0, 0)
arg(help2_ARG, '?', "", 0, 0, 0)
arg(import_ARG, 'i', "import", 0, 0, 0)
arg(interval_ARG, 'i', "interval", number_VAL, 0, 0)
arg(iop_version_ARG, 'i', "iop_version", 0, 0, 0)
arg(stripes_ARG, 'i', "stripes", number_VAL, 0, 0)
arg(stripesize_ARG, 'I', "stripesize", sizekb_VAL, 0, 0)
arg(logicalvolume_ARG, 'l', "logicalvolume", number_VAL, 0, 0)
arg(maxlogicalvolumes_ARG, 'l', "maxlogicalvolumes", number_VAL, 0, 0)
arg(extents_ARG, 'l', "extents", numsignedper_VAL, 0, 0)
arg(list_ARG, 'l', "list", 0, 0, 0)
arg(lvmpartition_ARG, 'l', "lvmpartition", 0, 0, 0)
arg(size_ARG, 'L', "size", sizemb_VAL, 0, 0)
arg(persistent_ARG, 'M', "persistent", bool_VAL, 0, 0)
arg(major_ARG, 'j', "major", number_VAL, ARG_GROUPABLE, 0)
arg(setactivationskip_ARG, 'k', "setactivationskip", bool_VAL, 0, 0)
arg(ignoreactivationskip_ARG, 'K', "ignoreactivationskip", 0, 0, 0)
arg(maps_ARG, 'm', "maps", 0, 0, 0)
arg(mirrors_ARG, 'm', "mirrors", numsigned_VAL, 0, 0)
arg(metadatatype_ARG, 'M', "metadatatype", metadatatype_VAL, 0, 0)
arg(name_ARG, 'n', "name", string_VAL, 0, 0)
arg(nofsck_ARG, 'n', "nofsck", 0, 0, 0)
arg(novolumegroup_ARG, 'n', "novolumegroup", 0, 0, 0)
arg(oldpath_ARG, 'n', "oldpath", 0, 0, 0)
arg(options_ARG, 'o', "options", string_VAL, ARG_GROUPABLE, 0)
arg(sort_ARG, 'O', "sort", string_VAL, ARG_GROUPABLE, 0)
arg(maxphysicalvolumes_ARG, 'p', "maxphysicalvolumes", number_VAL, 0, 0)
arg(permission_ARG, 'p', "permission", permission_VAL, 0, 0)
arg(partial_ARG, 'P', "partial", 0, 0, 0)
arg(physicalvolume_ARG, 'P', "physicalvolume", 0, 0, 0)
arg(quiet_ARG, 'q', "quiet", 0, ARG_COUNTABLE, 0)
arg(readahead_ARG, 'r', "readahead", readahead_VAL, 0, 0)
arg(resizefs_ARG, 'r', "resizefs", 0, 0, 0)
arg(reset_ARG, 'R', "reset", 0, 0, 0)
arg(regionsize_ARG, 'R', "regionsize", sizemb_VAL, 0, 0)
arg(physicalextentsize_ARG, 's', "physicalextentsize", sizemb_VAL, 0, 0)
arg(snapshot_ARG, 's', "snapshot", 0, 0, 0)
arg(short_ARG, 's', "short", 0, 0, 0)
arg(stdin_ARG, 's', "stdin", 0, 0, 0)
arg(select_ARG, 'S', "select", string_VAL, ARG_GROUPABLE, 0)
arg(test_ARG, 't', "test", 0, 0, 0)
arg(thin_ARG, 'T', "thin", 0, 0, 0)
arg(uuid_ARG, 'u', "uuid", 0, 0, 0)
arg(uuidstr_ARG, 'u', "uuid", string_VAL, 0, 0)
arg(uuidlist_ARG, 'U', "uuidlist", 0, 0, 0)
arg(verbose_ARG, 'v', "verbose", 0, ARG_COUNTABLE, 0)
arg(volumegroup_ARG, 'V', "volumegroup", 0, 0, 0)
arg(virtualsize_ARG, 'V', "virtualsize", sizemb_VAL, 0, 0)
arg(wipesignatures_ARG, 'W', "wipesignatures", bool_VAL, 0, 0)
arg(allocatable_ARG, 'x', "allocatable", bool_VAL, 0, 0)
arg(resizeable_ARG, 'x', "resizeable", bool_VAL, 0, 0)
arg(yes_ARG, 'y', "yes", 0, 0, 0)
arg(zero_ARG, 'Z', "zero", bool_VAL, 0, 0)
/* this should always be last */
arg(ARG_COUNT, '-', "", NULL, 0, 0)
arg(ARG_COUNT, '-', "", 0, 0, 0)
/* *INDENT-ON* */

File diff suppressed because it is too large Load Diff

View File

@@ -32,58 +32,48 @@ typedef int (*command_fn) (struct cmd_context * cmd, int argc, char **argv);
* The first positional arg has pos_arg.pos of 1.
*/
/* Number of string constants accepted after an option. */
#define MAX_STR_SET 16
/* arg_def flags */
#define ARG_DEF_FLAG_NEW 1
#define ARG_DEF_FLAG_MAY_REPEAT 2
#define ARG_DEF_FLAG_NEW 1 << 0
#define ARG_DEF_FLAG_MAY_REPEAT 1 << 1
/* arg_def types, can be multiple */
/* arg_def lv_types */
enum {
ARG_DEF_TYPE_NONE = 0,
ARG_DEF_TYPE_BOOL = 1 << 0,
ARG_DEF_TYPE_NUM_ANY = 1 << 1,
ARG_DEF_TYPE_STR_ANY = 1 << 2,
ARG_DEF_TYPE_NUM_CONST = 1 << 3,
ARG_DEF_TYPE_STR_CONST = 1 << 4,
ARG_DEF_TYPE_STR_SET = 1 << 5,
ARG_DEF_TYPE_NAME_ANY = 1 << 6,
ARG_DEF_TYPE_NAME_PV = 1 << 7,
ARG_DEF_TYPE_NAME_VG = 1 << 8,
ARG_DEF_TYPE_NAME_LV = 1 << 9,
ARG_DEF_TYPE_TAG = 1 << 10,
ARG_DEF_TYPE_SELECT = 1 << 11,
ARG_DEF_LV_ANY = 0,
ARG_DEF_LV_LINEAR = 1 << 0,
ARG_DEF_LV_STRIPED = 1 << 1,
ARG_DEF_LV_SNAPSHOT = 1 << 2,
ARG_DEF_LV_MIRROR = 1 << 3,
ARG_DEF_LV_RAID = 1 << 4,
ARG_DEF_LV_RAID0 = 1 << 5,
ARG_DEF_LV_RAID1 = 1 << 6,
ARG_DEF_LV_RAID4 = 1 << 7,
ARG_DEF_LV_RAID5 = 1 << 8,
ARG_DEF_LV_RAID6 = 1 << 9,
ARG_DEF_LV_RAID10 = 1 << 10,
ARG_DEF_LV_THIN = 1 << 11,
ARG_DEF_LV_THINPOOL = 1 << 12,
ARG_DEF_LV_CACHE = 1 << 13,
ARG_DEF_LV_CACHEPOOL = 1 << 14,
ARG_DEF_LV_LAST = 1 << 15,
};
/* arg_def lv_types, can be multiple */
enum {
ARG_DEF_LV_ANY = 0,
ARG_DEF_LV_LINEAR = 1 << 0,
ARG_DEF_LV_STRIPED = 1 << 1,
ARG_DEF_LV_SNAPSHOT = 1 << 2,
ARG_DEF_LV_MIRROR = 1 << 3,
ARG_DEF_LV_RAID = 1 << 4,
ARG_DEF_LV_RAID0 = 1 << 5,
ARG_DEF_LV_RAID1 = 1 << 6,
ARG_DEF_LV_RAID4 = 1 << 7,
ARG_DEF_LV_RAID5 = 1 << 8,
ARG_DEF_LV_RAID6 = 1 << 9,
ARG_DEF_LV_RAID10 = 1 << 10,
ARG_DEF_LV_THIN = 1 << 11,
ARG_DEF_LV_THINPOOL = 1 << 12,
ARG_DEF_LV_CACHE = 1 << 13,
ARG_DEF_LV_CACHEPOOL = 1 << 14,
};
static inline int val_bit_is_set(uint64_t val_bits, int val_enum)
{
return (val_bits & (1 << val_enum)) ? 1 : 0;
}
static inline uint64_t val_enum_to_bit(int val_enum)
{
return 1 << val_enum;
}
/* Description a value that follows an option or exists in a position. */
struct arg_def {
uint32_t types; /* ARG_DEF_TYPE_, can be multiple */
uint32_t lv_types; /* ARG_DEF_LV_, can be multiple */
uint64_t num; /* a literal number for ARG_DEF_TYPE_NUM_CONST */
const char *str; /* a literal string for ARG_DEF_TYPE_STR_CONST */
const char *str_set[MAX_STR_SET]; /* literal strings for ARG_DEF_TYPE_STR_SET */
uint64_t val_bits; /* bits of x_VAL, can be multiple for pos_arg */
uint64_t num; /* a literal number for conststr_VAL */
const char *str; /* a literal string for constnum_VAL */
uint32_t lv_types; /* ARG_DEF_LV_, for lv_VAL, can be multiple */
uint32_t flags; /* ARG_DEF_FLAG_ */
};

View File

@@ -52,7 +52,16 @@ extern char *optarg;
#include "command-lines-count.h" /* #define COMMAND_COUNT, generated from command-lines.in */
/*
* Table of valid switches
* Table of valid --option values.
*/
static struct val_props _val_props[VAL_COUNT + 1] = {
#define val(a, b, c, d) {a, b, c, d},
#include "vals.h"
#undef val
};
/*
* Table of valid --option's
*/
static struct arg_props _arg_props[ARG_COUNT + 1] = {
#define arg(a, b, c, d, e, f) {a, b, "", "--" c, d, e, f},
@@ -735,7 +744,7 @@ static void _set_valid_args_for_command_name(int ci)
{
int all_args[ARG_COUNT] = { 0 };
int num_args = 0;
int opt_enum_val;
int opt_enum; /* foo_ARG from args.h */
int i, ro, oo;
/*
@@ -747,18 +756,18 @@ static void _set_valid_args_for_command_name(int ci)
continue;
for (ro = 0; ro < commands[i].ro_count; ro++) {
opt_enum_val = commands[i].required_opt_args[ro].opt;
all_args[opt_enum_val] = 1;
opt_enum = commands[i].required_opt_args[ro].opt;
all_args[opt_enum] = 1;
}
for (oo = 0; oo < commands[i].oo_count; oo++) {
opt_enum_val = commands[i].optional_opt_args[oo].opt;
all_args[opt_enum_val] = 1;
opt_enum = commands[i].optional_opt_args[oo].opt;
all_args[opt_enum] = 1;
}
}
for (i = 0; i < ARG_COUNT; i++) {
if (all_args[i]) {
command_names[ci].valid_args[num_args] = _cmdline.arg_props[i].enum_val;
command_names[ci].valid_args[num_args] = _cmdline.arg_props[i].arg_enum;
num_args++;
}
}
@@ -833,7 +842,7 @@ void lvm_register_commands(void)
* any one item from commands[i].required_opt_args needs to be
* set to match.
*
* required_pos_args[0].flags & ARG_DEF_TYPE_SELECT means
* required_pos_args[0].types & select_VAL means
* cmd->argv[] in that pos can be NULL if arg_is_set(select_ARG)
*/
@@ -878,7 +887,6 @@ static int _opt_equivalent_is_set(struct cmd_context *cmd, int opt)
static int _command_required_opt_matches(struct cmd_context *cmd, int ci, int ro)
{
int opt_enum = commands[ci].required_opt_args[ro].opt;
int i;
if (arg_is_set(cmd, opt_enum))
goto check_val;
@@ -895,8 +903,6 @@ static int _command_required_opt_matches(struct cmd_context *cmd, int ci, int ro
goto check_val;
}
/* TODO: for lvmconfig, recognize --type in place of --typeconfig? */
if (_opt_equivalent_is_set(cmd, opt_enum))
goto check_val;
@@ -908,7 +914,7 @@ static int _command_required_opt_matches(struct cmd_context *cmd, int ci, int ro
*/
check_val:
if (commands[ci].required_opt_args[ro].def.types == ARG_DEF_TYPE_STR_CONST) {
if (val_bit_is_set(commands[ci].required_opt_args[ro].def.val_bits, conststr_VAL)) {
if (!strcmp(commands[ci].required_opt_args[ro].def.str, arg_str_value(cmd, opt_enum, "")))
return 1;
@@ -920,23 +926,12 @@ check_val:
return 0;
}
if (commands[ci].required_opt_args[ro].def.types == ARG_DEF_TYPE_NUM_CONST) {
if (val_bit_is_set(commands[ci].required_opt_args[ro].def.val_bits, constnum_VAL)) {
if (commands[ci].required_opt_args[ro].def.num == arg_int_value(cmd, opt_enum, 0))
return 1;
return 0;
}
if (commands[ci].required_opt_args[ro].def.types == ARG_DEF_TYPE_STR_SET) {
for (i = 0; ; i++) {
if (!commands[ci].required_opt_args[ro].def.str_set[i])
break;
if (!strcmp(commands[ci].required_opt_args[ro].def.str_set[i], arg_str_value(cmd, opt_enum, "")))
return 1;
}
return 0;
}
return 1;
}
@@ -958,7 +953,7 @@ static int _command_required_pos_matches(struct cmd_context *cmd, int ci, int rp
* If Select is specified as a pos arg, then that pos arg can be
* empty if --select is used.
*/
if ((commands[ci].required_pos_args[rp].def.types & ARG_DEF_TYPE_SELECT) &&
if ((val_bit_is_set(commands[ci].required_pos_args[rp].def.val_bits, select_VAL)) &&
arg_is_set(cmd, select_ARG))
return 1;
@@ -980,10 +975,14 @@ static void _print_usage(int ci, int include_optional)
* Print the required portions of the usage string.
* The optional portions of the usage string are enclosed
* in [] and follow the required portions.
*
* The optional portion begins with [ followed by a space,
* i.e. "[ " to distinguish the option usage which may
* include [ in cases like --option Number[units].
*/
for (ui = 0; ui < strlen(usage); ui++) {
if (usage[ui] == '[') {
if ((usage[ui] == '[') && (usage[ui+1] == ' ')) {
optional_ui = ui;
break;
}
@@ -1303,8 +1302,8 @@ static int _usage(const char *name, int help_count)
* -- for an option name, lower case strings and digits for literals.
*/
log_print("Usage notes:");
log_print(". Variable parameters are: Bool, Number, String, PV, VG, LV, Tag.");
log_print(". The --extents option can be substituted for --size.");
log_print(". Variable parameters are: Number, String, PV, VG, LV, Tag.");
log_print(". The --size option can be replaced with --extents.");
log_print(". Select indicates that the positional arg can be omitted");
log_print(" if the --select option is used.");
log_print(". For required options listed in parentheses, e.g. (--A, --B),");
@@ -1352,7 +1351,7 @@ static void _add_getopt_arg(int arg_enum, char **optstrp, struct option **longop
if (a->short_arg) {
*(*optstrp)++ = a->short_arg;
if (a->fn)
if (a->val_enum)
*(*optstrp)++ = ':';
}
#ifdef HAVE_GETOPTLONG
@@ -1360,7 +1359,7 @@ static void _add_getopt_arg(int arg_enum, char **optstrp, struct option **longop
if (*(a->long_arg + 2)) {
(*longoptsp)->name = a->long_arg + 2;
(*longoptsp)->has_arg = a->fn ? 1 : 0;
(*longoptsp)->has_arg = a->val_enum ? 1 : 0;
(*longoptsp)->flag = NULL;
/*
@@ -1412,7 +1411,7 @@ static int _find_arg(const char *cmd_name, int goval)
for (i = 0; i < cname->num_args; i++) {
arg_enum = cname->valid_args[i];
/* assert arg_enum == _cmdline.arg_props[arg_enum].enum_val */
/* assert arg_enum == _cmdline.arg_props[arg_enum].arg_enum */
/* the value returned by getopt matches the ascii value of single letter option */
if (_cmdline.arg_props[arg_enum].short_arg && (goval == _cmdline.arg_props[arg_enum].short_arg))
@@ -1511,7 +1510,7 @@ static int _process_command_line(struct cmd_context *cmd, const char *cmd_name,
return 0;
}
if (a->fn) {
if (a->val_enum) {
if (!optarg) {
log_error("Option requires argument.");
return 0;
@@ -1519,7 +1518,7 @@ static int _process_command_line(struct cmd_context *cmd, const char *cmd_name,
av->value = optarg;
if (!a->fn(cmd, av)) {
if (!_val_props[a->val_enum].fn(cmd, av)) {
log_error("Invalid argument for %s: %s", a->long_arg, optarg);
return 0;
}

View File

@@ -50,7 +50,14 @@
#define CMD_LEN 256
#define MAX_ARGS 64
/* define the enums for the command line switches */
/* define the enums for the values accepted by command line --options */
enum {
#define val(a, b, c, d) a ,
#include "vals.h"
#undef val
};
/* define the enums for the command line --options */
enum {
#define arg(a, b, c, d, e, f) a ,
#include "args.h"
@@ -79,14 +86,13 @@ struct arg_values {
/* void *ptr; // Currently not used. */
};
/* a global table of possible arguments */
/* a global table of possible --option's */
struct arg_props {
int enum_val;
int arg_enum; /* foo_ARG from args.h */
const char short_arg;
char _padding[7];
const char *long_arg;
int (*fn) (struct cmd_context *cmd, struct arg_values *av);
int val_enum; /* foo_VAL from vals.h */
uint32_t flags;
uint32_t prio;
};
@@ -97,6 +103,14 @@ struct arg_value_group_list {
uint32_t prio;
};
/* a global table of possible --option values */
struct val_props {
int val_enum; /* foo_VAL from vals.h */
int (*fn) (struct cmd_context *cmd, struct arg_values *av);
const char *name;
const char *usage;
};
#define CACHE_VGMETADATA 0x00000001
#define PERMITTED_READ_ONLY 0x00000002
/* Process all VGs if none specified on the command line. */

133
tools/vals.h Normal file
View File

@@ -0,0 +1,133 @@
/*
* Define value types which describe values accepted
* by the --option's in arg.h, and can also describe
* the values accepted as positional args.
*
* Previously, accepted values were only "described"
* by identifying the parsing function to use. The
* value types expand this with enum values and names
* to identify the accepted values.
*
* Some standard val types are used by many options,
* e.g. many options (aa_ARG, bb_ARG, cc_ARG) all
* accept a number_VAL, e.g. for various sizes or counts.
*
* Other special val types are used by only one option,
* e.g. only mirrorlog_ARG accepts a mirrorlog_VAL.
* This typically means there are a few specific words
* that are recognized after the option.
*
* Some options currently take a standard val type,
* (esp string_VAL), but they could be given their
* own custom val type. The advantage of using a
* custom val type is the possibility of validating
* the value when parsing it with a custom parsing
* function, and the possibility of displaying the
* actual accepted values in the command usage.
* Without a custom val type, the code must do ad hoc
* validation of the string values, and the usage
* output for the option will only say "String"
* rather than giving the accepted string values.
* Even without a custom parsing function, there is
* reason to define a custom x_VAL enum so that a
* more descriptive usage string can be specified
* as opposed to just "String".
*
* An option that takes a user-given name would be a
* good example of when an option may take a string_VAL
* because the string is arbitrary.
*
* The val types defined here are mostly used following
* options, i.e. referenced by foo_ARG. But some are
* not, and are only used to represent positional values
* in command definitions.
*
* val(a, b, c, d)
*
* a: foo_VAL enums
* b: the function to parse and set the value
* c: the name used to reference this value in command defs
* d: what to display in usage output for this value
*
* command defintions will use --option NAME, where NAME
* is the string in field c. NAME will be translated to
* foo_VAL enum in field a, which is used in commands[]
* structs.
*
* option definitions (arg.h) will reference foo_VAL enum
* in field a.
*
* FIXME: for specialized val types, the set of accepted
* values is not defined or stored in a consistent way,
* but is just whatever the parsing function happens to look
* for, so adding a new accepted value for the val type is
* often just making the parsing function recognize a new
* word. This new word should then also be added to the
* usage string for the val type here. It would be nice
* if the accepted values could be defined in a more
* consistent way. (The set of accepted values for some
* options is not fixed, but can be dynamic, which would
* be an exception to the rule.)
*
* The usage text for an option is not always the full
* set of strings accepted for an option, but may be a
* subset. i.e. an outdated option that no longer does
* anything may not be listed, but may be recognized
* and ignored, or an option that shouldn't be used in
* general. These options are not recommended, so they
* are not shown, even though they may still be recognized
* by the parsing function. e.g. for --activate we show
* the most common "y|n|ay" without showing the lockd
* variations "ey|sy" which are not application to most.
*
* FIXME: are there some specialized or irrelevant
* options included in the usage text below that should
* be removed? Should "lvm1" be removed?
*
* "Number[units]" is a shorter form of "Number[bBsSkKmMgGtTpPeE]",
* but perhaps the full string should be shown instead? Or maybe
* a subset of the more common letters, e.g. [kKmMgG] ?
*/
val(none_VAL, NULL, "None", "") /* unused, for enum value 0 */
val(conststr_VAL, NULL, "ConstString", "") /* used only for command defs */
val(constnum_VAL, NULL, "ConstNumber", "") /* used only for command defs */
val(bool_VAL, yes_no_arg, "Bool", "y|n")
val(number_VAL, int_arg, "Number", NULL)
val(string_VAL, string_arg, "String", NULL)
val(vg_VAL, string_arg, "VG", NULL)
val(lv_VAL, string_arg, "LV", NULL)
val(pv_VAL, string_arg, "PV", NULL)
val(tag_VAL, tag_arg, "Tag", NULL)
val(select_VAL, NULL, "Select", NULL) /* used only for command defs */
val(activationmode_VAL, string_arg, "ActivationMode", "partial|degraded|complete")
val(activation_VAL, activation_arg, "Active", "y|n|ay")
val(cachemode_VAL, cachemode_arg, "CacheMode", "writethrough|writeback")
val(discards_VAL, discards_arg, "Discards", "passdown|nopassdown|ignore")
val(mirrorlog_VAL, mirrorlog_arg, "MirrorLog", "core|disk")
val(sizekb_VAL, size_kb_arg, "SizeKB", "Number[units]")
val(sizemb_VAL, size_mb_arg, "SizeMB", "Number[units]")
val(numsigned_VAL, int_arg_with_sign, "SNumber", "[+|-]Number")
val(numsignedper_VAL, int_arg_with_sign_and_percent, "SNumber%", "[+|-]Number[%{VG|PVS|FREE}]")
val(permission_VAL, permission_arg, "Permission", "rw|r")
val(metadatatype_VAL, metadatatype_arg, "MetadataType", "lvm2|lvm1")
val(units_VAL, string_arg, "Units", "hHbBsSkKmMgGtTpPeE")
val(segtype_VAL, segtype_arg, "SegType", "linear|striped|snapshot|mirror|raid*|thin|cache|thin-pool|cache-pool")
val(alloc_VAL, alloc_arg, "Alloc", "contiguous|cling|cling_by_tags|normal|anywhere|inherit")
val(locktype_VAL, locktype_arg, "LockType", "sanlock|dlm|none")
val(readahead_VAL, readahead_arg, "Readahead", "auto|none|NumberSectors")
val(metadatacopies_VAL, metadatacopies_arg, "MetadataCopies", "all|unmanaged|Number")
/* this should always be last */
val(VAL_COUNT, NULL, NULL, NULL)
/*
* I suspect many of the following are good candidates for a custom VAL enum
* for the benefit of custom parsing, or custom usage, or both:
*
* configreport_ARG, configtype_ARG, polloperation_ARG, raidrebuild_ARG,
* raidsyncaction_ARG, raidwritemostly_ARG, reportformat_ARG, syncaction_ARG,
* cachepolicy_ARG, cachesettings_ARG, writemostly_ARG
*/