summaryrefslogtreecommitdiffstats
path: root/libglusterfs/src/compat.h
diff options
context:
space:
mode:
authorBrian Foster <bfoster@redhat.com>2013-11-20 13:41:49 -0500
committerAnand Avati <avati@redhat.com>2013-11-20 15:42:58 -0800
commit689b86cfe6c9258c8507c8391ed62aa1a640c1e3 (patch)
treeb4c78e662c3887b62fd0e43a251c31f79a334308 /libglusterfs/src/compat.h
parented75205b1ca592d0b33cc5663e7bdc4ccfc2cf02 (diff)
libglusterfs: use correct check for linux falloc.h availability
We should check for HAVE_LINUX_FALLOC_H rather than HAVE_FALLOC_H to determine whether to include linux/falloc.h. Change-Id: I05eca4de2893a88d6b9cc5ebfce738708b9960d4 BUG: 1032378 Signed-off-by: Brian Foster <bfoster@redhat.com> Reviewed-on: http://review.gluster.org/6314 Reviewed-by: Anand Avati <avati@redhat.com> Tested-by: Anand Avati <avati@redhat.com>
Diffstat (limited to 'libglusterfs/src/compat.h')
-rw-r--r--libglusterfs/src/compat.h13
1 files changed, 11 insertions, 2 deletions
diff --git a/libglusterfs/src/compat.h b/libglusterfs/src/compat.h
index 2bd9825417b..359a4a3b5cf 100644
--- a/libglusterfs/src/compat.h
+++ b/libglusterfs/src/compat.h
@@ -32,10 +32,19 @@
#include <linux/limits.h>
#include <sys/xattr.h>
#include <endian.h>
-#ifdef HAVE_FALLOC_H
+#ifdef HAVE_LINUX_FALLOC_H
#include <linux/falloc.h>
-#else
+#endif
+
+/*
+ * Define the fallocate flags in case we do not have the header. This also
+ * accounts for older systems that do not define FALLOC_FL_PUNCH_HOLE.
+ */
+
+#ifndef FALLOC_FL_KEEP_SIZE
#define FALLOC_FL_KEEP_SIZE 0x01 /* default is extend size */
+#endif
+#ifndef FALLOC_FL_PUNCH_HOLE
#define FALLOC_FL_PUNCH_HOLE 0x02 /* de-allocates range */
#endif