]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: guard fallocate with #ifdefs
authorSage Weil <sage@inktank.com>
Fri, 16 Aug 2013 06:01:59 +0000 (23:01 -0700)
committerSage Weil <sage@inktank.com>
Tue, 20 Aug 2013 05:49:48 +0000 (22:49 -0700)
Only include linux header if it's linux.  Only implement the fallocate
method if FALLOC_FL_PUNCH_HOLE is defined.

Signed-off-by: Sage Weil <sage@inktank.com>
src/client/Client.cc

index fee0453e937f03dc41ed5319d64e33a8c76ef0c3..866b2117c6b4b1ec6bd48ce6146d4603a9f0d049 100644 (file)
 #include <sys/stat.h>
 #include <sys/param.h>
 #include <fcntl.h>
+
+#if defined(__linux__)
 #include <linux/falloc.h>
+#endif
 
 #include <sys/statvfs.h>
 
@@ -7686,6 +7689,8 @@ int Client::ll_fsync(Fh *fh, bool syncdataonly)
   return _fsync(fh, syncdataonly);
 }
 
+#ifdef FALLOC_FL_PUNCH_HOLE
+
 int Client::_fallocate(Fh *fh, int mode, int64_t offset, int64_t length)
 {
   if (offset < 0 || length <= 0)
@@ -7757,6 +7762,15 @@ done:
   put_cap_ref(in, CEPH_CAP_FILE_WR);
   return r;
 }
+#else
+
+int Client::_fallocate(Fh *fh, int mode, int64_t offset, int64_t length)
+{
+  return -EOPNOTSUPP;
+}
+
+#endif
+
 
 int Client::ll_fallocate(Fh *fh, int mode, loff_t offset, loff_t length)
 {