mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
commands: new method for defining commands
This commit is contained in:
parent
8c71fc1cc2
commit
e29f574e31
@ -90,7 +90,7 @@ struct cmd_context {
|
|||||||
const char *cmd_line;
|
const char *cmd_line;
|
||||||
struct command *command;
|
struct command *command;
|
||||||
char **argv;
|
char **argv;
|
||||||
struct arg_values *arg_values;
|
struct arg_values *opt_arg_values;
|
||||||
struct dm_list arg_value_groups;
|
struct dm_list arg_value_groups;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
844
scripts/command-lines.in
Normal file
844
scripts/command-lines.in
Normal file
@ -0,0 +1,844 @@
|
|||||||
|
#
|
||||||
|
# When this file is changed, tools/command-lines.h
|
||||||
|
# and tools/command-lines-count.h must be regenerated
|
||||||
|
# with:
|
||||||
|
#
|
||||||
|
# scripts/create-commands --output count scripts/command-lines.in > tools/command-lines-count.h
|
||||||
|
# scripts/create-commands --output struct scripts/command-lines.in > tools/command-lines.h
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# Syntax
|
||||||
|
#
|
||||||
|
# A new command has a unique combination of:
|
||||||
|
# command name, required option args and required
|
||||||
|
# positional args.
|
||||||
|
#
|
||||||
|
# To define a new command, begin a single line with a
|
||||||
|
# command name, followed by required options/args,
|
||||||
|
# (e.g. --foo, or --foo val), followed by required
|
||||||
|
# positional args, (e.g. VG)
|
||||||
|
#
|
||||||
|
# After the single line of required elements are lines
|
||||||
|
# of optional elements:
|
||||||
|
# . optional options/args are on new line that begins OO:
|
||||||
|
# . optional positional args are on a new line that begins OP:
|
||||||
|
#
|
||||||
|
# command_name required_opt_arg ... required_pos_arg ...
|
||||||
|
# OO: optional_opt_arg, ...
|
||||||
|
# OP: optional_pos_arg ...
|
||||||
|
#
|
||||||
|
# required_opt_arg/optional_opt_arg must begin with the
|
||||||
|
# long form option name, e.g. --foo. If the option name
|
||||||
|
# takes a value, then the type of value is specified,
|
||||||
|
# e.g. --foo String.
|
||||||
|
#
|
||||||
|
# Possible option names are listed in args.h
|
||||||
|
#
|
||||||
|
# Use --foo_long to specify that only the long form of
|
||||||
|
# --foo is accepted by the command. (This is uncommon.)
|
||||||
|
#
|
||||||
|
# Possible option arg types that can follow --opt are:
|
||||||
|
# Bool, Number, String, PV, VG, LV, Tag.
|
||||||
|
#
|
||||||
|
# Option args outside the list of types are treated as literal
|
||||||
|
# (non-variable) strings or numbers.
|
||||||
|
#
|
||||||
|
# required_pos_arg/optional_pos_arg can be one of the following:
|
||||||
|
# PV, VG, LV, Tag, Select.
|
||||||
|
#
|
||||||
|
# required_pos_arg/optional_pos_arg can be multiple types
|
||||||
|
# separated by |, e.g. VG|LV|Tag
|
||||||
|
#
|
||||||
|
# If the required_pos_arg/optional_pos_arg is repeatable,
|
||||||
|
# it is followed by ..., e.g. VG|LV|Tag ...
|
||||||
|
#
|
||||||
|
# LV can have a suffix indicating the LV type, e.g. LV_linear, LV_thinpool.
|
||||||
|
# LV_raid represents any raidN. LV_type1_type2_type3 when the LV is
|
||||||
|
# limited to multiple specific types.
|
||||||
|
#
|
||||||
|
# VG, LV can have the suffix _new, indicating the named VG or LV
|
||||||
|
# does not yet exist.
|
||||||
|
#
|
||||||
|
# If Select is included in pos_arg, it means that the pos_arg
|
||||||
|
# may be empty if the --select option is used.
|
||||||
|
#
|
||||||
|
# --size and --extents are interchangable, but only --size is used
|
||||||
|
# in these definitions to keep them simpler. Either --size or
|
||||||
|
# --extents will be recognized when matching a command to one of
|
||||||
|
# these definitions.
|
||||||
|
#
|
||||||
|
# Some options have multiple names, but only one form of the name
|
||||||
|
# is used in these definitions. Synonyms will be recognized when
|
||||||
|
# matching a command to a command definition.
|
||||||
|
#
|
||||||
|
# used in definitions below (equivalent but not used in definitions)
|
||||||
|
# mirrorlog core (corelog)
|
||||||
|
# resizeable (resizable)
|
||||||
|
# allocatable (allocation)
|
||||||
|
# resizeable (allocation)
|
||||||
|
# activate (available)
|
||||||
|
# rebuild (raidrebuild)
|
||||||
|
# syncaction (raidsyncaction)
|
||||||
|
# writemostly (raidwritemostly)
|
||||||
|
# minrecoveryrate (raidminrecoveryrate)
|
||||||
|
# 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
|
||||||
|
# in multiple command definitions.
|
||||||
|
#
|
||||||
|
# To define a common set of options:
|
||||||
|
# OO_NAME: --foo, --bar String
|
||||||
|
#
|
||||||
|
# To use this set of options, include it on the OO: line, e.g.
|
||||||
|
# OO: --example, OO_NAME
|
||||||
|
#
|
||||||
|
# which is expaneded to
|
||||||
|
# OO: --example, --foo, --bar String
|
||||||
|
#
|
||||||
|
# Including OO_NAME after a command name on the required line
|
||||||
|
# means that any one of the options is required and the rest
|
||||||
|
# are optional. The usage syntax for this case is printed as:
|
||||||
|
# command (--foo A, --bar B)
|
||||||
|
#
|
||||||
|
|
||||||
|
#
|
||||||
|
# OO_ALL is included in every command automatically.
|
||||||
|
# FIXME: add --force and --test to OO_ALL so that all commands will
|
||||||
|
# accept them even if they are not used?
|
||||||
|
#
|
||||||
|
OO_ALL: --commandprofile String, --config String, --debug,
|
||||||
|
--driverloaded Bool, --help, --profile String, --quiet,
|
||||||
|
--verbose, --version, --yes
|
||||||
|
|
||||||
|
#
|
||||||
|
# pvs, lvs, vgs, fullreport
|
||||||
|
#
|
||||||
|
OO_REPORT: --aligned, --all, --binary, --configreport String, --foreign,
|
||||||
|
--ignorelockingfailure, --ignoreskippedcluster, --logonly,
|
||||||
|
--nameprefixes, --noheadings, --nolocking, --nosuffix,
|
||||||
|
--options String, --partial, --readonly, --reportformat String, --rows,
|
||||||
|
--select String, --separator String, --shared, --sort String,
|
||||||
|
--trustcache, --unbuffered, --units Units, --unquoted
|
||||||
|
|
||||||
|
#
|
||||||
|
# config, dumpconfig, lvmconfig
|
||||||
|
#
|
||||||
|
OO_CONFIG: --atversion String, --typeconfig String, --file String, --ignoreadvanced,
|
||||||
|
--ignoreunsupported, --ignorelocal, --list, --mergedconfig, --metadataprofile String,
|
||||||
|
--sinceversion String, --showdeprecated, --showunsupported, --validate, --withsummary,
|
||||||
|
--withcomments, --withspaces, --unconfigured, --withversions
|
||||||
|
|
||||||
|
|
||||||
|
config
|
||||||
|
OO: OO_CONFIG
|
||||||
|
OP: String ...
|
||||||
|
|
||||||
|
devtypes
|
||||||
|
OO: --aligned, --binary, --nameprefixes, --noheadings,
|
||||||
|
--nosuffix, --options String, --reportformat String, --rows,
|
||||||
|
--select String, --separator String, --sort String, --unbuffered, --unquoted
|
||||||
|
|
||||||
|
dumpconfig
|
||||||
|
OO: OO_CONFIG
|
||||||
|
OP: String ...
|
||||||
|
|
||||||
|
formats
|
||||||
|
|
||||||
|
help
|
||||||
|
|
||||||
|
fullreport
|
||||||
|
OO: OO_REPORT
|
||||||
|
OP: VG ...
|
||||||
|
|
||||||
|
lastlog
|
||||||
|
OO: --reportformat String, --select String
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# None of these can function as a required option for lvchange.
|
||||||
|
#
|
||||||
|
OO_LVCHANGE: --autobackup Bool, --force, --ignorelockingfailure,
|
||||||
|
--ignoremonitoring, --ignoreskippedcluster, --noudevsync,
|
||||||
|
--reportformat String, --sysinit, --test, --select String
|
||||||
|
|
||||||
|
#
|
||||||
|
# Any of these can function as a required option for lvchange.
|
||||||
|
# profile is also part of OO_ALL, but is repeated in OO_LVCHANGE_META
|
||||||
|
# because it can function as a required opt.
|
||||||
|
#
|
||||||
|
OO_LVCHANGE_META: --addtag Tag, --deltag Tag,
|
||||||
|
--alloc Alloc, --contiguous Bool,
|
||||||
|
--detachprofile, --metadataprofile String, --profile String,
|
||||||
|
--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 ...
|
||||||
|
OO: OO_LVCHANGE
|
||||||
|
|
||||||
|
lvchange --resync VG|LV|Tag|Select ...
|
||||||
|
OO: OO_LVCHANGE_META, OO_LVCHANGE
|
||||||
|
|
||||||
|
lvchange --syncaction String VG|LV|Tag|Select ...
|
||||||
|
OO: OO_LVCHANGE_META, OO_LVCHANGE
|
||||||
|
|
||||||
|
lvchange --rebuild PV VG|LV|Tag|Select ...
|
||||||
|
OO: 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
|
||||||
|
|
||||||
|
lvchange --monitor Bool VG|LV|Tag|Select ...
|
||||||
|
OO: --poll Bool, OO_LVCHANGE_META, OO_LVCHANGE
|
||||||
|
|
||||||
|
lvchange --poll Bool VG|LV|Tag|Select ...
|
||||||
|
OO: --monitor Bool, OO_LVCHANGE_META, OO_LVCHANGE
|
||||||
|
|
||||||
|
lvchange --persistent Bool VG|LV|Tag|Select ...
|
||||||
|
OO: --minor Number, --major Number, OO_LVCHANGE_META, OO_LVCHANGE
|
||||||
|
|
||||||
|
|
||||||
|
OO_LVCONVERT_RAID: --mirrors SNumber, --stripes_long Number,
|
||||||
|
--stripesize SizeKB, --regionsize SizeMB
|
||||||
|
|
||||||
|
OO_LVCONVERT_POOL: --poolmetadata LV, --poolmetadatasize SizeMB,
|
||||||
|
--poolmetadataspare Bool, --readahead Readahead, --chunksize SizeKB
|
||||||
|
|
||||||
|
OO_LVCONVERT: --alloc Alloc, --background, --force, --noudevsync,
|
||||||
|
--test, --usepolicies
|
||||||
|
|
||||||
|
# FIXME: use different option names for different operations
|
||||||
|
lvconvert --merge LV_linear_striped_raid_thin_snapshot|VG|Tag ...
|
||||||
|
OO: --background, --interval Number
|
||||||
|
DESC: Merge LV that was previously split from a mirror.
|
||||||
|
DESC: Merge thin LV into its origin LV.
|
||||||
|
DESC: Merge COW snapshot LV into its origin.
|
||||||
|
|
||||||
|
lvconvert --type snapshot LV_linear_striped_raid LV_snapshot
|
||||||
|
OO: --chunksize SizeKB, --zero Bool, OO_LVCONVERT
|
||||||
|
DESC: Combine LV with a previously split snapshot LV.
|
||||||
|
|
||||||
|
lvconvert --type thin --thinpool LV LV_linear_striped_raid
|
||||||
|
OO: --originname LV_new, OO_LVCONVERT_POOL, OO_LVCONVERT
|
||||||
|
DESC: Convert LV to type thin with an external origin.
|
||||||
|
|
||||||
|
# alternate form of lvconvert --type thin
|
||||||
|
lvconvert --thin --thinpool LV LV_linear_striped_raid
|
||||||
|
OO: --type thin, --originname LV_new, OO_LVCONVERT_POOL, OO_LVCONVERT
|
||||||
|
DESC: Convert LV to type thin with an external origin (infers --type thin).
|
||||||
|
|
||||||
|
lvconvert --type cache --cachepool LV LV_linear_striped_raid_thinpool
|
||||||
|
OO: --cachepolicy String, --cachesettings String, OO_LVCONVERT_POOL, OO_LVCONVERT
|
||||||
|
DESC: Convert LV to type cache.
|
||||||
|
|
||||||
|
# alternate form of lvconvert --type cache
|
||||||
|
lvconvert --cache --cachepool LV LV_linear_striped_raid_thinpool
|
||||||
|
OO: --type cache, --cachepolicy String, --cachesettings String, OO_LVCONVERT_POOL, OO_LVCONVERT
|
||||||
|
DESC: Convert LV to type cache (infers --type cache).
|
||||||
|
|
||||||
|
lvconvert --type thin-pool LV_linear_striped_raid_cache
|
||||||
|
OO: --discards Discards, --zero Bool, OO_LVCONVERT_POOL, OO_LVCONVERT
|
||||||
|
DESC: Convert LV to type thin-pool.
|
||||||
|
|
||||||
|
lvconvert --type cache-pool LV_linear_striped_raid
|
||||||
|
OO: OO_LVCONVERT_POOL, OO_LVCONVERT
|
||||||
|
DESC: Convert LV to type cache-pool.
|
||||||
|
|
||||||
|
lvconvert --type mirror LV_linear_striped_raid
|
||||||
|
OO: OO_LVCONVERT_RAID, OO_LVCONVERT
|
||||||
|
OP: PV ...
|
||||||
|
DESC: Convert LV to type mirror.
|
||||||
|
|
||||||
|
lvconvert --type raid LV_linear_striped_mirror_raid
|
||||||
|
OO: OO_LVCONVERT_RAID, OO_LVCONVERT
|
||||||
|
OP: PV ...
|
||||||
|
DESC: Convert LV to type raid.
|
||||||
|
DESC: Change LV raid type.
|
||||||
|
|
||||||
|
lvconvert --mirrors SNumber LV_raid_mirror
|
||||||
|
OO: OO_LVCONVERT
|
||||||
|
OP: PV ...
|
||||||
|
DESC: Change the number of mirror images in the LV.
|
||||||
|
|
||||||
|
lvconvert --mirrors SNumber LV_linear_striped
|
||||||
|
OO: OO_LVCONVERT_RAID, OO_LVCONVERT
|
||||||
|
OP: PV ...
|
||||||
|
DESC: Alternate form to convert LV to type raid1 or mirror (use --type raid1|mirror).
|
||||||
|
|
||||||
|
lvconvert --splitmirrors Number --name LV_new LV_raid1_mirror_cache
|
||||||
|
OO: OO_LVCONVERT
|
||||||
|
DESC: Split images from a raid1 or mirror LV and use them to create a new LV.
|
||||||
|
|
||||||
|
lvconvert --splitmirrors Number --trackchanges LV_raid1_cache
|
||||||
|
OO: OO_LVCONVERT
|
||||||
|
DESC: Split images from a raid1 LV and use them to create a new LV.
|
||||||
|
|
||||||
|
lvconvert --repair LV_raid_mirror_thinpool
|
||||||
|
OO: OO_LVCONVERT
|
||||||
|
DESC: Replace failed PVs in a mirror or raid LV.
|
||||||
|
DESC: Repair a thin pool.
|
||||||
|
|
||||||
|
lvconvert --replace PV LV_raid
|
||||||
|
OO: OO_LVCONVERT
|
||||||
|
OP: PV ...
|
||||||
|
DESC: Replace specific PV(s) in a raid* LV with another PV.
|
||||||
|
|
||||||
|
lvconvert --type striped LV_raid
|
||||||
|
OO: OO_LVCONVERT_RAID, OO_LVCONVERT
|
||||||
|
OP: PV ...
|
||||||
|
DESC: Convert LV to type striped.
|
||||||
|
|
||||||
|
lvconvert --type linear LV_raid_mirror
|
||||||
|
OO: OO_LVCONVERT
|
||||||
|
DESC: Convert LV to type linear.
|
||||||
|
|
||||||
|
lvconvert --mirrorlog MirrorLog LV_mirror
|
||||||
|
OO: OO_LVCONVERT
|
||||||
|
DESC: Change the type of log used by LV.
|
||||||
|
|
||||||
|
lvconvert --splitcache LV_cachepool_cache_thinpool
|
||||||
|
OO: OO_LVCONVERT
|
||||||
|
DESC: Separate and preserve a cache pool from a cache LV.
|
||||||
|
|
||||||
|
lvconvert --uncache LV_cache_thinpool
|
||||||
|
OO: OO_LVCONVERT
|
||||||
|
DESC: Separate and remove a cache pool from a cache LV.
|
||||||
|
|
||||||
|
lvconvert --splitsnapshot LV_snapshot
|
||||||
|
OO: OO_LVCONVERT
|
||||||
|
DESC: Separate a COW snapshot from its origin LV.
|
||||||
|
|
||||||
|
# deprecated because of non-standard syntax
|
||||||
|
lvconvert --thinpool LV
|
||||||
|
OO: OO_LVCONVERT_POOL, OO_LVCONVERT
|
||||||
|
DESC: Alternate form to convert LV to type thin-pool (use --type thin-pool).
|
||||||
|
|
||||||
|
# deprecated because of non-standard syntax
|
||||||
|
lvconvert --cachepool LV
|
||||||
|
OO: OO_LVCONVERT_POOL, OO_LVCONVERT
|
||||||
|
DESC: Alternate form to convert LV to type cache-pool (use --type cache-pool).
|
||||||
|
|
||||||
|
# FIXME: add a new option defining this operation, e.g. --poll-mirror
|
||||||
|
# The function of this command is not entirely clear.
|
||||||
|
lvconvert LV_mirror
|
||||||
|
DESC: Poll LV to collapse resync layers.
|
||||||
|
|
||||||
|
# FIXME: add a new option defining this operation, e.g. --swapmetadata
|
||||||
|
lvconvert --poolmetadata LV LV_thinpool_cachepool
|
||||||
|
DESC: Swap metadata LV in a thin pool or cache pool (temporary command).
|
||||||
|
|
||||||
|
|
||||||
|
# --extents or --size are interchangable
|
||||||
|
|
||||||
|
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 Permission, --persistent Bool, --readahead Readahead,
|
||||||
|
--reportformat String, --setactivationskip Bool, --test, --wipesignatures Bool,
|
||||||
|
--zero Bool
|
||||||
|
|
||||||
|
OO_LVCREATE_CACHE: --cachemode CacheMode, --cachepolicy String, --cachesettings String
|
||||||
|
|
||||||
|
OO_LVCREATE_POOL: --poolmetadatasize SizeMB, --poolmetadataspare Bool, --chunksize SizeKB
|
||||||
|
|
||||||
|
OO_LVCREATE_THIN: --discards Discards, --errorwhenfull Bool
|
||||||
|
|
||||||
|
OO_LVCREATE_RAID: --mirrors SNumber, --stripes Number, --stripesize SizeKB,
|
||||||
|
--regionsize SizeMB, --minrecoveryrate SizeKB, --maxrecoveryrate SizeKB
|
||||||
|
|
||||||
|
lvcreate --type error --size SizeMB VG
|
||||||
|
OO: OO_LVCREATE
|
||||||
|
DESC: Create an LV that returns errors when used.
|
||||||
|
|
||||||
|
lvcreate --type zero --size SizeMB VG
|
||||||
|
OO: OO_LVCREATE
|
||||||
|
DESC: Create an LV that returns zeros when read.
|
||||||
|
|
||||||
|
lvcreate --type linear --size SizeMB VG
|
||||||
|
OO: OO_LVCREATE
|
||||||
|
OP: PV ...
|
||||||
|
DESC: Create a linear LV.
|
||||||
|
|
||||||
|
lvcreate --type striped --size SizeMB VG
|
||||||
|
OO: --stripes Number, --stripesize SizeKB, OO_LVCREATE
|
||||||
|
OP: PV ...
|
||||||
|
DESC: Create a striped LV.
|
||||||
|
|
||||||
|
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 SizeMB VG
|
||||||
|
OO: OO_LVCREATE_RAID, OO_LVCREATE
|
||||||
|
OP: PV ...
|
||||||
|
DESC: Create a raid LV (a specific raid level must be used, for example, raid1).
|
||||||
|
|
||||||
|
lvcreate --type snapshot --size SizeMB LV
|
||||||
|
OO: OO_LVCREATE
|
||||||
|
OP: PV ...
|
||||||
|
DESC: Create a COW snapshot from an origin LV.
|
||||||
|
|
||||||
|
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 SizeMB VG
|
||||||
|
OO: OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE
|
||||||
|
OP: PV ...
|
||||||
|
DESC: Create a thin pool.
|
||||||
|
|
||||||
|
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 SizeMB --thinpool LV_thinpool
|
||||||
|
OO: OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE
|
||||||
|
DESC: Create a thin LV in a thin pool.
|
||||||
|
|
||||||
|
lvcreate --type thin --snapshot LV_thin
|
||||||
|
OO: OO_LVCREATE_POOL, OO_LVCREATE_THIN, OO_LVCREATE
|
||||||
|
DESC: Create a thin LV that is a snapshot of an existing thin LV.
|
||||||
|
|
||||||
|
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 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 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 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 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 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 SizeMB VG
|
||||||
|
OO: --type linear, OO_LVCREATE
|
||||||
|
OP: PV ...
|
||||||
|
DESC: Create a linear LV, --name is usually specified (default --type linear).
|
||||||
|
|
||||||
|
lvcreate --stripes Number --size SizeMB VG
|
||||||
|
OO: --type striped, --stripesize SizeKB, OO_LVCREATE
|
||||||
|
OP: PV ...
|
||||||
|
DESC: Create a striped LV (infers --type striped).
|
||||||
|
|
||||||
|
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).
|
||||||
|
|
||||||
|
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 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).
|
||||||
|
|
||||||
|
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).
|
||||||
|
|
||||||
|
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).
|
||||||
|
|
||||||
|
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).
|
||||||
|
|
||||||
|
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).
|
||||||
|
|
||||||
|
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).
|
||||||
|
|
||||||
|
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).
|
||||||
|
|
||||||
|
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).
|
||||||
|
|
||||||
|
lvcreate --size SizeMB --virtualsize SizeMB VG
|
||||||
|
OO: --type thin, --type snapshot, --thin, --snapshot,
|
||||||
|
--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.
|
||||||
|
|
||||||
|
lvdisplay
|
||||||
|
OO: --aligned, --all, --binary, --colon, --columns,
|
||||||
|
--configreport String, --foreign, --history, --ignorelockingfailure,
|
||||||
|
--ignoreskippedcluster, --logonly, --maps, --noheadings,
|
||||||
|
--nosuffix, --options String, --sort String, --partial, --readonly,
|
||||||
|
--reportformat String, --segments, --select String, --separator String,
|
||||||
|
--shared, --unbuffered, --units Units
|
||||||
|
OP: VG|LV|Tag ...
|
||||||
|
|
||||||
|
# --extents or --size are interchangable
|
||||||
|
lvextend --size SizeMB LV
|
||||||
|
OO: --alloc Alloc, --autobackup Bool, --force, --mirrors SNumber,
|
||||||
|
--nofsck, --nosync, --noudevsync, --reportformat String, --resizefs,
|
||||||
|
--stripes Number, --stripesize SizeKB, --test, --poolmetadatasize SizeMB
|
||||||
|
OP: PV ...
|
||||||
|
|
||||||
|
lvextend LV PV ...
|
||||||
|
OO: --alloc Alloc, --autobackup Bool, --force, --mirrors SNumber,
|
||||||
|
--nofsck, --nosync, --noudevsync,
|
||||||
|
--reportformat String, --resizefs, --stripes Number, --stripesize SizeKB,
|
||||||
|
--test
|
||||||
|
|
||||||
|
lvextend --poolmetadatasize SizeMB LV_thinpool
|
||||||
|
OO: --alloc Alloc, --autobackup Bool, --force, --mirrors SNumber,
|
||||||
|
--nofsck, --nosync, --noudevsync,
|
||||||
|
--reportformat String, --stripes Number, --stripesize SizeKB,
|
||||||
|
--test
|
||||||
|
OP: PV ...
|
||||||
|
|
||||||
|
lvextend --usepolicies LV_thinpool_snapshot
|
||||||
|
OO: --alloc Alloc, --autobackup Bool, --force, --mirrors SNumber,
|
||||||
|
--nofsck, --nosync, --noudevsync,
|
||||||
|
--reportformat String, --resizefs,
|
||||||
|
--test
|
||||||
|
|
||||||
|
lvmchange
|
||||||
|
|
||||||
|
lvmconfig
|
||||||
|
OO: OO_CONFIG
|
||||||
|
|
||||||
|
lvmdiskscan
|
||||||
|
OO: --lvmpartition, --readonly
|
||||||
|
|
||||||
|
lvmsadc
|
||||||
|
|
||||||
|
lvmsar
|
||||||
|
OO: --full, --stdin
|
||||||
|
|
||||||
|
# --extents or --size are interchangable
|
||||||
|
lvreduce --size SizeMB LV
|
||||||
|
OO: --autobackup Bool, --force, --nofsck, --noudevsync,
|
||||||
|
--reportformat String, --resizefs, --test
|
||||||
|
|
||||||
|
lvremove VG|LV|Tag|Select ...
|
||||||
|
OO: --autobackup Bool, --force, --nohistory, --noudevsync,
|
||||||
|
--reportformat String, --select String, --test
|
||||||
|
|
||||||
|
lvrename VG LV LV_new
|
||||||
|
OO: --autobackup Bool, --noudevsync, --reportformat String, --test
|
||||||
|
|
||||||
|
lvrename LV LV_new
|
||||||
|
OO: --autobackup Bool, --noudevsync, --reportformat String, --test
|
||||||
|
|
||||||
|
# --extents or --size are interchangable
|
||||||
|
lvresize --size SizeMB LV
|
||||||
|
OO: --alloc Alloc, --autobackup Bool, --force,
|
||||||
|
--nofsck, --nosync, --noudevsync, --reportformat String, --resizefs,
|
||||||
|
--stripes Number, --stripesize SizeKB, --test, --poolmetadatasize SizeMB
|
||||||
|
OP: PV ...
|
||||||
|
|
||||||
|
lvresize LV PV ...
|
||||||
|
OO: --alloc Alloc, --autobackup Bool, --force,
|
||||||
|
--nofsck, --nosync, --noudevsync,
|
||||||
|
--reportformat String, --resizefs, --stripes Number, --stripesize SizeKB,
|
||||||
|
--test
|
||||||
|
|
||||||
|
lvresize --poolmetadatasize SizeMB LV_thinpool
|
||||||
|
OO: --alloc Alloc, --autobackup Bool, --force,
|
||||||
|
--nofsck, --nosync, --noudevsync,
|
||||||
|
--reportformat String, --stripes Number, --stripesize SizeKB,
|
||||||
|
--test
|
||||||
|
OP: PV ...
|
||||||
|
|
||||||
|
lvs
|
||||||
|
OO: --history, --segments, OO_REPORT
|
||||||
|
OP: VG|LV|Tag ...
|
||||||
|
|
||||||
|
lvscan
|
||||||
|
OO: --all, --blockdevice, --ignorelockingfailure, --partial,
|
||||||
|
--readonly, --reportformat String, --cache_long
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# None of these can function as a required option for pvchange.
|
||||||
|
#
|
||||||
|
OO_PVCHANGE: --autobackup Bool, --force, --ignoreskippedcluster,
|
||||||
|
--reportformat String, --test, --uuid
|
||||||
|
|
||||||
|
#
|
||||||
|
# Any of these can function as a required option for pvchange.
|
||||||
|
#
|
||||||
|
OO_PVCHANGE_META: --allocatable Bool, --addtag Tag, --deltag Tag,
|
||||||
|
--uuid, --metadataignore Bool
|
||||||
|
|
||||||
|
pvchange OO_PVCHANGE_META --all
|
||||||
|
OO: OO_PVCHANGE
|
||||||
|
|
||||||
|
pvchange OO_PVCHANGE_META PV|Select ...
|
||||||
|
OO: --select String, OO_PVCHANGE
|
||||||
|
|
||||||
|
pvresize PV ...
|
||||||
|
OO: --setphysicalvolumesize SizeMB, --reportformat String, --test
|
||||||
|
|
||||||
|
pvck PV ...
|
||||||
|
OO: --labelsector Number
|
||||||
|
|
||||||
|
#
|
||||||
|
# Use --uuidstr here which will be converted to uuidstr_ARG
|
||||||
|
# which is actually --uuid string on the command line.
|
||||||
|
#
|
||||||
|
pvcreate PV ...
|
||||||
|
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
|
||||||
|
|
||||||
|
pvdisplay
|
||||||
|
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 Units
|
||||||
|
OP: PV|Tag ...
|
||||||
|
|
||||||
|
pvmove PV
|
||||||
|
OO: --abort, --alloc Alloc, --atomic, --autobackup Bool, --background,
|
||||||
|
--interval Number, --name LV, --noudevsync, --reportformat String, --test
|
||||||
|
OP: PV ...
|
||||||
|
|
||||||
|
pvmove
|
||||||
|
OO: --abort, --background, --test
|
||||||
|
|
||||||
|
lvpoll --polloperation String LV ...
|
||||||
|
OO: --abort, --autobackup Bool, --handlemissingpvs, --interval Number, --test
|
||||||
|
|
||||||
|
pvremove PV ...
|
||||||
|
OO: --force, --reportformat String, --test
|
||||||
|
|
||||||
|
pvs
|
||||||
|
OO: --segments, OO_REPORT
|
||||||
|
OP: PV|Tag ...
|
||||||
|
|
||||||
|
pvscan
|
||||||
|
OO: --ignorelockingfailure, --reportformat String, --exported, --novolumegroup,
|
||||||
|
--short, --uuid
|
||||||
|
|
||||||
|
pvscan --cache_long
|
||||||
|
OO: --ignorelockingfailure, --reportformat String, --background,
|
||||||
|
--activate Active, --major Number, --minor Number,
|
||||||
|
OP: PV|String ...
|
||||||
|
|
||||||
|
segtypes
|
||||||
|
|
||||||
|
systemid
|
||||||
|
|
||||||
|
tags
|
||||||
|
|
||||||
|
vgcfgbackup
|
||||||
|
OO: --file String, --foreign, --ignorelockingfailure, --partial, --readonly,
|
||||||
|
--reportformat String
|
||||||
|
|
||||||
|
vgcfgrestore VG
|
||||||
|
OO: --file String, --force_long, --list, --metadatatype MetadataType, --test
|
||||||
|
|
||||||
|
vgcfgrestore --list --file String
|
||||||
|
|
||||||
|
#
|
||||||
|
# None of these can function as a required option for vgchange.
|
||||||
|
#
|
||||||
|
OO_VGCHANGE: --autobackup Bool, --ignoremonitoring, --ignoreskippedcluster,
|
||||||
|
--noudevsync, --reportformat String, --select String, --test, --force
|
||||||
|
|
||||||
|
#
|
||||||
|
# Any of these can function as a required option for vgchange.
|
||||||
|
# profile is also part of OO_ALL, but is repeated in OO_VGCHANGE_META
|
||||||
|
# because it can function as a required opt.
|
||||||
|
#
|
||||||
|
OO_VGCHANGE_META: --addtag Tag, --deltag Tag,
|
||||||
|
--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
|
||||||
|
OO: OO_VGCHANGE
|
||||||
|
OP: VG|Tag ...
|
||||||
|
|
||||||
|
vgchange --monitor Bool
|
||||||
|
OO: --sysinit, --ignorelockingfailure, --poll Bool, OO_VGCHANGE_META, OO_VGCHANGE
|
||||||
|
OP: VG|Tag ...
|
||||||
|
|
||||||
|
vgchange --poll Bool
|
||||||
|
OO: --ignorelockingfailure, OO_VGCHANGE_META, OO_VGCHANGE
|
||||||
|
OP: VG|Tag ...
|
||||||
|
|
||||||
|
vgchange --activate Active
|
||||||
|
OO: --activationmode ActivationMode, --ignoreactivationskip, --partial, --sysinit,
|
||||||
|
--ignorelockingfailure, --monitor Bool, --poll Bool, OO_VGCHANGE_META, OO_VGCHANGE
|
||||||
|
OP: VG|Tag ...
|
||||||
|
|
||||||
|
vgchange --refresh
|
||||||
|
OO: --sysinit, --ignorelockingfailure, --monitor Bool, --poll Bool, OO_VGCHANGE_META, OO_VGCHANGE
|
||||||
|
OP: VG|Tag ...
|
||||||
|
|
||||||
|
vgchange --lockstart
|
||||||
|
OO: --lockopt String, OO_VGCHANGE_META, OO_VGCHANGE
|
||||||
|
OP: VG|Tag ...
|
||||||
|
|
||||||
|
vgchange --lockstop
|
||||||
|
OO: --lockopt String, OO_VGCHANGE_META, OO_VGCHANGE
|
||||||
|
OP: VG|Tag ...
|
||||||
|
|
||||||
|
vgck
|
||||||
|
OO: --reportformat String
|
||||||
|
OP: VG|Tag ...
|
||||||
|
|
||||||
|
vgconvert VG ...
|
||||||
|
OO: --force, --test, --labelsector Number, --bootloaderareasize SizeMB,
|
||||||
|
--metadatatype MetadataType, --pvmetadatacopies Number,
|
||||||
|
--metadatasize SizeMB, --reportformat String
|
||||||
|
|
||||||
|
vgcreate VG_new PV ...
|
||||||
|
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 Units
|
||||||
|
OP: VG|Tag ...
|
||||||
|
|
||||||
|
OO_VGEXPORT: --reportformat String, --test
|
||||||
|
|
||||||
|
vgexport VG|Tag|Select ...
|
||||||
|
OO: --select String, OO_VGEXPORT
|
||||||
|
|
||||||
|
vgexport --all
|
||||||
|
OO: OO_VGEXPORT
|
||||||
|
|
||||||
|
vgextend VG PV ...
|
||||||
|
OO: --autobackup Bool, --test,
|
||||||
|
--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
|
||||||
|
|
||||||
|
vgimport VG|Tag|Select ...
|
||||||
|
OO: --select String, OO_VGIMPORT
|
||||||
|
|
||||||
|
vgimport --all
|
||||||
|
OO: OO_VGIMPORT
|
||||||
|
|
||||||
|
vgimportclone PV ...
|
||||||
|
OO: --basevgname VG, --test, --import
|
||||||
|
|
||||||
|
vgmerge VG VG
|
||||||
|
OO: --autobackup Bool, --list, --test
|
||||||
|
|
||||||
|
vgmknodes
|
||||||
|
OO: --ignorelockingfailure, --refresh, --reportformat String
|
||||||
|
OP: VG|LV|Tag ...
|
||||||
|
|
||||||
|
OO_VGREDUCE: --autobackup Bool, --force, --reportformat String, --test
|
||||||
|
|
||||||
|
vgreduce VG PV ...
|
||||||
|
OO: OO_VGREDUCE
|
||||||
|
|
||||||
|
vgreduce --all VG
|
||||||
|
OO: OO_VGREDUCE
|
||||||
|
|
||||||
|
vgreduce --removemissing VG
|
||||||
|
OO: --mirrorsonly, OO_VGREDUCE
|
||||||
|
|
||||||
|
vgremove VG|Tag|Select ...
|
||||||
|
OO: --force, --noudevsync, --reportformat String, --select String, --test
|
||||||
|
|
||||||
|
vgrename VG VG_new
|
||||||
|
OO: --autobackup Bool, --force, --reportformat String, --test
|
||||||
|
|
||||||
|
vgrename String VG_new
|
||||||
|
OO: --autobackup Bool, --force, --reportformat String, --test
|
||||||
|
|
||||||
|
vgs
|
||||||
|
OO: OO_REPORT
|
||||||
|
OP: VG|Tag ...
|
||||||
|
|
||||||
|
vgscan
|
||||||
|
OO: --cache_long, --ignorelockingfailure, --mknodes, --notifydbus,
|
||||||
|
--partial, --reportformat String
|
||||||
|
|
||||||
|
OO_VGSPLIT: --autobackup Bool, --test
|
||||||
|
|
||||||
|
OO_VGSPLIT_NEW: --alloc Alloc, --clustered Bool,
|
||||||
|
--maxlogicalvolumes Number, --maxphysicalvolumes Number,
|
||||||
|
--metadatatype MetadataType, --vgmetadatacopies MetadataCopies
|
||||||
|
|
||||||
|
vgsplit VG VG PV ...
|
||||||
|
OO: OO_VGSPLIT
|
||||||
|
|
||||||
|
vgsplit --name LV VG VG
|
||||||
|
OO: OO_VGSPLIT
|
||||||
|
|
||||||
|
vgsplit VG VG_new PV ...
|
||||||
|
OO: OO_VGSPLIT, OO_VGSPLIT_NEW
|
||||||
|
|
||||||
|
vgsplit --name LV VG VG_new
|
||||||
|
OO: OO_VGSPLIT, OO_VGSPLIT_NEW
|
||||||
|
|
||||||
|
version
|
||||||
|
|
1513
scripts/create-commands.c
Normal file
1513
scripts/create-commands.c
Normal file
File diff suppressed because it is too large
Load Diff
405
tools/args.h
405
tools/args.h
@ -17,215 +17,214 @@
|
|||||||
* Put all long args that don't have a corresponding short option first.
|
* Put all long args that don't have a corresponding short option first.
|
||||||
*/
|
*/
|
||||||
/* *INDENT-OFF* */
|
/* *INDENT-OFF* */
|
||||||
arg(abort_ARG, '\0', "abort", NULL, 0, 0)
|
arg(abort_ARG, '\0', "abort", 0, 0, 0)
|
||||||
arg(activationmode_ARG, '\0', "activationmode", string_arg, 0, 0)
|
arg(activationmode_ARG, '\0', "activationmode", activationmode_VAL, 0, 0)
|
||||||
arg(addtag_ARG, '\0', "addtag", tag_arg, ARG_GROUPABLE, 0)
|
arg(addtag_ARG, '\0', "addtag", tag_VAL, ARG_GROUPABLE, 0)
|
||||||
arg(aligned_ARG, '\0', "aligned", NULL, 0, 0)
|
arg(aligned_ARG, '\0', "aligned", 0, 0, 0)
|
||||||
arg(alloc_ARG, '\0', "alloc", alloc_arg, 0, 0)
|
arg(alloc_ARG, '\0', "alloc", alloc_VAL, 0, 0)
|
||||||
arg(atomic_ARG, '\0', "atomic", NULL, 0, 0)
|
arg(atomic_ARG, '\0', "atomic", 0, 0, 0)
|
||||||
arg(atversion_ARG, '\0', "atversion", string_arg, 0, 0)
|
arg(atversion_ARG, '\0', "atversion", string_VAL, 0, 0)
|
||||||
arg(binary_ARG, '\0', "binary", NULL, 0, 0)
|
arg(binary_ARG, '\0', "binary", 0, 0, 0)
|
||||||
arg(bootloaderareasize_ARG, '\0', "bootloaderareasize", size_mb_arg, 0, 0)
|
arg(bootloaderareasize_ARG, '\0', "bootloaderareasize", sizemb_VAL, 0, 0)
|
||||||
arg(cache_long_ARG, '\0', "cache", NULL, 0, 0)
|
arg(cache_long_ARG, '\0', "cache", 0, 0, 0)
|
||||||
arg(cachemode_ARG, '\0', "cachemode", cachemode_arg, 0, 0)
|
arg(cachemode_ARG, '\0', "cachemode", cachemode_VAL, 0, 0)
|
||||||
arg(cachepool_ARG, '\0', "cachepool", string_arg, 0, 0)
|
arg(cachepool_ARG, '\0', "cachepool", lv_VAL, 0, 0)
|
||||||
arg(commandprofile_ARG, '\0', "commandprofile", string_arg, 0, 0)
|
arg(commandprofile_ARG, '\0', "commandprofile", string_VAL, 0, 0)
|
||||||
arg(config_ARG, '\0', "config", string_arg, 0, 0)
|
arg(config_ARG, '\0', "config", string_VAL, 0, 0)
|
||||||
arg(configreport_ARG, '\0', "configreport", string_arg, ARG_GROUPABLE, 1)
|
arg(configreport_ARG, '\0', "configreport", string_VAL, ARG_GROUPABLE, 1)
|
||||||
arg(configtype_ARG, '\0', "type", string_arg, 0, 0)
|
arg(configtype_ARG, '\0', "typeconfig", string_VAL, 0, 0)
|
||||||
arg(corelog_ARG, '\0', "corelog", NULL, 0, 0)
|
arg(corelog_ARG, '\0', "corelog", 0, 0, 0)
|
||||||
arg(dataalignment_ARG, '\0', "dataalignment", size_kb_arg, 0, 0)
|
arg(dataalignment_ARG, '\0', "dataalignment", sizekb_VAL, 0, 0)
|
||||||
arg(dataalignmentoffset_ARG, '\0', "dataalignmentoffset", size_kb_arg, 0, 0)
|
arg(dataalignmentoffset_ARG, '\0', "dataalignmentoffset", sizekb_VAL, 0, 0)
|
||||||
arg(deltag_ARG, '\0', "deltag", tag_arg, ARG_GROUPABLE, 0)
|
arg(deltag_ARG, '\0', "deltag", tag_VAL, ARG_GROUPABLE, 0)
|
||||||
arg(detachprofile_ARG, '\0', "detachprofile", NULL, 0, 0)
|
arg(detachprofile_ARG, '\0', "detachprofile", 0, 0, 0)
|
||||||
arg(discards_ARG, '\0', "discards", discards_arg, 0, 0)
|
arg(discards_ARG, '\0', "discards", discards_VAL, 0, 0)
|
||||||
arg(driverloaded_ARG, '\0', "driverloaded", yes_no_arg, 0, 0)
|
arg(driverloaded_ARG, '\0', "driverloaded", bool_VAL, 0, 0)
|
||||||
arg(errorwhenfull_ARG, '\0', "errorwhenfull", yes_no_arg, 0, 0)
|
arg(errorwhenfull_ARG, '\0', "errorwhenfull", bool_VAL, 0, 0)
|
||||||
arg(force_long_ARG, '\0', "force", NULL, ARG_COUNTABLE, 0)
|
arg(force_long_ARG, '\0', "force", 0, ARG_COUNTABLE, 0)
|
||||||
arg(foreign_ARG, '\0', "foreign", NULL, 0, 0)
|
arg(foreign_ARG, '\0', "foreign", 0, 0, 0)
|
||||||
arg(handlemissingpvs_ARG, '\0', "handlemissingpvs", NULL, 0, 0)
|
arg(handlemissingpvs_ARG, '\0', "handlemissingpvs", 0, 0, 0)
|
||||||
arg(ignoreadvanced_ARG, '\0', "ignoreadvanced", NULL, 0, 0)
|
arg(ignoreadvanced_ARG, '\0', "ignoreadvanced", 0, 0, 0)
|
||||||
arg(ignorelocal_ARG, '\0', "ignorelocal", NULL, 0, 0)
|
arg(ignorelocal_ARG, '\0', "ignorelocal", 0, 0, 0)
|
||||||
arg(ignorelockingfailure_ARG, '\0', "ignorelockingfailure", NULL, 0, 0)
|
arg(ignorelockingfailure_ARG, '\0', "ignorelockingfailure", 0, 0, 0)
|
||||||
arg(ignoremonitoring_ARG, '\0', "ignoremonitoring", NULL, 0, 0)
|
arg(ignoremonitoring_ARG, '\0', "ignoremonitoring", 0, 0, 0)
|
||||||
arg(ignoreskippedcluster_ARG, '\0', "ignoreskippedcluster", NULL, 0, 0)
|
arg(ignoreskippedcluster_ARG, '\0', "ignoreskippedcluster", 0, 0, 0)
|
||||||
arg(ignoreunsupported_ARG, '\0', "ignoreunsupported", NULL, 0, 0)
|
arg(ignoreunsupported_ARG, '\0', "ignoreunsupported", 0, 0, 0)
|
||||||
arg(labelsector_ARG, '\0', "labelsector", int_arg, 0, 0)
|
arg(labelsector_ARG, '\0', "labelsector", number_VAL, 0, 0)
|
||||||
arg(lockopt_ARG, '\0', "lockopt", string_arg, 0, 0)
|
arg(lockopt_ARG, '\0', "lockopt", string_VAL, 0, 0)
|
||||||
arg(lockstart_ARG, '\0', "lockstart", NULL, 0, 0)
|
arg(lockstart_ARG, '\0', "lockstart", 0, 0, 0)
|
||||||
arg(lockstop_ARG, '\0', "lockstop", NULL, 0, 0)
|
arg(lockstop_ARG, '\0', "lockstop", 0, 0, 0)
|
||||||
arg(locktype_ARG, '\0', "locktype", locktype_arg, 0, 0)
|
arg(locktype_ARG, '\0', "locktype", locktype_VAL, 0, 0)
|
||||||
arg(logonly_ARG, '\0', "logonly", NULL, 0, 0)
|
arg(logonly_ARG, '\0', "logonly", 0, 0, 0)
|
||||||
arg(maxrecoveryrate_ARG, '\0', "maxrecoveryrate", size_kb_arg, 0, 0)
|
arg(maxrecoveryrate_ARG, '\0', "maxrecoveryrate", sizekb_VAL, 0, 0)
|
||||||
arg(merge_ARG, '\0', "merge", NULL, 0, 0)
|
arg(merge_ARG, '\0', "merge", 0, 0, 0)
|
||||||
arg(mergedconfig_ARG, '\0', "mergedconfig", NULL, 0, 0)
|
arg(mergedconfig_ARG, '\0', "mergedconfig", 0, 0, 0)
|
||||||
arg(metadatacopies_ARG, '\0', "metadatacopies", metadatacopies_arg, 0, 0)
|
arg(metadatacopies_ARG, '\0', "metadatacopies", metadatacopies_VAL, 0, 0)
|
||||||
arg(metadataignore_ARG, '\0', "metadataignore", yes_no_arg, 0, 0)
|
arg(metadataignore_ARG, '\0', "metadataignore", bool_VAL, 0, 0)
|
||||||
arg(metadataprofile_ARG, '\0', "metadataprofile", string_arg, 0, 0)
|
arg(metadataprofile_ARG, '\0', "metadataprofile", string_VAL, 0, 0)
|
||||||
arg(metadatasize_ARG, '\0', "metadatasize", size_mb_arg, 0, 0)
|
arg(metadatasize_ARG, '\0', "metadatasize", sizemb_VAL, 0, 0)
|
||||||
arg(minor_ARG, '\0', "minor", int_arg, ARG_GROUPABLE, 0)
|
arg(minor_ARG, '\0', "minor", number_VAL, ARG_GROUPABLE, 0)
|
||||||
arg(minrecoveryrate_ARG, '\0', "minrecoveryrate", size_kb_arg, 0, 0)
|
arg(minrecoveryrate_ARG, '\0', "minrecoveryrate", sizekb_VAL, 0, 0)
|
||||||
arg(mirrorlog_ARG, '\0', "mirrorlog", mirrorlog_arg, 0, 0)
|
arg(mirrorlog_ARG, '\0', "mirrorlog", mirrorlog_VAL, 0, 0)
|
||||||
arg(mirrorsonly_ARG, '\0', "mirrorsonly", NULL, 0, 0)
|
arg(mirrorsonly_ARG, '\0', "mirrorsonly", 0, 0, 0)
|
||||||
arg(mknodes_ARG, '\0', "mknodes", NULL, 0, 0)
|
arg(mknodes_ARG, '\0', "mknodes", 0, 0, 0)
|
||||||
arg(monitor_ARG, '\0', "monitor", yes_no_arg, 0, 0)
|
arg(monitor_ARG, '\0', "monitor", bool_VAL, 0, 0)
|
||||||
arg(nameprefixes_ARG, '\0', "nameprefixes", NULL, 0, 0)
|
arg(nameprefixes_ARG, '\0', "nameprefixes", 0, 0, 0)
|
||||||
arg(noheadings_ARG, '\0', "noheadings", NULL, 0, 0)
|
arg(noheadings_ARG, '\0', "noheadings", 0, 0, 0)
|
||||||
arg(nohistory_ARG, '\0', "nohistory", NULL, 0, 0)
|
arg(nohistory_ARG, '\0', "nohistory", 0, 0, 0)
|
||||||
arg(nolocking_ARG, '\0', "nolocking", NULL, 0, 0)
|
arg(nolocking_ARG, '\0', "nolocking", 0, 0, 0)
|
||||||
arg(norestorefile_ARG, '\0', "norestorefile", NULL, 0, 0)
|
arg(norestorefile_ARG, '\0', "norestorefile", 0, 0, 0)
|
||||||
arg(nosuffix_ARG, '\0', "nosuffix", NULL, 0, 0)
|
arg(nosuffix_ARG, '\0', "nosuffix", 0, 0, 0)
|
||||||
arg(nosync_ARG, '\0', "nosync", NULL, 0, 0)
|
arg(nosync_ARG, '\0', "nosync", 0, 0, 0)
|
||||||
arg(notifydbus_ARG, '\0', "notifydbus", NULL, 0, 0)
|
arg(notifydbus_ARG, '\0', "notifydbus", 0, 0, 0)
|
||||||
arg(noudevsync_ARG, '\0', "noudevsync", NULL, 0, 0)
|
arg(noudevsync_ARG, '\0', "noudevsync", 0, 0, 0)
|
||||||
arg(originname_ARG, '\0', "originname", string_arg, 0, 0)
|
arg(originname_ARG, '\0', "originname", lv_VAL, 0, 0)
|
||||||
arg(physicalvolumesize_ARG, '\0', "setphysicalvolumesize", size_mb_arg, 0, 0)
|
arg(physicalvolumesize_ARG, '\0', "setphysicalvolumesize", sizemb_VAL, 0, 0)
|
||||||
arg(poll_ARG, '\0', "poll", yes_no_arg, 0, 0)
|
arg(poll_ARG, '\0', "poll", bool_VAL, 0, 0)
|
||||||
arg(polloperation_ARG, '\0', "polloperation", string_arg, 0, 0)
|
arg(polloperation_ARG, '\0', "polloperation", string_VAL, 0, 0)
|
||||||
arg(pooldatasize_ARG, '\0', "pooldatasize", size_mb_arg, 0, 0)
|
arg(pooldatasize_ARG, '\0', "pooldatasize", sizemb_VAL, 0, 0)
|
||||||
arg(poolmetadata_ARG, '\0', "poolmetadata", string_arg, 0, 0)
|
arg(poolmetadata_ARG, '\0', "poolmetadata", lv_VAL, 0, 0)
|
||||||
arg(poolmetadatasize_ARG, '\0', "poolmetadatasize", size_mb_arg, 0, 0)
|
arg(poolmetadatasize_ARG, '\0', "poolmetadatasize", sizemb_VAL, 0, 0)
|
||||||
arg(poolmetadataspare_ARG, '\0', "poolmetadataspare", yes_no_arg, 0, 0)
|
arg(poolmetadataspare_ARG, '\0', "poolmetadataspare", bool_VAL, 0, 0)
|
||||||
arg(profile_ARG, '\0', "profile", string_arg, 0, 0)
|
arg(profile_ARG, '\0', "profile", string_VAL, 0, 0)
|
||||||
arg(pvmetadatacopies_ARG, '\0', "pvmetadatacopies", int_arg, 0, 0)
|
arg(pvmetadatacopies_ARG, '\0', "pvmetadatacopies", number_VAL, 0, 0)
|
||||||
arg(raidrebuild_ARG, '\0', "raidrebuild", string_arg, ARG_GROUPABLE, 0)
|
arg(raidrebuild_ARG, '\0', "raidrebuild", string_VAL, ARG_GROUPABLE, 0)
|
||||||
arg(raidmaxrecoveryrate_ARG, '\0', "raidmaxrecoveryrate", size_kb_arg, 0, 0)
|
arg(raidmaxrecoveryrate_ARG, '\0', "raidmaxrecoveryrate", sizekb_VAL, 0, 0)
|
||||||
arg(raidminrecoveryrate_ARG, '\0', "raidminrecoveryrate", size_kb_arg, 0, 0)
|
arg(raidminrecoveryrate_ARG, '\0', "raidminrecoveryrate", sizekb_VAL, 0, 0)
|
||||||
arg(raidsyncaction_ARG, '\0', "raidsyncaction", string_arg, 0, 0)
|
arg(raidsyncaction_ARG, '\0', "raidsyncaction", string_VAL, 0, 0)
|
||||||
arg(raidwritebehind_ARG, '\0', "raidwritebehind", int_arg, 0, 0)
|
arg(raidwritebehind_ARG, '\0', "raidwritebehind", number_VAL, 0, 0)
|
||||||
arg(raidwritemostly_ARG, '\0', "raidwritemostly", string_arg, ARG_GROUPABLE, 0)
|
arg(raidwritemostly_ARG, '\0', "raidwritemostly", string_VAL, ARG_GROUPABLE, 0)
|
||||||
arg(readonly_ARG, '\0', "readonly", NULL, 0, 0)
|
arg(readonly_ARG, '\0', "readonly", 0, 0, 0)
|
||||||
arg(refresh_ARG, '\0', "refresh", NULL, 0, 0)
|
arg(refresh_ARG, '\0', "refresh", 0, 0, 0)
|
||||||
arg(removemissing_ARG, '\0', "removemissing", NULL, 0, 0)
|
arg(removemissing_ARG, '\0', "removemissing", 0, 0, 0)
|
||||||
arg(rebuild_ARG, '\0', "rebuild", string_arg, ARG_GROUPABLE, 0)
|
arg(rebuild_ARG, '\0', "rebuild", pv_VAL, ARG_GROUPABLE, 0)
|
||||||
arg(repair_ARG, '\0', "repair", NULL, 0, 0)
|
arg(repair_ARG, '\0', "repair", 0, 0, 0)
|
||||||
arg(replace_ARG, '\0', "replace", string_arg, ARG_GROUPABLE, 0)
|
arg(replace_ARG, '\0', "replace", pv_VAL, ARG_GROUPABLE, 0)
|
||||||
arg(reportformat_ARG, '\0', "reportformat", string_arg, 0, 0)
|
arg(reportformat_ARG, '\0', "reportformat", string_VAL, 0, 0)
|
||||||
arg(restorefile_ARG, '\0', "restorefile", string_arg, 0, 0)
|
arg(restorefile_ARG, '\0', "restorefile", string_VAL, 0, 0)
|
||||||
arg(restoremissing_ARG, '\0', "restoremissing", NULL, 0, 0)
|
arg(restoremissing_ARG, '\0', "restoremissing", 0, 0, 0)
|
||||||
arg(resync_ARG, '\0', "resync", NULL, 0, 0)
|
arg(resync_ARG, '\0', "resync", 0, 0, 0)
|
||||||
arg(rows_ARG, '\0', "rows", NULL, 0, 0)
|
arg(rows_ARG, '\0', "rows", 0, 0, 0)
|
||||||
arg(segments_ARG, '\0', "segments", NULL, 0, 0)
|
arg(segments_ARG, '\0', "segments", 0, 0, 0)
|
||||||
arg(separator_ARG, '\0', "separator", string_arg, 0, 0)
|
arg(separator_ARG, '\0', "separator", string_VAL, 0, 0)
|
||||||
arg(shared_ARG, '\0', "shared", NULL, 0, 0)
|
arg(shared_ARG, '\0', "shared", 0, 0, 0)
|
||||||
arg(sinceversion_ARG, '\0', "sinceversion", string_arg, 0, 0)
|
arg(sinceversion_ARG, '\0', "sinceversion", string_VAL, 0, 0)
|
||||||
arg(split_ARG, '\0', "split", NULL, 0, 0)
|
arg(split_ARG, '\0', "split", 0, 0, 0)
|
||||||
arg(splitcache_ARG, '\0', "splitcache", NULL, 0, 0)
|
arg(splitcache_ARG, '\0', "splitcache", 0, 0, 0)
|
||||||
arg(splitmirrors_ARG, '\0', "splitmirrors", int_arg, 0, 0)
|
arg(splitmirrors_ARG, '\0', "splitmirrors", number_VAL, 0, 0)
|
||||||
arg(splitsnapshot_ARG, '\0', "splitsnapshot", NULL, 0, 0)
|
arg(splitsnapshot_ARG, '\0', "splitsnapshot", 0, 0, 0)
|
||||||
arg(showdeprecated_ARG, '\0', "showdeprecated", NULL, 0, 0)
|
arg(showdeprecated_ARG, '\0', "showdeprecated", 0, 0, 0)
|
||||||
arg(showunsupported_ARG, '\0', "showunsupported", NULL, 0, 0)
|
arg(showunsupported_ARG, '\0', "showunsupported", 0, 0, 0)
|
||||||
arg(stripes_long_ARG, '\0', "stripes", int_arg, 0, 0)
|
arg(stripes_long_ARG, '\0', "stripes", number_VAL, 0, 0)
|
||||||
arg(syncaction_ARG, '\0', "syncaction", string_arg, 0, 0) /* FIXME Use custom validation fn */
|
arg(syncaction_ARG, '\0', "syncaction", string_VAL, 0, 0) /* FIXME Use custom VAL */
|
||||||
arg(sysinit_ARG, '\0', "sysinit", NULL, 0, 0)
|
arg(sysinit_ARG, '\0', "sysinit", 0, 0, 0)
|
||||||
arg(systemid_ARG, '\0', "systemid", string_arg, 0, 0)
|
arg(systemid_ARG, '\0', "systemid", string_VAL, 0, 0)
|
||||||
arg(thinpool_ARG, '\0', "thinpool", string_arg, 0, 0)
|
arg(thinpool_ARG, '\0', "thinpool", lv_VAL, 0, 0)
|
||||||
arg(trackchanges_ARG, '\0', "trackchanges", NULL, 0, 0)
|
arg(trackchanges_ARG, '\0', "trackchanges", 0, 0, 0)
|
||||||
arg(trustcache_ARG, '\0', "trustcache", NULL, 0, 0)
|
arg(trustcache_ARG, '\0', "trustcache", 0, 0, 0)
|
||||||
arg(type_ARG, '\0', "type", segtype_arg, 0, 0)
|
arg(type_ARG, '\0', "type", segtype_VAL, 0, 0)
|
||||||
arg(unbuffered_ARG, '\0', "unbuffered", NULL, 0, 0)
|
arg(unbuffered_ARG, '\0', "unbuffered", 0, 0, 0)
|
||||||
arg(uncache_ARG, '\0', "uncache", NULL, 0, 0)
|
arg(uncache_ARG, '\0', "uncache", 0, 0, 0)
|
||||||
arg(cachepolicy_ARG, '\0', "cachepolicy", string_arg, 0, 0)
|
arg(cachepolicy_ARG, '\0', "cachepolicy", string_VAL, 0, 0)
|
||||||
arg(cachesettings_ARG, '\0', "cachesettings", string_arg, ARG_GROUPABLE, 0)
|
arg(cachesettings_ARG, '\0', "cachesettings", string_VAL, ARG_GROUPABLE, 0)
|
||||||
arg(unconfigured_ARG, '\0', "unconfigured", NULL, 0, 0)
|
arg(unconfigured_ARG, '\0', "unconfigured", 0, 0, 0)
|
||||||
arg(units_ARG, '\0', "units", string_arg, 0, 0)
|
arg(units_ARG, '\0', "units", units_VAL, 0, 0)
|
||||||
arg(unquoted_ARG, '\0', "unquoted", NULL, 0, 0)
|
arg(unquoted_ARG, '\0', "unquoted", 0, 0, 0)
|
||||||
arg(usepolicies_ARG, '\0', "usepolicies", NULL, 0, 0)
|
arg(usepolicies_ARG, '\0', "usepolicies", 0, 0, 0)
|
||||||
arg(validate_ARG, '\0', "validate", NULL, 0, 0)
|
arg(validate_ARG, '\0', "validate", 0, 0, 0)
|
||||||
arg(version_ARG, '\0', "version", NULL, 0, 0)
|
arg(version_ARG, '\0', "version", 0, 0, 0)
|
||||||
arg(vgmetadatacopies_ARG, '\0', "vgmetadatacopies", metadatacopies_arg, 0, 0)
|
arg(vgmetadatacopies_ARG, '\0', "vgmetadatacopies", metadatacopies_VAL, 0, 0)
|
||||||
arg(virtualoriginsize_ARG, '\0', "virtualoriginsize", size_mb_arg, 0, 0)
|
arg(virtualoriginsize_ARG, '\0', "virtualoriginsize", sizemb_VAL, 0, 0)
|
||||||
arg(withsummary_ARG, '\0', "withsummary", NULL, 0, 0)
|
arg(withsummary_ARG, '\0', "withsummary", 0, 0, 0)
|
||||||
arg(withcomments_ARG, '\0', "withcomments", NULL, 0, 0)
|
arg(withcomments_ARG, '\0', "withcomments", 0, 0, 0)
|
||||||
arg(withspaces_ARG, '\0', "withspaces", NULL, 0, 0)
|
arg(withspaces_ARG, '\0', "withspaces", 0, 0, 0)
|
||||||
arg(withversions_ARG, '\0', "withversions", NULL, 0, 0)
|
arg(withversions_ARG, '\0', "withversions", 0, 0, 0)
|
||||||
arg(writebehind_ARG, '\0', "writebehind", int_arg, 0, 0)
|
arg(writebehind_ARG, '\0', "writebehind", number_VAL, 0, 0)
|
||||||
arg(writemostly_ARG, '\0', "writemostly", string_arg, ARG_GROUPABLE, 0)
|
arg(writemostly_ARG, '\0', "writemostly", string_VAL, ARG_GROUPABLE, 0)
|
||||||
|
|
||||||
/* Allow some variations */
|
/* Allow some variations */
|
||||||
arg(allocation_ARG, '\0', "allocation", yes_no_arg, 0, 0)
|
arg(allocation_ARG, '\0', "allocation", bool_VAL, 0, 0)
|
||||||
arg(available_ARG, '\0', "available", activation_arg, 0, 0)
|
arg(available_ARG, '\0', "available", activation_VAL, 0, 0)
|
||||||
arg(resizable_ARG, '\0', "resizable", yes_no_arg, 0, 0)
|
arg(resizable_ARG, '\0', "resizable", bool_VAL, 0, 0)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ... and now the short args.
|
* ... and now the short args.
|
||||||
*/
|
*/
|
||||||
arg(activate_ARG, 'a', "activate", activation_arg, 0, 0)
|
arg(activate_ARG, 'a', "activate", activation_VAL, 0, 0)
|
||||||
arg(all_ARG, 'a', "all", NULL, 0, 0)
|
arg(all_ARG, 'a', "all", 0, 0, 0)
|
||||||
arg(autobackup_ARG, 'A', "autobackup", yes_no_arg, 0, 0)
|
arg(autobackup_ARG, 'A', "autobackup", bool_VAL, 0, 0)
|
||||||
arg(activevolumegroups_ARG, 'A', "activevolumegroups", NULL, 0, 0)
|
arg(activevolumegroups_ARG, 'A', "activevolumegroups", 0, 0, 0)
|
||||||
arg(background_ARG, 'b', "background", NULL, 0, 0)
|
arg(background_ARG, 'b', "background", 0, 0, 0)
|
||||||
arg(backgroundfork_ARG, 'b', "background", NULL, 0, 0)
|
arg(backgroundfork_ARG, 'b', "background", 0, 0, 0)
|
||||||
arg(basevgname_ARG, 'n', "basevgname", string_arg, 0, 0)
|
arg(basevgname_ARG, 'n', "basevgname", string_VAL, 0, 0)
|
||||||
arg(blockdevice_ARG, 'b', "blockdevice", NULL, 0, 0)
|
arg(blockdevice_ARG, 'b', "blockdevice", 0, 0, 0)
|
||||||
arg(chunksize_ARG, 'c', "chunksize", size_kb_arg, 0, 0)
|
arg(chunksize_ARG, 'c', "chunksize", sizekb_VAL, 0, 0)
|
||||||
arg(clustered_ARG, 'c', "clustered", yes_no_arg, 0, 0)
|
arg(clustered_ARG, 'c', "clustered", bool_VAL, 0, 0)
|
||||||
arg(colon_ARG, 'c', "colon", NULL, 0, 0)
|
arg(colon_ARG, 'c', "colon", 0, 0, 0)
|
||||||
arg(columns_ARG, 'C', "columns", NULL, 0, 0)
|
arg(columns_ARG, 'C', "columns", 0, 0, 0)
|
||||||
arg(contiguous_ARG, 'C', "contiguous", yes_no_arg, 0, 0)
|
arg(contiguous_ARG, 'C', "contiguous", bool_VAL, 0, 0)
|
||||||
arg(debug_ARG, 'd', "debug", NULL, ARG_COUNTABLE, 0)
|
arg(debug_ARG, 'd', "debug", 0, ARG_COUNTABLE, 0)
|
||||||
arg(exported_ARG, 'e', "exported", NULL, 0, 0)
|
arg(exported_ARG, 'e', "exported", 0, 0, 0)
|
||||||
arg(physicalextent_ARG, 'E', "physicalextent", NULL, 0, 0)
|
arg(physicalextent_ARG, 'E', "physicalextent", 0, 0, 0)
|
||||||
arg(file_ARG, 'f', "file", string_arg, 0, 0)
|
arg(file_ARG, 'f', "file", string_VAL, 0, 0)
|
||||||
arg(force_ARG, 'f', "force", NULL, ARG_COUNTABLE, 0)
|
arg(force_ARG, 'f', "force", 0, ARG_COUNTABLE, 0)
|
||||||
arg(full_ARG, 'f', "full", NULL, 0, 0)
|
arg(full_ARG, 'f', "full", 0, 0, 0)
|
||||||
arg(help_ARG, 'h', "help", NULL, 0, 0)
|
arg(help_ARG, 'h', "help", 0, ARG_COUNTABLE, 0)
|
||||||
arg(cache_ARG, 'H', "cache", NULL, 0, 0)
|
arg(cache_ARG, 'H', "cache", 0, 0, 0)
|
||||||
arg(history_ARG, 'H', "history", NULL, 0, 0)
|
arg(history_ARG, 'H', "history", 0, 0, 0)
|
||||||
arg(help2_ARG, '?', "", NULL, 0, 0)
|
arg(help2_ARG, '?', "", 0, 0, 0)
|
||||||
arg(import_ARG, 'i', "import", NULL, 0, 0)
|
arg(import_ARG, 'i', "import", 0, 0, 0)
|
||||||
arg(interval_ARG, 'i', "interval", int_arg, 0, 0)
|
arg(interval_ARG, 'i', "interval", number_VAL, 0, 0)
|
||||||
arg(iop_version_ARG, 'i', "iop_version", NULL, 0, 0)
|
arg(iop_version_ARG, 'i', "iop_version", 0, 0, 0)
|
||||||
arg(stripes_ARG, 'i', "stripes", int_arg, 0, 0)
|
arg(stripes_ARG, 'i', "stripes", number_VAL, 0, 0)
|
||||||
arg(stripesize_ARG, 'I', "stripesize", size_kb_arg, 0, 0)
|
arg(stripesize_ARG, 'I', "stripesize", sizekb_VAL, 0, 0)
|
||||||
arg(logicalvolume_ARG, 'l', "logicalvolume", int_arg, 0, 0)
|
arg(logicalvolume_ARG, 'l', "logicalvolume", number_VAL, 0, 0)
|
||||||
arg(maxlogicalvolumes_ARG, 'l', "maxlogicalvolumes", int_arg, 0, 0)
|
arg(maxlogicalvolumes_ARG, 'l', "maxlogicalvolumes", number_VAL, 0, 0)
|
||||||
arg(extents_ARG, 'l', "extents", int_arg_with_sign_and_percent, 0, 0)
|
arg(extents_ARG, 'l', "extents", numsignedper_VAL, 0, 0)
|
||||||
arg(list_ARG, 'l', "list", NULL, 0, 0)
|
arg(list_ARG, 'l', "list", 0, 0, 0)
|
||||||
arg(lvmpartition_ARG, 'l', "lvmpartition", NULL, 0, 0)
|
arg(lvmpartition_ARG, 'l', "lvmpartition", 0, 0, 0)
|
||||||
arg(logicalextent_ARG, 'L', "logicalextent", int_arg_with_sign, 0, 0)
|
arg(size_ARG, 'L', "size", sizemb_VAL, 0, 0)
|
||||||
arg(size_ARG, 'L', "size", size_mb_arg, 0, 0)
|
arg(persistent_ARG, 'M', "persistent", bool_VAL, 0, 0)
|
||||||
arg(persistent_ARG, 'M', "persistent", yes_no_arg, 0, 0)
|
arg(major_ARG, 'j', "major", number_VAL, ARG_GROUPABLE, 0)
|
||||||
arg(major_ARG, 'j', "major", int_arg, ARG_GROUPABLE, 0)
|
arg(setactivationskip_ARG, 'k', "setactivationskip", bool_VAL, 0, 0)
|
||||||
arg(setactivationskip_ARG, 'k', "setactivationskip", yes_no_arg, 0, 0)
|
arg(ignoreactivationskip_ARG, 'K', "ignoreactivationskip", 0, 0, 0)
|
||||||
arg(ignoreactivationskip_ARG, 'K', "ignoreactivationskip", NULL, 0, 0)
|
arg(maps_ARG, 'm', "maps", 0, 0, 0)
|
||||||
arg(maps_ARG, 'm', "maps", NULL, 0, 0)
|
arg(mirrors_ARG, 'm', "mirrors", numsigned_VAL, 0, 0)
|
||||||
arg(mirrors_ARG, 'm', "mirrors", int_arg_with_sign, 0, 0)
|
arg(metadatatype_ARG, 'M', "metadatatype", metadatatype_VAL, 0, 0)
|
||||||
arg(metadatatype_ARG, 'M', "metadatatype", metadatatype_arg, 0, 0)
|
arg(name_ARG, 'n', "name", string_VAL, 0, 0)
|
||||||
arg(name_ARG, 'n', "name", string_arg, 0, 0)
|
arg(nofsck_ARG, 'n', "nofsck", 0, 0, 0)
|
||||||
arg(nofsck_ARG, 'n', "nofsck", NULL, 0, 0)
|
arg(novolumegroup_ARG, 'n', "novolumegroup", 0, 0, 0)
|
||||||
arg(novolumegroup_ARG, 'n', "novolumegroup", NULL, 0, 0)
|
arg(oldpath_ARG, 'n', "oldpath", 0, 0, 0)
|
||||||
arg(oldpath_ARG, 'n', "oldpath", NULL, 0, 0)
|
arg(options_ARG, 'o', "options", string_VAL, ARG_GROUPABLE, 0)
|
||||||
arg(options_ARG, 'o', "options", string_arg, ARG_GROUPABLE, 0)
|
arg(sort_ARG, 'O', "sort", string_VAL, ARG_GROUPABLE, 0)
|
||||||
arg(sort_ARG, 'O', "sort", string_arg, ARG_GROUPABLE, 0)
|
arg(maxphysicalvolumes_ARG, 'p', "maxphysicalvolumes", number_VAL, 0, 0)
|
||||||
arg(maxphysicalvolumes_ARG, 'p', "maxphysicalvolumes", int_arg, 0, 0)
|
arg(permission_ARG, 'p', "permission", permission_VAL, 0, 0)
|
||||||
arg(permission_ARG, 'p', "permission", permission_arg, 0, 0)
|
arg(partial_ARG, 'P', "partial", 0, 0, 0)
|
||||||
arg(partial_ARG, 'P', "partial", NULL, 0, 0)
|
arg(physicalvolume_ARG, 'P', "physicalvolume", 0, 0, 0)
|
||||||
arg(physicalvolume_ARG, 'P', "physicalvolume", NULL, 0, 0)
|
arg(quiet_ARG, 'q', "quiet", 0, ARG_COUNTABLE, 0)
|
||||||
arg(quiet_ARG, 'q', "quiet", NULL, ARG_COUNTABLE, 0)
|
arg(readahead_ARG, 'r', "readahead", readahead_VAL, 0, 0)
|
||||||
arg(readahead_ARG, 'r', "readahead", readahead_arg, 0, 0)
|
arg(resizefs_ARG, 'r', "resizefs", 0, 0, 0)
|
||||||
arg(resizefs_ARG, 'r', "resizefs", NULL, 0, 0)
|
arg(reset_ARG, 'R', "reset", 0, 0, 0)
|
||||||
arg(reset_ARG, 'R', "reset", NULL, 0, 0)
|
arg(regionsize_ARG, 'R', "regionsize", sizemb_VAL, 0, 0)
|
||||||
arg(regionsize_ARG, 'R', "regionsize", size_mb_arg, 0, 0)
|
arg(physicalextentsize_ARG, 's', "physicalextentsize", sizemb_VAL, 0, 0)
|
||||||
arg(physicalextentsize_ARG, 's', "physicalextentsize", size_mb_arg, 0, 0)
|
arg(snapshot_ARG, 's', "snapshot", 0, 0, 0)
|
||||||
arg(snapshot_ARG, 's', "snapshot", NULL, 0, 0)
|
arg(short_ARG, 's', "short", 0, 0, 0)
|
||||||
arg(short_ARG, 's', "short", NULL, 0, 0)
|
arg(stdin_ARG, 's', "stdin", 0, 0, 0)
|
||||||
arg(stdin_ARG, 's', "stdin", NULL, 0, 0)
|
arg(select_ARG, 'S', "select", string_VAL, ARG_GROUPABLE, 0)
|
||||||
arg(select_ARG, 'S', "select", string_arg, ARG_GROUPABLE, 0)
|
arg(test_ARG, 't', "test", 0, 0, 0)
|
||||||
arg(test_ARG, 't', "test", NULL, 0, 0)
|
arg(thin_ARG, 'T', "thin", 0, 0, 0)
|
||||||
arg(thin_ARG, 'T', "thin", NULL, 0, 0)
|
arg(uuid_ARG, 'u', "uuid", 0, 0, 0)
|
||||||
arg(uuid_ARG, 'u', "uuid", NULL, 0, 0)
|
arg(uuidstr_ARG, 'u', "uuid", string_VAL, 0, 0)
|
||||||
arg(uuidstr_ARG, 'u', "uuid", string_arg, 0, 0)
|
arg(uuidlist_ARG, 'U', "uuidlist", 0, 0, 0)
|
||||||
arg(uuidlist_ARG, 'U', "uuidlist", NULL, 0, 0)
|
arg(verbose_ARG, 'v', "verbose", 0, ARG_COUNTABLE, 0)
|
||||||
arg(verbose_ARG, 'v', "verbose", NULL, ARG_COUNTABLE, 0)
|
arg(volumegroup_ARG, 'V', "volumegroup", 0, 0, 0)
|
||||||
arg(volumegroup_ARG, 'V', "volumegroup", NULL, 0, 0)
|
arg(virtualsize_ARG, 'V', "virtualsize", sizemb_VAL, 0, 0)
|
||||||
arg(virtualsize_ARG, 'V', "virtualsize", size_mb_arg, 0, 0)
|
arg(wipesignatures_ARG, 'W', "wipesignatures", bool_VAL, 0, 0)
|
||||||
arg(wipesignatures_ARG, 'W', "wipesignatures", yes_no_arg, 0, 0)
|
arg(allocatable_ARG, 'x', "allocatable", bool_VAL, 0, 0)
|
||||||
arg(allocatable_ARG, 'x', "allocatable", yes_no_arg, 0, 0)
|
arg(resizeable_ARG, 'x', "resizeable", bool_VAL, 0, 0)
|
||||||
arg(resizeable_ARG, 'x', "resizeable", yes_no_arg, 0, 0)
|
arg(yes_ARG, 'y', "yes", 0, 0, 0)
|
||||||
arg(yes_ARG, 'y', "yes", NULL, 0, 0)
|
arg(zero_ARG, 'Z', "zero", bool_VAL, 0, 0)
|
||||||
arg(zero_ARG, 'Z', "zero", yes_no_arg, 0, 0)
|
|
||||||
|
|
||||||
/* this should always be last */
|
/* this should always be last */
|
||||||
arg(ARG_COUNT, '-', "", NULL, 0, 0)
|
arg(ARG_COUNT, '-', "", 0, 0, 0)
|
||||||
/* *INDENT-ON* */
|
/* *INDENT-ON* */
|
||||||
|
3
tools/command-lines-count.h
Normal file
3
tools/command-lines-count.h
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
/* Do not edit. This file is generated by scripts/create-commands */
|
||||||
|
/* using command definitions from scripts/command-lines.in */
|
||||||
|
#define COMMAND_COUNT 144
|
7613
tools/command-lines.h
Normal file
7613
tools/command-lines.h
Normal file
File diff suppressed because it is too large
Load Diff
156
tools/command.h
Normal file
156
tools/command.h
Normal file
@ -0,0 +1,156 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
|
||||||
|
* Copyright (C) 2004-2015 Red Hat, Inc. All rights reserved.
|
||||||
|
*
|
||||||
|
* This file is part of LVM2.
|
||||||
|
*
|
||||||
|
* This copyrighted material is made available to anyone wishing to use,
|
||||||
|
* modify, copy, or redistribute it subject to the terms and conditions
|
||||||
|
* of the GNU Lesser General Public License v.2.1.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Lesser General Public License
|
||||||
|
* along with this program; if not, write to the Free Software Foundation,
|
||||||
|
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _LVM_COMMAND_H
|
||||||
|
#define _LVM_COMMAND_H
|
||||||
|
|
||||||
|
struct cmd_context;
|
||||||
|
|
||||||
|
/* command functions */
|
||||||
|
typedef int (*command_fn) (struct cmd_context * cmd, int argc, char **argv);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Command defintion
|
||||||
|
*
|
||||||
|
* A command is defined in terms of a command name,
|
||||||
|
* required options (+args), optional options (+args),
|
||||||
|
* required positional args, optional positional args.
|
||||||
|
*
|
||||||
|
* A positional arg always has non-zero pos_arg.def.types.
|
||||||
|
* The first positional arg has pos_arg.pos of 1.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* arg_def flags */
|
||||||
|
#define ARG_DEF_FLAG_NEW 1 << 0
|
||||||
|
#define ARG_DEF_FLAG_MAY_REPEAT 1 << 1
|
||||||
|
|
||||||
|
/* arg_def lv_types */
|
||||||
|
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,
|
||||||
|
ARG_DEF_LV_LAST = 1 << 15,
|
||||||
|
};
|
||||||
|
|
||||||
|
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 {
|
||||||
|
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_ */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Description of an option and the value that follows it. */
|
||||||
|
|
||||||
|
struct opt_arg {
|
||||||
|
int opt; /* option, e.g. foo_ARG */
|
||||||
|
struct arg_def def; /* defines accepted values */
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Description of a position and the value that exists there. */
|
||||||
|
|
||||||
|
struct pos_arg {
|
||||||
|
int pos; /* position, e.g. first is 1 */
|
||||||
|
struct arg_def def; /* defines accepted values */
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CMD_RO_ARGS needs to accomodate a list of options,
|
||||||
|
* of which one is required after which the rest are
|
||||||
|
* optional.
|
||||||
|
*/
|
||||||
|
#define CMD_RO_ARGS 64 /* required opt args */
|
||||||
|
#define CMD_OO_ARGS 150 /* optional opt args */
|
||||||
|
#define CMD_RP_ARGS 8 /* required positional args */
|
||||||
|
#define CMD_OP_ARGS 8 /* optional positional args */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* one or more from required_opt_args is required,
|
||||||
|
* then the rest are optional.
|
||||||
|
*/
|
||||||
|
#define CMD_FLAG_ONE_REQUIRED_OPT 1
|
||||||
|
|
||||||
|
/* a register of the lvm commands */
|
||||||
|
struct command {
|
||||||
|
const char *name;
|
||||||
|
const char *desc; /* specific command description from command-lines.h */
|
||||||
|
const char *usage;
|
||||||
|
|
||||||
|
struct command_name *cname;
|
||||||
|
command_fn fn;
|
||||||
|
|
||||||
|
unsigned int flags; /* copied from command_name.flags from commands.h */
|
||||||
|
|
||||||
|
unsigned int cmd_flags; /* CMD_FLAG_ */
|
||||||
|
|
||||||
|
/* definitions of opt/pos args */
|
||||||
|
|
||||||
|
/* required args following an --opt */
|
||||||
|
struct opt_arg required_opt_args[CMD_RO_ARGS];
|
||||||
|
|
||||||
|
/* optional args following an --opt */
|
||||||
|
struct opt_arg optional_opt_args[CMD_OO_ARGS];
|
||||||
|
|
||||||
|
/* required positional args */
|
||||||
|
struct pos_arg required_pos_args[CMD_RP_ARGS];
|
||||||
|
|
||||||
|
/* optional positional args */
|
||||||
|
struct pos_arg optional_pos_args[CMD_OP_ARGS];
|
||||||
|
|
||||||
|
int ro_count;
|
||||||
|
int oo_count;
|
||||||
|
int rp_count;
|
||||||
|
int op_count;
|
||||||
|
|
||||||
|
/* used for processing current position */
|
||||||
|
int pos_count;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct command_name {
|
||||||
|
const char *name;
|
||||||
|
const char *desc; /* general command description from commands.h */
|
||||||
|
unsigned int flags;
|
||||||
|
|
||||||
|
/* union of {required,optional}_opt_args for all commands with this name */
|
||||||
|
int valid_args[ARG_COUNT];
|
||||||
|
int num_args;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
1428
tools/commands.h
1428
tools/commands.h
File diff suppressed because it is too large
Load Diff
32
tools/lvm.c
32
tools/lvm.c
@ -45,9 +45,9 @@ static char *_list_cmds(const char *text, int state)
|
|||||||
len = strlen(text);
|
len = strlen(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (i < _cmdline->num_commands)
|
while (i < _cmdline->num_command_names)
|
||||||
if (!strncmp(text, _cmdline->commands[i++].name, len))
|
if (!strncmp(text, _cmdline->command_names[i++].name, len))
|
||||||
return strdup(_cmdline->commands[i - 1].name);
|
return strdup(_cmdline->command_names[i - 1].name);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
@ -57,7 +57,7 @@ static char *_list_args(const char *text, int state)
|
|||||||
{
|
{
|
||||||
static int match_no = 0;
|
static int match_no = 0;
|
||||||
static size_t len = 0;
|
static size_t len = 0;
|
||||||
static struct command *com;
|
static struct command_name *cname;
|
||||||
|
|
||||||
/* Initialise if this is a new completion attempt */
|
/* Initialise if this is a new completion attempt */
|
||||||
if (!state) {
|
if (!state) {
|
||||||
@ -65,40 +65,40 @@ static char *_list_args(const char *text, int state)
|
|||||||
int j;
|
int j;
|
||||||
|
|
||||||
match_no = 0;
|
match_no = 0;
|
||||||
com = NULL;
|
cname = NULL;
|
||||||
len = strlen(text);
|
len = strlen(text);
|
||||||
|
|
||||||
/* Find start of first word in line buffer */
|
/* Find start of first word in line buffer */
|
||||||
while (isspace(*s))
|
while (isspace(*s))
|
||||||
s++;
|
s++;
|
||||||
|
|
||||||
/* Look for word in list of commands */
|
/* Look for word in list of command names */
|
||||||
for (j = 0; j < _cmdline->num_commands; j++) {
|
for (j = 0; j < _cmdline->num_command_names; j++) {
|
||||||
const char *p;
|
const char *p;
|
||||||
char *q = s;
|
char *q = s;
|
||||||
|
|
||||||
p = _cmdline->commands[j].name;
|
p = _cmdline->command_names[j].name;
|
||||||
while (*p == *q) {
|
while (*p == *q) {
|
||||||
p++;
|
p++;
|
||||||
q++;
|
q++;
|
||||||
}
|
}
|
||||||
if ((!*p) && *q == ' ') {
|
if ((!*p) && *q == ' ') {
|
||||||
com = _cmdline->commands + j;
|
cname = _cmdline->command_names + j;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!com)
|
if (!cname)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
/* Short form arguments */
|
/* Short form arguments */
|
||||||
if (len < 3) {
|
if (len < 3) {
|
||||||
while (match_no < com->num_args) {
|
while (match_no < cname->num_args) {
|
||||||
char s[3];
|
char s[3];
|
||||||
char c;
|
char c;
|
||||||
if (!(c = (_cmdline->arg_props +
|
if (!(c = (_cmdline->arg_props +
|
||||||
com->valid_args[match_no++])->short_arg))
|
cname->valid_args[match_no++])->short_arg))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
sprintf(s, "-%c", c);
|
sprintf(s, "-%c", c);
|
||||||
@ -108,13 +108,13 @@ static char *_list_args(const char *text, int state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Long form arguments */
|
/* Long form arguments */
|
||||||
if (match_no < com->num_args)
|
if (match_no < cname->num_args)
|
||||||
match_no = com->num_args;
|
match_no = cname->num_args;
|
||||||
|
|
||||||
while (match_no - com->num_args < com->num_args) {
|
while (match_no - cname->num_args < cname->num_args) {
|
||||||
const char *l;
|
const char *l;
|
||||||
l = (_cmdline->arg_props +
|
l = (_cmdline->arg_props +
|
||||||
com->valid_args[match_no++ - com->num_args])->long_arg;
|
cname->valid_args[match_no++ - cname->num_args])->long_arg;
|
||||||
if (*(l + 2) && !strncmp(text, l, len))
|
if (*(l + 2) && !strncmp(text, l, len))
|
||||||
return strdup(l);
|
return strdup(l);
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,11 @@
|
|||||||
struct cmd_context;
|
struct cmd_context;
|
||||||
|
|
||||||
struct cmdline_context {
|
struct cmdline_context {
|
||||||
struct arg_props *arg_props;
|
struct arg_props *arg_props;
|
||||||
struct command *commands;
|
struct command *commands;
|
||||||
int num_commands;
|
int num_commands;
|
||||||
int commands_size;
|
struct command_name *command_names;
|
||||||
|
int num_command_names;
|
||||||
};
|
};
|
||||||
|
|
||||||
int lvm2_main(int argc, char **argv);
|
int lvm2_main(int argc, char **argv);
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -50,20 +50,27 @@
|
|||||||
#define CMD_LEN 256
|
#define CMD_LEN 256
|
||||||
#define MAX_ARGS 64
|
#define MAX_ARGS 64
|
||||||
|
|
||||||
/* command functions */
|
/* define the enums for the values accepted by command line --options */
|
||||||
typedef int (*command_fn) (struct cmd_context * cmd, int argc, char **argv);
|
enum {
|
||||||
|
#define val(a, b, c, d) a ,
|
||||||
|
#include "vals.h"
|
||||||
|
#undef val
|
||||||
|
};
|
||||||
|
|
||||||
#define xx(a, b...) int a(struct cmd_context *cmd, int argc, char **argv);
|
/* define the enums for the command line --options */
|
||||||
#include "commands.h"
|
|
||||||
#undef xx
|
|
||||||
|
|
||||||
/* define the enums for the command line switches */
|
|
||||||
enum {
|
enum {
|
||||||
#define arg(a, b, c, d, e, f) a ,
|
#define arg(a, b, c, d, e, f) a ,
|
||||||
#include "args.h"
|
#include "args.h"
|
||||||
#undef arg
|
#undef arg
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/* command functions */
|
||||||
|
#define xx(a, b...) int a(struct cmd_context *cmd, int argc, char **argv);
|
||||||
|
#include "commands.h"
|
||||||
|
#undef xx
|
||||||
|
|
||||||
|
#include "command.h"
|
||||||
|
|
||||||
#define ARG_COUNTABLE 0x00000001 /* E.g. -vvvv */
|
#define ARG_COUNTABLE 0x00000001 /* E.g. -vvvv */
|
||||||
#define ARG_GROUPABLE 0x00000002 /* E.g. --addtag */
|
#define ARG_GROUPABLE 0x00000002 /* E.g. --addtag */
|
||||||
|
|
||||||
@ -79,13 +86,13 @@ struct arg_values {
|
|||||||
/* void *ptr; // Currently not used. */
|
/* void *ptr; // Currently not used. */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* a global table of possible arguments */
|
/* a global table of possible --option's */
|
||||||
struct arg_props {
|
struct arg_props {
|
||||||
|
int arg_enum; /* foo_ARG from args.h */
|
||||||
const char short_arg;
|
const char short_arg;
|
||||||
char _padding[7];
|
char _padding[7];
|
||||||
const char *long_arg;
|
const char *long_arg;
|
||||||
|
int val_enum; /* foo_VAL from vals.h */
|
||||||
int (*fn) (struct cmd_context *cmd, struct arg_values *av);
|
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
uint32_t prio;
|
uint32_t prio;
|
||||||
};
|
};
|
||||||
@ -96,6 +103,14 @@ struct arg_value_group_list {
|
|||||||
uint32_t prio;
|
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 CACHE_VGMETADATA 0x00000001
|
||||||
#define PERMITTED_READ_ONLY 0x00000002
|
#define PERMITTED_READ_ONLY 0x00000002
|
||||||
/* Process all VGs if none specified on the command line. */
|
/* Process all VGs if none specified on the command line. */
|
||||||
@ -118,19 +133,6 @@ struct arg_value_group_list {
|
|||||||
#define ENABLE_DUPLICATE_DEVS 0x00000400
|
#define ENABLE_DUPLICATE_DEVS 0x00000400
|
||||||
/* Command does not accept tags as args. */
|
/* Command does not accept tags as args. */
|
||||||
#define DISALLOW_TAG_ARGS 0x00000800
|
#define DISALLOW_TAG_ARGS 0x00000800
|
||||||
|
|
||||||
/* a register of the lvm commands */
|
|
||||||
struct command {
|
|
||||||
const char *name;
|
|
||||||
const char *desc;
|
|
||||||
const char *usage;
|
|
||||||
command_fn fn;
|
|
||||||
|
|
||||||
unsigned flags;
|
|
||||||
|
|
||||||
int num_args;
|
|
||||||
int *valid_args;
|
|
||||||
};
|
|
||||||
|
|
||||||
void usage(const char *name);
|
void usage(const char *name);
|
||||||
|
|
||||||
|
135
tools/vals.h
Normal file
135
tools/vals.h
Normal file
@ -0,0 +1,135 @@
|
|||||||
|
|
||||||
|
/*
|
||||||
|
* Define value types which describe values accepted
|
||||||
|
* by the --option's in args.h, and can also describe
|
||||||
|
* the values accepted as positional args.
|
||||||
|
*
|
||||||
|
* Previously, accepted values were only "described"
|
||||||
|
* by identifying the parsing function to use.
|
||||||
|
*
|
||||||
|
* Some standard val types are used by many options,
|
||||||
|
* e.g. many options (aa_ARG, bb_ARG, cc_ARG) all
|
||||||
|
* accept a number_VAL.
|
||||||
|
*
|
||||||
|
* Other special val types are used by only one option,
|
||||||
|
* e.g. only mirrorlog_ARG accepts a mirrorlog_VAL.
|
||||||
|
* This typically means that there are some 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".
|
||||||
|
*
|
||||||
|
* Most of the val types defined here are used after
|
||||||
|
* --option's, and are referenced in foo_ARG entries
|
||||||
|
* in args.h. But, some val types are only used to
|
||||||
|
* represent positional values in command definitions,
|
||||||
|
* e.g. vg_VAL.
|
||||||
|
*
|
||||||
|
* 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 shown in val() 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 recognized
|
||||||
|
* words 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, perhaps in struct val_props.
|
||||||
|
*
|
||||||
|
* The usage text for an option is not always the full
|
||||||
|
* set of words accepted for an option, but may be a
|
||||||
|
* subset. i.e. an outdated word that no longer does
|
||||||
|
* anything may not be shown, but may still be recognized
|
||||||
|
* and ignored, or an option that shouldn't be used in
|
||||||
|
* general isn't shown to avoid suggesting it.
|
||||||
|
* e.g. for --activate we show the most common "y|n|ay"
|
||||||
|
* without showing the lvmlockd variations "ey|sy" which
|
||||||
|
* are not applicable in general.
|
||||||
|
*
|
||||||
|
* FIXME: are there some specialized or irrelevant
|
||||||
|
* options included in the usage text below that should
|
||||||
|
* be removed? Should "lvm1" be removed?
|
||||||
|
*
|
||||||
|
* For Number args that take optional units, a full usage
|
||||||
|
* could be "Number[bBsSkKmMgGtTpPeE]" (with implied |),
|
||||||
|
* but repeating this full specification produces cluttered
|
||||||
|
* output, and doesn't indicate which unit is the default.
|
||||||
|
* "Number[units]" would be cleaner, as would a subset of
|
||||||
|
* common units, e.g. "Number[kmg...]", but neither helps
|
||||||
|
* with default. "Number[k|unit]" and "Number[m|unit]" show
|
||||||
|
* the default, and "unit" indicates that other units
|
||||||
|
* are possible without listing them all. This also
|
||||||
|
* suggests using the preferred lower case letters, because
|
||||||
|
* --size and other option args treat upper/lower letters
|
||||||
|
* the same, all as 1024 SI base. For this reason, we
|
||||||
|
* should avoid suggesting the upper case letters.
|
||||||
|
*/
|
||||||
|
|
||||||
|
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[k|unit]")
|
||||||
|
val(sizemb_VAL, size_mb_arg, "SizeMB", "Number[m|unit]")
|
||||||
|
val(numsigned_VAL, int_arg_with_sign, "SNumber", "[+|-]Number")
|
||||||
|
val(numsignedper_VAL, int_arg_with_sign_and_percent, "SNumberP", "[+|-]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
|
||||||
|
*/
|
||||||
|
|
Loading…
Reference in New Issue
Block a user