summaryrefslogtreecommitdiffstats
path: root/tools/e2fsprogs/patches/003-darwin_directio_fix.patch
diff options
context:
space:
mode:
authorHauke Mehrtens <hauke@hauke-m.de>2010-12-19 11:43:45 +0000
committerHauke Mehrtens <hauke@hauke-m.de>2010-12-19 11:43:45 +0000
commitba45b5a90730d8b3bc90e27bf16e8911fd4577d3 (patch)
tree558be7769a3fe35512c236e021bb685c340c3b3e /tools/e2fsprogs/patches/003-darwin_directio_fix.patch
parentefb7c910ee4c0755457ab92daa67f1d5ae2e3f2c (diff)
downloadmaster-31e0f0ae-ba45b5a90730d8b3bc90e27bf16e8911fd4577d3.tar.gz
master-31e0f0ae-ba45b5a90730d8b3bc90e27bf16e8911fd4577d3.tar.bz2
master-31e0f0ae-ba45b5a90730d8b3bc90e27bf16e8911fd4577d3.zip
e2fsprogs: add two compile fixes.
Thank you Joe Roback for reporting and fixing compiling on Darwin. SVN-Revision: 24720
Diffstat (limited to 'tools/e2fsprogs/patches/003-darwin_directio_fix.patch')
-rw-r--r--tools/e2fsprogs/patches/003-darwin_directio_fix.patch36
1 files changed, 36 insertions, 0 deletions
diff --git a/tools/e2fsprogs/patches/003-darwin_directio_fix.patch b/tools/e2fsprogs/patches/003-darwin_directio_fix.patch
new file mode 100644
index 0000000000..971c7ad99b
--- /dev/null
+++ b/tools/e2fsprogs/patches/003-darwin_directio_fix.patch
@@ -0,0 +1,36 @@
+--- a/lib/ext2fs/unix_io.c
++++ b/lib/ext2fs/unix_io.c
+@@ -428,6 +428,7 @@ static errcode_t unix_open(const char *n
+ struct unix_private_data *data = NULL;
+ errcode_t retval;
+ int open_flags;
++ int f_nocache = 0;
+ struct stat st;
+ #ifdef __linux__
+ struct utsname ut;
+@@ -464,7 +465,11 @@ static errcode_t unix_open(const char *n
+ if (flags & IO_FLAG_EXCLUSIVE)
+ open_flags |= O_EXCL;
+ if (flags & IO_FLAG_DIRECT_IO)
++#if !defined(O_DIRECT) && defined(F_NOCACHE)
++ f_nocache = F_NOCACHE;
++#else
+ open_flags |= O_DIRECT;
++#endif
+ data->flags = flags;
+
+ #ifdef HAVE_OPEN64
+@@ -477,6 +482,13 @@ static errcode_t unix_open(const char *n
+ goto cleanup;
+ }
+
++ if (f_nocache) {
++ if (fcntl(data->dev, f_nocache, 1) < 0) {
++ retval = errno;
++ goto cleanup;
++ }
++ }
++
+ #ifdef BLKSSZGET
+ if (flags & IO_FLAG_DIRECT_IO) {
+ if (ioctl(data->dev, BLKSSZGET, &data->align) != 0)