tcompat.c - dedup - deduplicating backup program
(HTM) git clone git://git.z3bra.org/dedup.git
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
tcompat.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