diff mbox

linux: posix_fadvise: restore implementation for xtensa part II

Message ID CAMBAPQ-yiTTiGC5fDzV4=3E48NMGOr=zRjeKPq405j3ccmr0gw@mail.gmail.com
State New
Headers show

Commit Message

valentin popa March 28, 2014, 2:06 p.m. UTC
Hi Baruch,
I've attached a patch that you sent a while ago.
The problem with it is that is made based on an arm fix, and fixes a xtensa
issue, but brakes the other platforms that defines __NR_fadvise64. I can
try to send a patch for this but for sure I will break xtensa, so maybe you
can do it much better.
Thanks!

Comments

Baruch Siach March 28, 2014, 2:35 p.m. UTC | #1
Hi Valentin,

On Fri, Mar 28, 2014 at 04:06:30PM +0200, valentin popa wrote:
> I've attached a patch that you sent a while ago.
> The problem with it is that is made based on an arm fix, and fixes a xtensa
> issue, but brakes the other platforms that defines __NR_fadvise64. I can
> try to send a patch for this but for sure I will break xtensa, so maybe you
> can do it much better.

Does the patch at http://patchwork.ozlabs.org/patch/308533/ fixes your 
problem? If it does, please describe your experience in a reply to this patch 
on the uclibc mailing list. This may increase the chances of this patch to be 
applied to uclibc development tree.

baruch

> From 00571b43df2e0554d1b0716681832ba9975177c5 Mon Sep 17 00:00:00 2001
> From: Baruch Siach <baruch@tkos.co.il>
> Date: Sun, 5 Jan 2014 11:44:02 +0200
> Subject: [PATCH] libc: posix_fadvise: restore implementation for xtensa
> 
> Commit ee84b8b400 (linux: posix_fadvise: use new SYSCALL_ALIGN_64BIT)
> removed posix_fadvise implementation for xtensa, since xtensa does not
> define __NR_fadvise64. Reuse the ARM support code to restore xtensa support.
> 
> This commit is based Mike Frysinger's suggested patch.
> 
> Cc: Mike Frysinger <vapier@gentoo.org>
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
> ---
>  libc/sysdeps/linux/common/posix_fadvise.c | 15 +++++++++++----
>  1 file changed, 11 insertions(+), 4 deletions(-)
> 
> diff --git a/libc/sysdeps/linux/common/posix_fadvise.c b/libc/sysdeps/linux/common/posix_fadvise.c
> index e102ce7..25c2941 100644
> --- a/libc/sysdeps/linux/common/posix_fadvise.c
> +++ b/libc/sysdeps/linux/common/posix_fadvise.c
> @@ -10,18 +10,25 @@
>  
>  #include <sys/syscall.h>
>  
> -#if defined(__NR_fadvise64) || defined(__NR_arm_fadvise64_64)
> +#ifdef __NR_arm_fadvise64_64
> +/* We handle the 64bit alignment issue which is why the arm guys renamed their
> + * syscall in the first place.  So rename it back.
> + */
> +# define __NR_fadvise64_64 __NR_arm_fadvise64_64
> +#endif
> +
> +#if defined(__NR_fadvise64) || defined(__NR_fadvise64_64)
>  # include <fcntl.h>
>  # include <endian.h>
>  # include <bits/wordsize.h>
>  
> -# ifdef __NR_arm_fadvise64_64
> +# ifdef __NR_fadvise64_64
>  int posix_fadvise64(int fd, off64_t offset, off64_t len, int advice);
>  # endif
>  
>  int posix_fadvise(int fd, off_t offset, off_t len, int advice)
>  {
> -# ifdef __NR_arm_fadvise64_64
> +# ifdef __NR_fadvise64_64
>  	return posix_fadvise64(fd, offset, len, advice);
>  # else
>  	int ret;
> @@ -41,7 +48,7 @@ int posix_fadvise(int fd, off_t offset, off_t len, int advice)
>  	return 0;
>  #  endif
>  }
> -# if defined __UCLIBC_HAS_LFS__ && ((!defined __NR_fadvise64_64 && !defined __NR_arm_fadvise64_64) || __WORDSIZE == 64)
> +# if defined __UCLIBC_HAS_LFS__ && (!defined __NR_fadvise64_64 || __WORDSIZE == 64)
>  strong_alias(posix_fadvise,posix_fadvise64)
>  # endif
>  #endif
> -- 
> 1.8.3.2
>
diff mbox

Patch

From 00571b43df2e0554d1b0716681832ba9975177c5 Mon Sep 17 00:00:00 2001
From: Baruch Siach <baruch@tkos.co.il>
Date: Sun, 5 Jan 2014 11:44:02 +0200
Subject: [PATCH] libc: posix_fadvise: restore implementation for xtensa

Commit ee84b8b400 (linux: posix_fadvise: use new SYSCALL_ALIGN_64BIT)
removed posix_fadvise implementation for xtensa, since xtensa does not
define __NR_fadvise64. Reuse the ARM support code to restore xtensa support.

This commit is based Mike Frysinger's suggested patch.

Cc: Mike Frysinger <vapier@gentoo.org>
Signed-off-by: Baruch Siach <baruch@tkos.co.il>
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
 libc/sysdeps/linux/common/posix_fadvise.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/libc/sysdeps/linux/common/posix_fadvise.c b/libc/sysdeps/linux/common/posix_fadvise.c
index e102ce7..25c2941 100644
--- a/libc/sysdeps/linux/common/posix_fadvise.c
+++ b/libc/sysdeps/linux/common/posix_fadvise.c
@@ -10,18 +10,25 @@ 
 
 #include <sys/syscall.h>
 
-#if defined(__NR_fadvise64) || defined(__NR_arm_fadvise64_64)
+#ifdef __NR_arm_fadvise64_64
+/* We handle the 64bit alignment issue which is why the arm guys renamed their
+ * syscall in the first place.  So rename it back.
+ */
+# define __NR_fadvise64_64 __NR_arm_fadvise64_64
+#endif
+
+#if defined(__NR_fadvise64) || defined(__NR_fadvise64_64)
 # include <fcntl.h>
 # include <endian.h>
 # include <bits/wordsize.h>
 
-# ifdef __NR_arm_fadvise64_64
+# ifdef __NR_fadvise64_64
 int posix_fadvise64(int fd, off64_t offset, off64_t len, int advice);
 # endif
 
 int posix_fadvise(int fd, off_t offset, off_t len, int advice)
 {
-# ifdef __NR_arm_fadvise64_64
+# ifdef __NR_fadvise64_64
 	return posix_fadvise64(fd, offset, len, advice);
 # else
 	int ret;
@@ -41,7 +48,7 @@  int posix_fadvise(int fd, off_t offset, off_t len, int advice)
 	return 0;
 #  endif
 }
-# if defined __UCLIBC_HAS_LFS__ && ((!defined __NR_fadvise64_64 && !defined __NR_arm_fadvise64_64) || __WORDSIZE == 64)
+# if defined __UCLIBC_HAS_LFS__ && (!defined __NR_fadvise64_64 || __WORDSIZE == 64)
 strong_alias(posix_fadvise,posix_fadvise64)
 # endif
 #endif
-- 
1.8.3.2