Allow to specify size in terabytes by using T or t suffix.
This speeds up my testing a bit. Because truncate(1) doesn't allocate blocks on file system before they are used, it is very useful to emulate huge file systems: # truncate -s 16T fs.img # mdconfig -a -f fs.img # newfs /dev/mdX (-t swap can be used as well)
This commit is contained in:
parent
dfa9422b4a
commit
e6f3621dd3
@ -39,7 +39,7 @@
|
||||
.Sm off
|
||||
.Op Cm + | -
|
||||
.Ar size
|
||||
.Op Cm K | k | M | m | G | g
|
||||
.Op Cm K | k | M | m | G | g | T | t
|
||||
.Sm on
|
||||
.Xc
|
||||
.Ek
|
||||
@ -71,7 +71,7 @@ Truncate files to the length of the file
|
||||
.Sm off
|
||||
.Op Cm + | -
|
||||
.Ar size
|
||||
.Op Cm K | k | M | m | G | g
|
||||
.Op Cm K | k | M | m | G | g | T | t
|
||||
.Sm on
|
||||
.Xc
|
||||
If the
|
||||
@ -94,11 +94,12 @@ The
|
||||
.Ar size
|
||||
argument may be suffixed with one of
|
||||
.Cm K ,
|
||||
.Cm M
|
||||
or
|
||||
.Cm M ,
|
||||
.Cm G
|
||||
or
|
||||
.Cm T
|
||||
(either upper or lower case) to indicate a multiple of
|
||||
Kilobytes, Megabytes or Gigabytes
|
||||
Kilobytes, Megabytes, Gigabytes or Terabytes
|
||||
respectively.
|
||||
.El
|
||||
.Pp
|
||||
|
@ -176,6 +176,10 @@ parselength(char *ls, off_t *sz)
|
||||
}
|
||||
|
||||
switch (*ls) {
|
||||
case 'T':
|
||||
case 't':
|
||||
oflow = length * 1024;
|
||||
ASSIGN_CHK_OFLOW(oflow, length);
|
||||
case 'G':
|
||||
case 'g':
|
||||
oflow = length * 1024;
|
||||
|
Loading…
Reference in New Issue
Block a user