diff options
author | Theodore Ts'o <tytso@mit.edu> | 2012-12-06 11:21:44 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2012-12-06 11:21:44 -0500 |
commit | 2658b9616fe63d2fd9e2654676877ab014639a92 (patch) | |
tree | 1a20e7013fc98cf8e1f6b193608e53caee1898da /contrib | |
parent | 5e27a274d320b44c631a37d4b04a84aa3ca5428c (diff) | |
download | android_external_e2fsprogs-2658b9616fe63d2fd9e2654676877ab014639a92.tar.gz android_external_e2fsprogs-2658b9616fe63d2fd9e2654676877ab014639a92.tar.bz2 android_external_e2fsprogs-2658b9616fe63d2fd9e2654676877ab014639a92.zip |
contrib/fallocate: add support for punch functionality
Also fix the -o option so it works correctly (instead of core
dumping).
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/fallocate.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/contrib/fallocate.c b/contrib/fallocate.c index 0e8319fe..1436b701 100644 --- a/contrib/fallocate.c +++ b/contrib/fallocate.c @@ -35,6 +35,7 @@ // #include <linux/falloc.h> #define FALLOC_FL_KEEP_SIZE 0x01 +#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */ void usage(void) { @@ -94,12 +95,17 @@ int main(int argc, char **argv) int error; int tflag = 0; - while ((opt = getopt(argc, argv, "nl:ot")) != -1) { + while ((opt = getopt(argc, argv, "npl:o:t")) != -1) { switch(opt) { case 'n': /* do not change filesize */ falloc_mode = FALLOC_FL_KEEP_SIZE; break; + case 'p': + /* punch mode */ + falloc_mode = (FALLOC_FL_PUNCH_HOLE | + FALLOC_FL_KEEP_SIZE); + break; case 'l': length = cvtnum(optarg); break; |