dedup

deduplicating backup program
git clone git://git.2f30.org/dedup
Log | Files | Refs | README | LICENSE

compat.c (334B)


      1 #ifdef __linux__
      2 #define _GNU_SOURCE
      3 #include <fcntl.h>
      4 
      5 int
      6 punchhole(int fd, off_t offset, off_t len)
      7 {
      8 	int mode;
      9 
     10 	mode = FALLOC_FL_PUNCH_HOLE | FALLOC_FL_KEEP_SIZE;
     11 	return fallocate(fd, mode, offset, len);
     12 }
     13 #else
     14 #include <sys/types.h>
     15 #include <unistd.h>
     16 
     17 int
     18 punchhole(int fd, off_t offset, off_t len)
     19 {
     20 	return -1;
     21 }
     22 #endif