mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
man: use Size variable for a number with unit
Define a separate variable type Size to represent a number that takes an optional UNIT.
This commit is contained in:
parent
189fa64793
commit
74ba326007
@ -987,7 +987,7 @@ arg(logicalvolume_ARG, 'l', "logicalvolume", uint32_VAL, 0, 0,
|
|||||||
arg(maxlogicalvolumes_ARG, 'l', "maxlogicalvolumes", uint32_VAL, 0, 0,
|
arg(maxlogicalvolumes_ARG, 'l', "maxlogicalvolumes", uint32_VAL, 0, 0,
|
||||||
"Sets the maximum number of LVs allowed in a VG.\n")
|
"Sets the maximum number of LVs allowed in a VG.\n")
|
||||||
|
|
||||||
arg(extents_ARG, 'l', "extents", numsignedper_VAL, 0, 0,
|
arg(extents_ARG, 'l', "extents", extents_VAL, 0, 0,
|
||||||
"#lvcreate\n"
|
"#lvcreate\n"
|
||||||
"Specifies the size of the new LV in logical extents.\n"
|
"Specifies the size of the new LV in logical extents.\n"
|
||||||
"The --size and --extents options are alternate methods of specifying size.\n"
|
"The --size and --extents options are alternate methods of specifying size.\n"
|
||||||
|
@ -79,7 +79,7 @@ static inline int size_mb_arg_with_percent(struct cmd_context *cmd, struct arg_v
|
|||||||
static inline int int_arg(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
static inline int int_arg(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
||||||
static inline int uint32_arg(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
static inline int uint32_arg(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
||||||
static inline int int_arg_with_sign(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
static inline int int_arg_with_sign(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
||||||
static inline int int_arg_with_sign_and_percent(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
static inline int extents_arg(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
||||||
static inline int major_arg(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
static inline int major_arg(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
||||||
static inline int minor_arg(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
static inline int minor_arg(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
||||||
static inline int string_arg(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
static inline int string_arg(struct cmd_context *cmd, struct arg_values *av) { return 0; }
|
||||||
@ -1792,13 +1792,13 @@ static void print_val_man(const char *str)
|
|||||||
* that isn't already obvious.
|
* that isn't already obvious.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (!strcmp(str, "Number[k|UNIT]")) {
|
if (!strcmp(str, "Size[k|UNIT]")) {
|
||||||
printf("\\fINumber\\fP[k|UNIT]");
|
printf("\\fISize\\fP[k|UNIT]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(str, "Number[m|UNIT]")) {
|
if (!strcmp(str, "Size[m|UNIT]")) {
|
||||||
printf("\\fINumber\\fP[m|UNIT]");
|
printf("\\fISize\\fP[m|UNIT]");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2807,16 +2807,21 @@ void print_man_all_positions_desc(struct command_name *cname)
|
|||||||
printf(".br\n");
|
printf(".br\n");
|
||||||
printf("See the option description for information about the string content.\n");
|
printf("See the option description for information about the string content.\n");
|
||||||
|
|
||||||
/* Nearly every command uses a number arg somewhere. */
|
/*
|
||||||
|
* We could possibly check if the command accepts any option that
|
||||||
|
* uses Size, and only print this in those cases, but this seems
|
||||||
|
* so common that we should probably always print it.
|
||||||
|
*/
|
||||||
|
|
||||||
printf("\n.HP\n");
|
printf("\n.HP\n");
|
||||||
printf("\\fINumber\\fP, UNIT");
|
printf("\\fISize\\fP[UNIT]");
|
||||||
printf("\n");
|
printf("\n");
|
||||||
printf(".br\n");
|
printf(".br\n");
|
||||||
printf("Input units are always treated as base two values, regardless of unit\n"
|
printf("Size is an input number that accepts an optional unit.\n"
|
||||||
|
"Input units are always treated as base two values, regardless of\n"
|
||||||
"capitalization, e.g. 'k' and 'K' both refer to 1024.\n"
|
"capitalization, e.g. 'k' and 'K' both refer to 1024.\n"
|
||||||
"The default input unit is specified by letter, followed by |UNIT\n"
|
"The default input unit is specified by letter, followed by |UNIT.\n"
|
||||||
"which represents other possible input units: \\fBbBsSkKmMgGtTpPeE\\fP.\n"
|
"UNIT represents other possible input units: \\fBbBsSkKmMgGtTpPeE\\fP.\n"
|
||||||
"(This should not be confused with the output control --units, where\n"
|
"(This should not be confused with the output control --units, where\n"
|
||||||
"capital letters mean multiple of 1000.)\n");
|
"capital letters mean multiple of 1000.)\n");
|
||||||
|
|
||||||
|
@ -672,7 +672,7 @@ int int_arg_with_sign(struct cmd_context *cmd __attribute__((unused)), struct ar
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int int_arg_with_sign_and_percent(struct cmd_context *cmd __attribute__((unused)),
|
int extents_arg(struct cmd_context *cmd __attribute__((unused)),
|
||||||
struct arg_values *av)
|
struct arg_values *av)
|
||||||
{
|
{
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
@ -188,7 +188,7 @@ int size_mb_arg_with_percent(struct cmd_context *cmd, struct arg_values *av);
|
|||||||
int int_arg(struct cmd_context *cmd, struct arg_values *av);
|
int int_arg(struct cmd_context *cmd, struct arg_values *av);
|
||||||
int uint32_arg(struct cmd_context *cmd, struct arg_values *av);
|
int uint32_arg(struct cmd_context *cmd, struct arg_values *av);
|
||||||
int int_arg_with_sign(struct cmd_context *cmd, struct arg_values *av);
|
int int_arg_with_sign(struct cmd_context *cmd, struct arg_values *av);
|
||||||
int int_arg_with_sign_and_percent(struct cmd_context *cmd, struct arg_values *av);
|
int extents_arg(struct cmd_context *cmd, struct arg_values *av);
|
||||||
int major_arg(struct cmd_context *cmd, struct arg_values *av);
|
int major_arg(struct cmd_context *cmd, struct arg_values *av);
|
||||||
int minor_arg(struct cmd_context *cmd, struct arg_values *av);
|
int minor_arg(struct cmd_context *cmd, struct arg_values *av);
|
||||||
int string_arg(struct cmd_context *cmd, struct arg_values *av);
|
int string_arg(struct cmd_context *cmd, struct arg_values *av);
|
||||||
|
22
tools/vals.h
22
tools/vals.h
@ -79,13 +79,13 @@
|
|||||||
* options included in the usage text below that should
|
* options included in the usage text below that should
|
||||||
* be removed? Should "lvm1" be removed?
|
* be removed? Should "lvm1" be removed?
|
||||||
*
|
*
|
||||||
* For Number args that take optional units, a full usage
|
* Size is a Number that takes an optional unit.
|
||||||
* could be "Number[bBsSkKmMgGtTpPeE]" (with implied |),
|
* A full usage could be "Size[b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E]"
|
||||||
* but repeating this full specification produces cluttered
|
* but repeating this full specification produces long and
|
||||||
* output, and doesn't indicate which unit is the default.
|
* cluttered output, and doesn't indicate which unit is the default.
|
||||||
* "Number[Units]" would be cleaner, as would a subset of
|
* "Size[Units]" would be cleaner, as would a subset of
|
||||||
* common units, e.g. "Number[kmg...]", but neither helps
|
* common units, e.g. "Size[kmg...]", but neither helps
|
||||||
* with default. "Number[k|UNIT]" and "Number[m|UNIT]" show
|
* with default. "Size[k|UNIT]" and "Size[m|UNIT]" show
|
||||||
* the default, and "UNIT" indicates that other units
|
* the default, and "UNIT" indicates that other units
|
||||||
* are possible without listing them all. This also
|
* are possible without listing them all. This also
|
||||||
* suggests using the preferred lower case letters, because
|
* suggests using the preferred lower case letters, because
|
||||||
@ -115,11 +115,11 @@ val(activation_VAL, activation_arg, "Active", "y|n|ay")
|
|||||||
val(cachemode_VAL, cachemode_arg, "CacheMode", "writethrough|writeback")
|
val(cachemode_VAL, cachemode_arg, "CacheMode", "writethrough|writeback")
|
||||||
val(discards_VAL, discards_arg, "Discards", "passdown|nopassdown|ignore")
|
val(discards_VAL, discards_arg, "Discards", "passdown|nopassdown|ignore")
|
||||||
val(mirrorlog_VAL, mirrorlog_arg, "MirrorLog", "core|disk")
|
val(mirrorlog_VAL, mirrorlog_arg, "MirrorLog", "core|disk")
|
||||||
val(sizekb_VAL, size_kb_arg, "SizeKB", "Number[k|UNIT]")
|
val(sizekb_VAL, size_kb_arg, "SizeKB", "Size[k|UNIT]")
|
||||||
val(sizemb_VAL, size_mb_arg, "SizeMB", "Number[m|UNIT]")
|
val(sizemb_VAL, size_mb_arg, "SizeMB", "Size[m|UNIT]")
|
||||||
val(regionsize_VAL, regionsize_arg, "RegionSize", "Number[m|UNIT]")
|
val(regionsize_VAL, regionsize_arg, "RegionSize", "Size[m|UNIT]")
|
||||||
val(numsigned_VAL, int_arg_with_sign, "SNumber", "[+|-]Number")
|
val(numsigned_VAL, int_arg_with_sign, "SNumber", "[+|-]Number")
|
||||||
val(numsignedper_VAL, int_arg_with_sign_and_percent, "SNumberP", "[+|-]Number[%VG|%PVS|%FREE]")
|
val(extents_VAL, extents_arg, "Extents", "[+|-]Number[%VG|%PVS|%FREE]")
|
||||||
val(permission_VAL, permission_arg, "Permission", "rw|r")
|
val(permission_VAL, permission_arg, "Permission", "rw|r")
|
||||||
val(metadatatype_VAL, metadatatype_arg, "MetadataType", "lvm2|lvm1")
|
val(metadatatype_VAL, metadatatype_arg, "MetadataType", "lvm2|lvm1")
|
||||||
val(units_VAL, string_arg, "Units", "r|R|h|H|b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E")
|
val(units_VAL, string_arg, "Units", "r|R|h|H|b|B|s|S|k|K|m|M|g|G|t|T|p|P|e|E")
|
||||||
|
Loading…
Reference in New Issue
Block a user