From 6f3f843335004fa71719a474f2a7c4916bd949dc Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 1 Apr 2013 05:09:17 -0400 Subject: linux: use OFF64_HI_LO rather than __LONG_LONG_PAIR This macro takes care of the shift/mask split for us, so no need to open code this ourselves and then use __LONG_LONG_PAIR. Signed-off-by: Mike Frysinger --- libc/sysdeps/linux/common/ftruncate64.c | 10 +++------- libc/sysdeps/linux/common/posix_fadvise.c | 2 +- libc/sysdeps/linux/common/posix_fadvise64.c | 8 +++----- libc/sysdeps/linux/common/posix_fallocate64.c | 7 +------ libc/sysdeps/linux/common/truncate64.c | 10 +++------- 5 files changed, 11 insertions(+), 26 deletions(-) (limited to 'libc/sysdeps') diff --git a/libc/sysdeps/linux/common/ftruncate64.c b/libc/sysdeps/linux/common/ftruncate64.c index c0a373ca1..231d94a33 100644 --- a/libc/sysdeps/linux/common/ftruncate64.c +++ b/libc/sysdeps/linux/common/ftruncate64.c @@ -7,7 +7,7 @@ * and on 32 bit machines this sends things into the kernel as * two 32-bit arguments (high and low 32 bits of length) that * are ordered based on endianess. It turns out endian.h has - * just the macro we need to order things, __LONG_LONG_PAIR. + * just the macro we need to order things, OFF64_HI_LO. */ #include <_lfs_64.h> @@ -29,14 +29,10 @@ _syscall2(int, ftruncate64, int, fd, __off64_t, length) /* The exported ftruncate64 function. */ int ftruncate64 (int fd, __off64_t length) { - uint32_t low = length & 0xffffffff; - uint32_t high = length >> 32; # if defined(__UCLIBC_SYSCALL_ALIGN_64BIT__) - return INLINE_SYSCALL(ftruncate64, - 4, fd, 0, __LONG_LONG_PAIR (high, low)); + return INLINE_SYSCALL(ftruncate64, 4, fd, 0, OFF64_HI_LO(length)); # else - return INLINE_SYSCALL(ftruncate64, 3, fd, - __LONG_LONG_PAIR (high, low)); + return INLINE_SYSCALL(ftruncate64, 3, fd, OFF64_HI_LO(length)); # endif } diff --git a/libc/sysdeps/linux/common/posix_fadvise.c b/libc/sysdeps/linux/common/posix_fadvise.c index 22df56982..f5bbaccb9 100644 --- a/libc/sysdeps/linux/common/posix_fadvise.c +++ b/libc/sysdeps/linux/common/posix_fadvise.c @@ -27,7 +27,7 @@ int posix_fadvise(int fd, off_t offset, off_t len, int advice) # else ret = INTERNAL_SYSCALL(fadvise64, err, 5, fd, # endif - __LONG_LONG_PAIR (offset >> 31, offset), len, advice); + OFF_HI_LO (offset), len, advice); # endif if (INTERNAL_SYSCALL_ERROR_P (ret, err)) return INTERNAL_SYSCALL_ERRNO (ret, err); diff --git a/libc/sysdeps/linux/common/posix_fadvise64.c b/libc/sysdeps/linux/common/posix_fadvise64.c index 067085430..5a302d3c9 100644 --- a/libc/sysdeps/linux/common/posix_fadvise64.c +++ b/libc/sysdeps/linux/common/posix_fadvise64.c @@ -25,13 +25,11 @@ int posix_fadvise64(int fd, off64_t offset, off64_t len, int advice) INTERNAL_SYSCALL_DECL (err); # if defined __powerpc__ || defined __arm__ || defined __xtensa__ int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd, advice, - __LONG_LONG_PAIR((long)(offset >> 32), (long)offset), - __LONG_LONG_PAIR((long)(len >> 32), (long)len)); + OFF64_HI_LO (offset), OFF64_HI_LO (len)); # else int ret = INTERNAL_SYSCALL (fadvise64_64, err, 6, fd, - __LONG_LONG_PAIR((long)(offset >> 32), (long)offset), - __LONG_LONG_PAIR((long)(len >> 32), (long)len), - advice); + OFF64_HI_LO (offset), OFF64_HI_LO (len), + advice); # endif if (INTERNAL_SYSCALL_ERROR_P (ret, err)) return INTERNAL_SYSCALL_ERRNO (ret, err); diff --git a/libc/sysdeps/linux/common/posix_fallocate64.c b/libc/sysdeps/linux/common/posix_fallocate64.c index 818d86884..76dc9b87e 100644 --- a/libc/sysdeps/linux/common/posix_fallocate64.c +++ b/libc/sysdeps/linux/common/posix_fallocate64.c @@ -21,14 +21,9 @@ int posix_fallocate64(int fd, __off64_t offset, __off64_t len) { int ret; - uint32_t off_low = offset & 0xffffffff; - uint32_t off_high = offset >> 32; - uint32_t len_low = len & 0xffffffff; - uint32_t len_high = len >> 32; INTERNAL_SYSCALL_DECL(err); ret = (int) (INTERNAL_SYSCALL(fallocate, err, 6, fd, 0, - __LONG_LONG_PAIR (off_high, off_low), - __LONG_LONG_PAIR (len_high, len_low))); + OFF64_HI_LO (offset), OFF64_HI_LO (len))); if (unlikely(INTERNAL_SYSCALL_ERROR_P (ret, err))) return INTERNAL_SYSCALL_ERRNO (ret, err); return 0; diff --git a/libc/sysdeps/linux/common/truncate64.c b/libc/sysdeps/linux/common/truncate64.c index e2868be15..159c794f5 100644 --- a/libc/sysdeps/linux/common/truncate64.c +++ b/libc/sysdeps/linux/common/truncate64.c @@ -7,7 +7,7 @@ * and on 32 bit machines this sends things into the kernel as * two 32-bit arguments (high and low 32 bits of length) that * are ordered based on endianess. It turns out endian.h has - * just the macro we need to order things, __LONG_LONG_PAIR. + * just the macro we need to order things, OFF64_HI_LO. */ #include <_lfs_64.h> @@ -24,14 +24,10 @@ _syscall2(int, truncate64, const char *, path, __off64_t, length) # include int truncate64(const char * path, __off64_t length) { - uint32_t low = length & 0xffffffff; - uint32_t high = length >> 32; # if defined(__UCLIBC_SYSCALL_ALIGN_64BIT__) - return INLINE_SYSCALL(truncate64, 4, path, 0, - __LONG_LONG_PAIR(high, low)); + return INLINE_SYSCALL(truncate64, 4, path, 0, OFF64_HI_LO(length)); # else - return INLINE_SYSCALL(truncate64, 3, path, - __LONG_LONG_PAIR(high, low)); + return INLINE_SYSCALL(truncate64, 3, path, OFF64_HI_LO(length)); # endif } # else -- cgit v1.2.3