summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBernhard Walle <bernhard@bwalle.de>2012-01-19 22:36:21 +0100
committerMichael Olbrich <m.olbrich@pengutronix.de>2012-01-19 22:38:30 +0100
commit3143e8ed4afcf18f5c745b1abebbd6581fbbcb9b (patch)
treefbb6f68944d501bf043df362e91e2b6eabec02b1
parent4820d74a849c1d2f9884668e82f0e74489db1bca (diff)
downloadptxdist-3143e8ed4afcf18f5c745b1abebbd6581fbbcb9b.tar.gz
ptxdist-3143e8ed4afcf18f5c745b1abebbd6581fbbcb9b.tar.xz
host-e2fsprogs: Fix build on Darwin
The O_DIRECT flag in e2fsprogs is relatively new. MacPorts is still using the old version of e2fsprogs. However, this patch from the upstream bug tracker fixes the build of e2fsprogs. Strictly direct I/O is not required for ptxdist because we're working on images only. So removing O_DIRECT here would also work, but this solution is cleaner. Signed-off-by: Bernhard Walle <bernhard@bwalle.de> Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
-rw-r--r--patches/e2fsprogs-1.41.14/0003-Fix-compilation-on-Darwin.patch44
-rw-r--r--patches/e2fsprogs-1.41.14/series3
2 files changed, 46 insertions, 1 deletions
diff --git a/patches/e2fsprogs-1.41.14/0003-Fix-compilation-on-Darwin.patch b/patches/e2fsprogs-1.41.14/0003-Fix-compilation-on-Darwin.patch
new file mode 100644
index 000000000..cb58afd4c
--- /dev/null
+++ b/patches/e2fsprogs-1.41.14/0003-Fix-compilation-on-Darwin.patch
@@ -0,0 +1,44 @@
+From: Bernhard Walle <bernhard@bwalle.de>
+Date: Thu, 19 Jan 2012 22:31:46 +0100
+Subject: [PATCH] Fix compilation on Darwin
+
+The patch is inspired by the patch at
+http://sourceforge.net/tracker/?func=detail&aid=3140289&group_id=2406&atid=102406
+(bug tracker of the upstream project).
+
+Signed-off-by: Bernhard Walle <bernhard@bwalle.de>
+---
+ lib/ext2fs/unix_io.c | 11 +++++++++++
+ 1 files changed, 11 insertions(+), 0 deletions(-)
+
+diff --git a/lib/ext2fs/unix_io.c b/lib/ext2fs/unix_io.c
+index 1df1fdd..cbd3d70 100644
+--- a/lib/ext2fs/unix_io.c
++++ b/lib/ext2fs/unix_io.c
+@@ -463,8 +463,10 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
+ open_flags = (flags & IO_FLAG_RW) ? O_RDWR : O_RDONLY;
+ if (flags & IO_FLAG_EXCLUSIVE)
+ open_flags |= O_EXCL;
++#ifdef O_DIRECT
+ if (flags & IO_FLAG_DIRECT_IO)
+ open_flags |= O_DIRECT;
++#endif
+ data->flags = flags;
+
+ #ifdef HAVE_OPEN64
+@@ -477,6 +479,15 @@ static errcode_t unix_open(const char *name, int flags, io_channel *channel)
+ goto cleanup;
+ }
+
++#if !defined(O_DIRECT) && defined(F_NOCACHE)
++ if (flags & IO_FLAG_DIRECT_IO) {
++ if (fcntl(data->dev, F_NOCACHE, 1) < 0) {
++ retval = errno;
++ goto cleanup;
++ }
++ }
++#endif
++
+ #ifdef BLKSSZGET
+ if (flags & IO_FLAG_DIRECT_IO) {
+ if (ioctl(data->dev, BLKSSZGET, &data->align) != 0)
diff --git a/patches/e2fsprogs-1.41.14/series b/patches/e2fsprogs-1.41.14/series
index fac473a05..44a543e99 100644
--- a/patches/e2fsprogs-1.41.14/series
+++ b/patches/e2fsprogs-1.41.14/series
@@ -2,4 +2,5 @@
#tag:base --start-number 1
0001-Fixed-bitops.h-for-Coldfire-V4E.patch
0002-fix-linking-problem.patch
-# ec0cc8b8677eb72a286f38e0e9ba63e9 - git-ptx-patches magic
+0003-Fix-compilation-on-Darwin.patch
+# b3f719def2b2e0004e2d9a830ebc59d0 - git-ptx-patches magic