diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2014-10-18 12:15:03 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2014-10-18 12:15:03 -0400 |
commit | 8467b3bec8bb35d5afd0370b2d2a2703e33dd686 (patch) | |
tree | b6bdb260bb5d654bf624cfc67c3d13c1ab4ee2ce /contrib | |
parent | 831aa869e8b1b287ca921e7ae181a4cdca839099 (diff) | |
download | e2fsprogs-8467b3bec8bb35d5afd0370b2d2a2703e33dd686.tar.gz |
contrib: add support for COLLAPSE_RANGE and ZERO_RANGE to falocate program
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/fallocate.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/contrib/fallocate.c b/contrib/fallocate.c index 1f9b59ad..01d4af7d 100644 --- a/contrib/fallocate.c +++ b/contrib/fallocate.c @@ -36,6 +36,8 @@ // #include <linux/falloc.h> #define FALLOC_FL_KEEP_SIZE 0x01 #define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */ +#define FALLOC_FL_COLLAPSE_RANGE 0x08 +#define FALLOC_FL_ZERO_RANGE 0x10 void usage(void) { @@ -95,7 +97,7 @@ int main(int argc, char **argv) int error; int tflag = 0; - while ((opt = getopt(argc, argv, "npl:o:t")) != -1) { + while ((opt = getopt(argc, argv, "npl:o:tzc")) != -1) { switch(opt) { case 'n': /* do not change filesize */ @@ -106,6 +108,16 @@ int main(int argc, char **argv) falloc_mode = (FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE); break; + case 'c': + /* collapse range mode */ + falloc_mode = (FALLOC_FL_COLLAPSE_RANGE | + FALLOC_FL_KEEP_SIZE); + break; + case 'z': + /* zero range mode */ + falloc_mode = (FALLOC_FL_ZERO_RANGE | + FALLOC_FL_KEEP_SIZE); + break; case 'l': length = cvtnum(optarg); break; |