1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

Continue to make --units and --size consistent (in code and man pages):

Update units_to_bytes() to support (S)ectors: 500 bytes.
- 500 byte (S)ectors is of questionable value but it adds to consistency
  if a user happens to use --units S.  This seems better than an error.

Updated test/t-covercmd.sh to test --units [hS]

Document the units that can be displayed via --units uniformly.
- (p)etabytes and (e)xabytes were missing in pvs, vgs and lvs man pages.

Made lvreduce man page "... in units of megabytes." consistent (with the
lvextend and lvresize man pages).
This commit is contained in:
snitzer 2009-07-07 19:28:57 +00:00
parent e08e69719d
commit 69da2ac0c7
6 changed files with 26 additions and 23 deletions

View File

@ -62,14 +62,14 @@ uint64_t units_to_bytes(const char *units, char *unit_type)
v = UINT64_C(1);
*unit_type = *units;
break;
case 's':
v *= SECTOR_SIZE;
break;
case 'b':
case 'B':
v *= UINT64_C(1);
break;
#define KILO UINT64_C(1024)
case 's':
v *= (KILO/2);
break;
case 'k':
v *= KILO;
break;
@ -90,6 +90,9 @@ uint64_t units_to_bytes(const char *units, char *unit_type)
break;
#undef KILO
#define KILO UINT64_C(1000)
case 'S':
v *= (KILO/2);
break;
case 'K':
v *= KILO;
break;

View File

@ -47,7 +47,7 @@ size of the Logical Volume with the suffix %LV or as a percentage of the remaini
free space in the Volume Group with the suffix %FREE.
.TP
.I \-L, \-\-size [\-]LogicalVolumeSize[bBsSkKmMgGtTpPeE]
Reduce or set the logical volume size in units of megabyte by default.
Reduce or set the logical volume size in units of megabytes.
A size suffix of k for kilobyte, m for megabyte,
g for gigabytes, t for terabytes, p for petabytes
or e for exabytes is optional.

View File

@ -9,7 +9,7 @@ lvs \- report information about logical volumes
[\-O|\-\-sort [+|-]Key1[,[+|-]Key2[,...]]]
[\-P|\-\-partial] [\-\-rows] [\-\-segments]
[\-\-separator Separator] [\-\-unbuffered]
[\-\-units hsbkmgtHKMGT]
[\-\-units hHbBsSkKmMgGtTpPeE]
[\-\-unquoted]
[\-v|\-\-verbose]
[\-\-version] [VolumeGroupName [VolumeGroupName...]]
@ -91,11 +91,11 @@ String to use to separate each column. Useful if grepping the output.
.I \-\-unbuffered
Produce output immediately without sorting or aligning the columns properly.
.TP
.I \-\-units hsbkmgtHKMGT
All sizes are output in these units: (h)uman-readable, (s)ectors, (b)ytes,
(k)ilobytes, (m)egabytes, (g)igabytes, (t)erabytes. Capitalise to use multiples
of 1000 (S.I.) instead of 1024. Can also specify custom (u)nits e.g.
\-\-units 3M
.I \-\-units hHbBsSkKmMgGtTpPeE
All sizes are output in these units: (h)uman-readable, (b)ytes, (s)ectors,
(k)ilobytes, (m)egabytes, (g)igabytes, (t)erabytes, (p)etabytes, (e)xabytes.
Capitalise to use multiples of 1000 (S.I.) instead of 1024. Can also specify
custom units e.g. \-\-units 3M
.TP
.I \-\-unquoted
When used with --nameprefixes, output values in the field=value pairs are not quoted.

View File

@ -9,7 +9,7 @@ pvs \- report information about physical volumes
[\-O|\-\-sort [+|-]Key1[,[+|-]Key2[,...]]]
[\-\-rows] [\-\-segments]
[\-\-separator Separator] [\-\-unbuffered]
[\-\-units hsbkmgtHKMGT]
[\-\-units hHbBsSkKmMgGtTpPeE]
[\-\-unquoted]
[\-v|\-\-verbose]
[\-\-version] [PhysicalVolume [PhysicalVolume...]]
@ -69,11 +69,11 @@ String to use to separate each column. Useful if grepping the output.
.I \-\-unbuffered
Produce output immediately without sorting or aligning the columns properly.
.TP
.I \-\-units hsbkmgtHKMGT
All sizes are output in these units: (h)uman-readable, (s)ectors, (b)ytes,
(k)ilobytes, (m)egabytes, (g)igabytes, (t)erabytes. Capitalise to use multiples
of 1000 (S.I.) instead of 1024. Can also specify custom (u)nits e.g.
\-\-units 3M
.I \-\-units hHbBsSkKmMgGtTpPeE
All sizes are output in these units: (h)uman-readable, (b)ytes, (s)ectors,
(k)ilobytes, (m)egabytes, (g)igabytes, (t)erabytes, (p)etabytes, (e)xabytes.
Capitalise to use multiples of 1000 (S.I.) instead of 1024. Can also specify
custom units e.g. \-\-units 3M
.TP
.I \-\-unquoted
When used with --nameprefixes, output values in the field=value pairs are not quoted.

View File

@ -9,7 +9,7 @@ vgs \- report information about volume groups
[\-O|\-\-sort [+|-]Key1[,[+|-]Key2[,...]]]
[\-P|\-\-partial] [\-\-rows]
[\-\-separator Separator] [\-\-unbuffered]
[\-\-units hsbkmgtHKMGT]
[\-\-units hHbBsSkKmMgGtTpPeE]
[\-\-unquoted]
[\-v|\-\-verbose]
[\-\-version] [VolumeGroupName [VolumeGroupName...]]
@ -80,11 +80,11 @@ String to use to separate each column. Useful if grepping the output.
.I \-\-unbuffered
Produce output immediately without sorting or aligning the columns properly.
.TP
.I \-\-units hsbkmgtHKMGT
All sizes are output in these units: (h)uman-readable, (s)ectors, (b)ytes,
(k)ilobytes, (m)egabytes, (g)igabytes, (t)erabytes. Capitalise to use multiples
of 1000 (S.I.) instead of 1024. Can also specify custom (u)nits e.g.
\-\-units 3M
.I \-\-units hHbBsSkKmMgGtTpPeE
All sizes are output in these units: (h)uman-readable, (b)ytes, (s)ectors,
(k)ilobytes, (m)egabytes, (g)igabytes, (t)erabytes, (p)etabytes, (e)xabytes.
Capitalise to use multiples of 1000 (S.I.) instead of 1024. Can also specify
custom units e.g. \-\-units 3M
.TP
.I \-\-unquoted
When used with --nameprefixes, output values in the field=value pairs are not quoted.

View File

@ -41,7 +41,7 @@ lvscan
lvmdiskscan
vgdisplay --units k
lvdisplay --units g
for i in b k m g t p e H B K M G T P E ; do
for i in h b s k m g t p e H B S K M G T P E ; do
pvdisplay --units "$i" "$dev1"
done