Patchwork [39/50] uclibc_0.9.32: Implement sync_file_range2.

login
register
mail settings
Submitter Saul Wold
Date July 20, 2011, 8:28 a.m.
Message ID <c1e38312fe3efff38610002ac534d90e32a2f669.1311150183.git.sgw@linux.intel.com>
Download mbox | patch
Permalink /patch/8011/
State New, archived
Headers show

Comments

Saul Wold - July 20, 2011, 8:28 a.m.
From: Khem Raj <raj.khem@gmail.com>

On some arches e.g. arm, ppc sync_file_range2 is used
instead of sync_file_range so we should consider that

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 .../uclibc/uclibc-0.9.32/sync_file_range2.patch    |   40 ++++++++++++++++++++
 meta/recipes-core/uclibc/uclibc_0.9.32.bb          |    3 +-
 2 files changed, 42 insertions(+), 1 deletions(-)
 create mode 100644 meta/recipes-core/uclibc/uclibc-0.9.32/sync_file_range2.patch
Phil Blundell - July 20, 2011, 9:04 a.m.
On Wed, 2011-07-20 at 01:28 -0700, Saul Wold wrote:
> --- /dev/null
> +++ b/meta/recipes-core/uclibc/uclibc-0.9.32/sync_file_range2.patch
> @@ -0,0 +1,40 @@
> +Index: git/libc/sysdeps/linux/common/sync_file_range.c

This new patch seems to be missing Signed-off-by and Upstream-Status.
Functionally though it does look much better than the old one.

p.

Patch

diff --git a/meta/recipes-core/uclibc/uclibc-0.9.32/sync_file_range2.patch b/meta/recipes-core/uclibc/uclibc-0.9.32/sync_file_range2.patch
new file mode 100644
index 0000000..b5e972e
--- /dev/null
+++ b/meta/recipes-core/uclibc/uclibc-0.9.32/sync_file_range2.patch
@@ -0,0 +1,40 @@ 
+Index: git/libc/sysdeps/linux/common/sync_file_range.c
+===================================================================
+--- git.orig/libc/sysdeps/linux/common/sync_file_range.c	2011-07-19 14:23:35.000000000 -0700
++++ git/libc/sysdeps/linux/common/sync_file_range.c	2011-07-19 15:04:38.631808666 -0700
+@@ -11,7 +11,8 @@
+ #if defined __USE_GNU
+ #include <fcntl.h>
+ 
+-#if defined __NR_sync_file_range && defined __UCLIBC_HAS_LFS__
++#if defined __UCLIBC_HAS_LFS__
++#if defined __NR_sync_file_range
+ #define __NR___syscall_sync_file_range __NR_sync_file_range
+ static __inline__ _syscall6(int, __syscall_sync_file_range, int, fd,
+ 		off_t, offset_hi, off_t, offset_lo,
+@@ -23,5 +24,23 @@
+ 		__LONG_LONG_PAIR((long)(nbytes >> 32), (long)(nbytes & 0xffffffff)),
+ 		flags);
+ }
+-#endif
+-#endif
++#elif defined __NR_sync_file_range2
++#define __NR___syscall_sync_file_range2 __NR_sync_file_range2
++static __inline__ _syscall6(int, __syscall_sync_file_range2, int, fd,
++		unsigned int, flags, off_t, offset_hi, off_t, offset_lo,
++		off_t, nbytes_hi, off_t, nbytes_lo)
++int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags)
++{
++	return __syscall_sync_file_range2(fd, flags,
++		__LONG_LONG_PAIR((long)(offset >> 32), (long)(offset & 0xffffffff)),
++		__LONG_LONG_PAIR((long)(nbytes >> 32), (long)(nbytes & 0xffffffff)));
++}
++#else
++int sync_file_range(int fd, off64_t offset, off64_t nbytes, unsigned int flags)
++{
++	__set_errno (ENOSYS);
++	return -1
++}
++#endif /* __NR_sync_file_range */
++#endif /* __UCLIBC_HAS_LFS__ */
++#endif /* __USE_GNU */
diff --git a/meta/recipes-core/uclibc/uclibc_0.9.32.bb b/meta/recipes-core/uclibc/uclibc_0.9.32.bb
index b959279..8dcb260 100644
--- a/meta/recipes-core/uclibc/uclibc_0.9.32.bb
+++ b/meta/recipes-core/uclibc/uclibc_0.9.32.bb
@@ -1,7 +1,7 @@ 
 SRCREV="9152c4d67c763fde5712e2d181d92c0d7e1e2ab9"
 
 require uclibc.inc
-PR = "${INC_PR}.1"
+PR = "${INC_PR}.2"
 PROVIDES += "virtual/${TARGET_PREFIX}libc-for-gcc"
 
 SRC_URI = "git://uclibc.org/uClibc.git;branch=${PV};protocol=git \
@@ -28,5 +28,6 @@  SRC_URI = "git://uclibc.org/uClibc.git;branch=${PV};protocol=git \
 	file://0001-mips-signalfd.h-SFD_NONBLOCK-for-mips-is-0200-unlike.patch \
 	file://uclibc-execvpe.patch \
 	file://uclibc_scheduler_update.patch \
+	file://sync_file_range2.patch \
 	"
 S = "${WORKDIR}/git"