1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-09-10 21:44:27 +03:00

Compare commits

...

2 Commits

Author SHA1 Message Date
Bryn M. Reeves
59a6fc0e4c dmstats: allow -c<count>
When dmsetup is run using the dmstats alias allow the short option
-c to be used to specify a count. This causes a change of behaviour
if dmsetup is called without spaces between options:

 # dmsetup info -cvvv

Now will not produce verbose output since the 'vvv' is considered
to be an optional argument to -c: preserving the former behaviour
would require allowing alternative optstrings for different
dmsetup command types.
2015-09-02 23:01:14 +01:00
Bryn M. Reeves
f64da7c628 dmstats: accept -c as an abbreviation for --count 2015-09-02 22:59:18 +01:00
2 changed files with 18 additions and 9 deletions

View File

@@ -1,4 +1,4 @@
eTH DMSTATS 8 "Jul 25 2015" "Linux" "MAINTENANCE COMMANDS"
.TH DMSTATS 8 "Jul 25 2015" "Linux" "MAINTENANCE COMMANDS"
.SH NAME
dmstats \(em device-mapper statistics management
.SH SYNOPSIS
@@ -62,7 +62,7 @@ dmstats \(em device-mapper statistics management
.RI [ device_name ]
.RB [ \-\-interval
.IR seconds ]
.RB [ \-\-count
.RB [ -c | \-\-count
.IR count ]
.RB [ \-\-units
.IR units ]
@@ -105,7 +105,7 @@ dmstats \(em device-mapper statistics management
.RI [ device_name ]
.RB [ \-\-interval
.IR seconds ]
.RB [ \-\-count
.RB [ \-c | \-\-count
.IR count ]
.RB [ \-\-units
.IR units ]
@@ -174,7 +174,7 @@ Specify auxilliary data (a string) to be stored with a new region.
.B \-\-clear
When printing statistics counters, also atomically reset them to zero.
.TP
.B \-\-count \fIcount
.B \-c | \-\-count \fIcount
Specify the iteration count for repeating reports. If the count
argument is zero reports will continue to repeat until interrupted.
.TP
@@ -367,7 +367,7 @@ the list of report fields.
.RB [ \-\-allprograms ]
.RB [ \-\-interval
.IR seconds ]
.RB [ \-\-count
.RB [ \-c | \-\-count
.IR count ]
.RB [ \-\-units
.IR unit ]
@@ -428,7 +428,7 @@ present regions.
.RB [ \-\-allprograms ]
.RB [ \-\-interval
.IR seconds ]
.RB [ \-\-count
.RB [ \-c | \-\-count
.IR count ]
.RB [ \-\-units
.IR unit ]

View File

@@ -5681,7 +5681,7 @@ static int _process_switches(int *argcp, char ***argvp, const char *dev_dir)
{"auxdata", 1, &ind, AUX_DATA_ARG},
{"checks", 0, &ind, CHECKS_ARG},
{"clear", 0, &ind, CLEAR_ARG},
{"columns", 0, &ind, COLS_ARG},
{"columns", 1, &ind, COLS_ARG},
{"count", 1, &ind, COUNT_ARG},
{"deferred", 0, &ind, DEFERRED_ARG},
{"select", 1, &ind, SELECT_ARG},
@@ -5805,7 +5805,7 @@ static int _process_switches(int *argcp, char ***argvp, const char *dev_dir)
optarg = 0;
optind = OPTIND_INIT;
while ((ind = -1, c = GETOPTLONG_FN(*argcp, *argvp, "cCfG:hj:m:M:no:O:rS:u:U:vy",
while ((ind = -1, c = GETOPTLONG_FN(*argcp, *argvp, "c::C::fG:hj:m:M:no:O:rS:u:U:vy",
long_options, NULL)) != -1) {
if (ind == ALL_DEVICES_ARG)
_switches[ALL_DEVICES_ARG]++;
@@ -5835,8 +5835,17 @@ static int _process_switches(int *argcp, char ***argvp, const char *dev_dir)
}
if (ind == CLEAR_ARG)
_switches[CLEAR_ARG]++;
if (c == 'c' || c == 'C' || ind == COLS_ARG)
if (c == 'c' || c == 'C' || ind == COLS_ARG) {
_switches[COLS_ARG]++;
if (optarg && _base_command_type == STATS_TYPE) {
_switches[COUNT_ARG]++;
_int_args[COUNT_ARG] = atoi(optarg);
if (_int_args[COUNT_ARG] < 0) {
log_error("Count must be zero or greater.");
return 0;
}
}
}
if (c == 'f' || ind == FORCE_ARG)
_switches[FORCE_ARG]++;
if (c == 'r' || ind == READ_ONLY)