mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] [PATCH] host-e2fsprogs: Fix build on Darwin
@ 2012-01-19 18:54 Bernhard Walle
  2012-01-19 21:14 ` Michael Olbrich
  0 siblings, 1 reply; 3+ messages in thread
From: Bernhard Walle @ 2012-01-19 18:54 UTC (permalink / raw)
  To: ptxdist

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>
---
 .../0003-darwin_directio_fix.patch                 |   46 ++++++++++++++++++++
 patches/e2fsprogs-1.41.14/series                   |    1 +
 2 files changed, 47 insertions(+), 0 deletions(-)
 create mode 100644 patches/e2fsprogs-1.41.14/0003-darwin_directio_fix.patch

diff --git a/patches/e2fsprogs-1.41.14/0003-darwin_directio_fix.patch b/patches/e2fsprogs-1.41.14/0003-darwin_directio_fix.patch
new file mode 100644
index 0000000..1e00c04
--- /dev/null
+++ b/patches/e2fsprogs-1.41.14/0003-darwin_directio_fix.patch
@@ -0,0 +1,46 @@
+Fix compilation on Darwin
+
+The patch is from upstream bug tracker [1]. However, it's not (yet) in the
+upstream repository.
+
+[1] http://sourceforge.net/tracker/?func=detail&aid=3140289&group_id=2406&atid=102406
+---
+ lib/ext2fs/unix_io.c |   12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+--- 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)
diff --git a/patches/e2fsprogs-1.41.14/series b/patches/e2fsprogs-1.41.14/series
index fac473a..26e2c33 100644
--- a/patches/e2fsprogs-1.41.14/series
+++ b/patches/e2fsprogs-1.41.14/series
@@ -3,3 +3,4 @@
 0001-Fixed-bitops.h-for-Coldfire-V4E.patch
 0002-fix-linking-problem.patch
 # ec0cc8b8677eb72a286f38e0e9ba63e9  - git-ptx-patches magic
+0003-darwin_directio_fix.patch
-- 
1.7.7.4


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ptxdist] [PATCH] host-e2fsprogs: Fix build on Darwin
  2012-01-19 18:54 [ptxdist] [PATCH] host-e2fsprogs: Fix build on Darwin Bernhard Walle
@ 2012-01-19 21:14 ` Michael Olbrich
  2012-01-19 21:36   ` Bernhard Walle
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Olbrich @ 2012-01-19 21:14 UTC (permalink / raw)
  To: ptxdist

On Thu, Jan 19, 2012 at 07:54:03PM +0100, Bernhard Walle wrote:
> 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>
> ---
>  .../0003-darwin_directio_fix.patch                 |   46 ++++++++++++++++++++
>  patches/e2fsprogs-1.41.14/series                   |    1 +
>  2 files changed, 47 insertions(+), 0 deletions(-)
>  create mode 100644 patches/e2fsprogs-1.41.14/0003-darwin_directio_fix.patch
> 
> diff --git a/patches/e2fsprogs-1.41.14/0003-darwin_directio_fix.patch b/patches/e2fsprogs-1.41.14/0003-darwin_directio_fix.patch
> new file mode 100644
> index 0000000..1e00c04
> --- /dev/null
> +++ b/patches/e2fsprogs-1.41.14/0003-darwin_directio_fix.patch
> @@ -0,0 +1,46 @@
> +Fix compilation on Darwin
> +
> +The patch is from upstream bug tracker [1]. However, it's not (yet) in the
> +upstream repository.
> +
> +[1] http://sourceforge.net/tracker/?func=detail&aid=3140289&group_id=2406&atid=102406
> +---
> + lib/ext2fs/unix_io.c |   12 ++++++++++++
> + 1 file changed, 12 insertions(+)
> +
> +--- a/lib/ext2fs/unix_io.c
> ++++ b/lib/ext2fs/unix_io.c
> +@@ -464,7 +465,11 @@ static errcode_t unix_open(const char *n
> + 	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 +482,13 @@ static errcode_t unix_open(const char *n
> + 		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

Is better I think. No need for another variable.

> ++
> + #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 fac473a..26e2c33 100644
> --- a/patches/e2fsprogs-1.41.14/series
> +++ b/patches/e2fsprogs-1.41.14/series
> @@ -3,3 +3,4 @@
>  0001-Fixed-bitops.h-for-Coldfire-V4E.patch
>  0002-fix-linking-problem.patch
>  # ec0cc8b8677eb72a286f38e0e9ba63e9  - git-ptx-patches magic
> +0003-darwin_directio_fix.patch

And please recreate the patch as I described in the other mail, so it has a
proper patch header.

Michael

> -- 
> 1.7.7.4
> 
> 
> -- 
> ptxdist mailing list
> ptxdist@pengutronix.de
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [ptxdist] [PATCH] host-e2fsprogs: Fix build on Darwin
  2012-01-19 21:14 ` Michael Olbrich
@ 2012-01-19 21:36   ` Bernhard Walle
  0 siblings, 0 replies; 3+ messages in thread
From: Bernhard Walle @ 2012-01-19 21:36 UTC (permalink / raw)
  To: ptxdist

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>
---
 .../0003-Fix-compilation-on-Darwin.patch           |   44 ++++++++++++++++++++
 patches/e2fsprogs-1.41.14/series                   |    3 +-
 2 files changed, 46 insertions(+), 1 deletions(-)
 create mode 100644 patches/e2fsprogs-1.41.14/0003-Fix-compilation-on-Darwin.patch

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 0000000..cb58afd
--- /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 fac473a..44a543e 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
-- 
1.7.7.4


-- 
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-01-19 21:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-19 18:54 [ptxdist] [PATCH] host-e2fsprogs: Fix build on Darwin Bernhard Walle
2012-01-19 21:14 ` Michael Olbrich
2012-01-19 21:36   ` Bernhard Walle

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox