mirror of https://github.com/vitalif/e2fsprogs
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>crypto
parent
831aa869e8
commit
8467b3bec8
|
@ -36,6 +36,8 @@
|
||||||
// #include <linux/falloc.h>
|
// #include <linux/falloc.h>
|
||||||
#define FALLOC_FL_KEEP_SIZE 0x01
|
#define FALLOC_FL_KEEP_SIZE 0x01
|
||||||
#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */
|
#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */
|
||||||
|
#define FALLOC_FL_COLLAPSE_RANGE 0x08
|
||||||
|
#define FALLOC_FL_ZERO_RANGE 0x10
|
||||||
|
|
||||||
void usage(void)
|
void usage(void)
|
||||||
{
|
{
|
||||||
|
@ -95,7 +97,7 @@ int main(int argc, char **argv)
|
||||||
int error;
|
int error;
|
||||||
int tflag = 0;
|
int tflag = 0;
|
||||||
|
|
||||||
while ((opt = getopt(argc, argv, "npl:o:t")) != -1) {
|
while ((opt = getopt(argc, argv, "npl:o:tzc")) != -1) {
|
||||||
switch(opt) {
|
switch(opt) {
|
||||||
case 'n':
|
case 'n':
|
||||||
/* do not change filesize */
|
/* do not change filesize */
|
||||||
|
@ -106,6 +108,16 @@ int main(int argc, char **argv)
|
||||||
falloc_mode = (FALLOC_FL_PUNCH_HOLE |
|
falloc_mode = (FALLOC_FL_PUNCH_HOLE |
|
||||||
FALLOC_FL_KEEP_SIZE);
|
FALLOC_FL_KEEP_SIZE);
|
||||||
break;
|
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':
|
case 'l':
|
||||||
length = cvtnum(optarg);
|
length = cvtnum(optarg);
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue