[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20180318174014.GR30522@ZenIV.linux.org.uk>
Date: Sun, 18 Mar 2018 17:40:14 +0000
From: Al Viro <viro@...IV.linux.org.uk>
To: Dominik Brodowski <linux@...inikbrodowski.net>
Cc: linux-kernel@...r.kernel.org, torvalds@...ux-foundation.org,
arnd@...db.de, linux-arch@...r.kernel.org,
Ralf Baechle <ralf@...ux-mips.org>,
James Hogan <jhogan@...nel.org>, linux-mips@...ux-mips.org,
Benjamin Herrenschmidt <benh@...nel.crashing.org>,
Paul Mackerras <paulus@...ba.org>,
Michael Ellerman <mpe@...erman.id.au>,
linuxppc-dev@...ts.ozlabs.org,
Martin Schwidefsky <schwidefsky@...ibm.com>,
Heiko Carstens <heiko.carstens@...ibm.com>,
linux-s390@...r.kernel.org,
"David S . Miller" <davem@...emloft.net>,
sparclinux@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
Jiri Slaby <jslaby@...e.com>, x86@...nel.org
Subject: Re: [RFC PATCH 4/6] mm: provide generic compat_sys_readahead()
implementation
On Sun, Mar 18, 2018 at 05:10:54PM +0100, Dominik Brodowski wrote:
> +#ifdef __ARCH_WANT_COMPAT_SYS_READAHEAD
> +#if defined(__ARCH_WANT_COMPAT_SYS_WITH_PADDING) && \
> + defined(__ARCH_WANT_LE_COMPAT_SYS)
> +COMPAT_SYSCALL_DEFINE5(readahead, int, fd, unsigned int, padding,
> + unsigned int, off_lo, unsigned int, off_hi,
> + size_t, count)
> +#elif defined(__ARCH_WANT_COMPAT_SYS_WITH_PADDING) && \
> + !defined(__ARCH_WANT_LE_COMPAT_SYS)
> +COMPAT_SYSCALL_DEFINE5(readahead, int, fd, unsigned int, padding,
> + unsigned int, off_hi, unsigned int, off_lo,
> + size_t, count)
> +#elif !defined(__ARCH_WANT_COMPAT_SYS_WITH_PADDING) && \
> + defined(__ARCH_WANT_LE_COMPAT_SYS)
> +COMPAT_SYSCALL_DEFINE4(readahead, int, fd,
> + unsigned int, off_lo, unsigned int, off_hi,
> + size_t, count)
> +#else /* no padding, big endian */
> +COMPAT_SYSCALL_DEFINE4(readahead, int, fd,
> + unsigned int, off_hi, unsigned int, off_lo,
> + size_t, count)
> +#endif
> +{
> + return do_readahead(fd, ((u64) off_hi << 32) | off_lo, count);
> }
*UGH*
static inline compat_to_u64(u32 w0, u32 w1)
{
#ifdef __BIG_ENDIAN
return ((u64)w0 << 32) | w1;
#else
return ((u64)w1 << 32) | w0;
#endif
}
in compat.h, then this turns into
#ifdef __ARCH_WANT_COMPAT_SYS_WITH_PADDING
COMPAT_SYSCALL_DEFINE5(readahead, int, fd, unsigned int, padding,
u32, off0, u32 off1,
compat_size_t, count)
#else
COMPAT_SYSCALL_DEFINE4(readahead, int, fd,
u32, off0, u32 off1,
compat_size_t, count)
#endif
{
return do_readahead(fd, compat_to_u64(off0, off1), count);
}
Powered by blists - more mailing lists