sys/wait.h \
sys/types.h \
strings.h \
- err.h
+ err.h \
+ linux/falloc.h
])
AC_CHECK_HEADERS([ sys/fs/xfs_fsops.h \
sys/fs/xfs_itable.h \
#ifdef HAVE_LINUX_FIEMAP_H
#include <linux/fiemap.h>
#endif
-#ifdef FALLOCATE
-#include <linux/falloc.h>
-#ifndef FALLOC_FL_PUNCH_HOLE
-/* Copy-paste from linux/falloc.h */
-#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */
-#endif
-#endif
#ifndef HAVE_ATTR_LIST
#define attr_list(path, buf, size, flags, cursor) (errno = -ENOSYS, -1)
#endif
void
fallocate_f(int opno, long r)
{
-#ifdef FALLOCATE
+#ifdef HAVE_LINUX_FALLOC_H
int e;
pathname_t f;
int fd;
void
punch_f(int opno, long r)
{
-#ifdef FALLOCATE
+#ifdef HAVE_LINUX_FALLOC_H
int e;
pathname_t f;
int fd;
#ifdef AIO
#include <libaio.h>
#endif
-#ifdef FALLOCATE
-#include <linux/falloc.h>
-#endif
#ifndef MAP_FILE
# define MAP_FILE 0
}
#endif
-#ifdef FALLOCATE
+#ifdef HAVE_LINUX_FALLOC_H
/* fallocate is basically a no-op unless extending, then a lot like a truncate */
void
do_preallocate(unsigned offset, unsigned length)
" -A: Use the AIO system calls\n"
#endif
" -D startingop: debug output starting at specified operation\n"
-#ifdef FALLOCATE
+#ifdef HAVE_LINUX_FALLOC_H
" -F: Do not use fallocate (preallocation) calls\n"
#endif
#ifdef FALLOC_FL_PUNCH_HOLE
void
test_fallocate()
{
-#ifdef FALLOCATE
+#ifdef HAVE_LINUX_FALLOC_H
if (!lite && fallocate_calls) {
if (fallocate(fd, 0, 0, 1) && errno == EOPNOTSUPP) {
if(!quiet)
ftruncate(fd, 0);
}
}
-#else /* ! FALLOCATE */
+#else /* ! HAVE_LINUX_FALLOC_H */
fallocate_calls = 0;
#endif
#include <sys/param.h>
#endif
+#ifdef HAVE_LINUX_FALLOC_H
+#include <linux/falloc.h>
+
+#ifndef FALLOC_FL_KEEP_SIZE
+#define FALLOC_FL_KEEP_SIZE 0x01
+#endif
+
+#ifndef FALLOC_FL_PUNCH_HOLE
+#define FALLOC_FL_PUNCH_HOLE 0x02
#endif
+
+#ifndef FALLOC_FL_NO_HIDE_STALE
+#define FALLOC_FL_NO_HIDE_STALE 0x04
+#endif
+
+#ifndef FALLOC_FL_COLLAPSE_RANGE
+#define FALLOC_FL_COLLAPSE_RANGE 0x08
+#endif
+
+#ifndef FALLOC_FL_ZERO_RANGE
+#define FALLOC_FL_ZERO_RANGE 0x10
+#endif
+
+#endif /* HAVE_LINUX_FALLOC_H */
+
+#endif /* GLOBAL_H */