lkml.org 
[lkml]   [2018]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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);
}

\
 
 \ /
  Last update: 2018-03-18 18:41    [W:0.090 / U:0.296 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site