[PATCH v4 02/20] powerpc: Use generic fallocate compatibility syscall

Nicholas Piggin npiggin at gmail.com
Mon Sep 12 18:38:43 AEST 2022


On Wed Aug 24, 2022 at 12:05 PM AEST, Rohan McLure wrote:
> The powerpc fallocate compat syscall handler is identical to the
> generic implementation provided by commit 59c10c52f573f ("riscv:
> compat: syscall: Add compat_sys_call_table implementation"), and as
> such can be removed in favour of the generic implementation.
>
> A future patch series will replace more architecture-defined syscall
> handlers with generic implementations, dependent on introducing generic
> implementations that are compatible with powerpc and arm's parameter
> reorderings.
>
> Reported-by: Arnd Bergmann <arnd at arndb.de>
> Signed-off-by: Rohan McLure <rmclure at linux.ibm.com>
> ---
> V1 -> V2: Remove arch-specific fallocate handler.
> V2 -> V3: Remove generic fallocate prototype. Move to beginning of
> series.
> ---
>  arch/powerpc/include/asm/compat.h   | 5 +++++
>  arch/powerpc/include/asm/syscalls.h | 2 --
>  arch/powerpc/include/asm/unistd.h   | 1 +
>  3 files changed, 6 insertions(+), 2 deletions(-)
>
> diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h
> index dda4091fd012..f20caae3f019 100644
> --- a/arch/powerpc/include/asm/compat.h
> +++ b/arch/powerpc/include/asm/compat.h
> @@ -16,6 +16,11 @@ typedef u16		compat_ipc_pid_t;
>  #include <asm-generic/compat.h>
>  
>  #ifdef __BIG_ENDIAN__
> +#define compat_arg_u64(name)		u32  name##_hi, u32  name##_lo
> +#define compat_arg_u64_dual(name)	u32, name##_hi, u32, name##_lo
> +#define compat_arg_u64_glue(name)	(((u64)name##_lo & 0xffffffffUL) | \
> +					 ((u64)name##_hi << 32))

Is there a reason not to put this in asm-generic/compat.h?

Possibly you want to put this with the other compat definitions and
above the asm-generic include. The generic header expects the arch to
include it after defining what it wants to override.

Not sure why x_lo gets cast from u32 to u64 and masked before the |
there, but generic code does the same so this isn't the place to
change it.

Thanks,
Nick


> +
>  #define COMPAT_UTS_MACHINE	"ppc\0\0"
>  #else
>  #define COMPAT_UTS_MACHINE	"ppcle\0\0"
> diff --git a/arch/powerpc/include/asm/syscalls.h b/arch/powerpc/include/asm/syscalls.h
> index 21c2faaa2957..675a8f5ec3ca 100644
> --- a/arch/powerpc/include/asm/syscalls.h
> +++ b/arch/powerpc/include/asm/syscalls.h
> @@ -39,8 +39,6 @@ compat_ssize_t compat_sys_readahead(int fd, u32 r4, u32 offset1, u32 offset2, u3
>  int compat_sys_truncate64(const char __user *path, u32 reg4,
>  			  unsigned long len1, unsigned long len2);
>  
> -long compat_sys_fallocate(int fd, int mode, u32 offset1, u32 offset2, u32 len1, u32 len2);
> -
>  int compat_sys_ftruncate64(unsigned int fd, u32 reg4, unsigned long len1,
>  			   unsigned long len2);
>  
> diff --git a/arch/powerpc/include/asm/unistd.h b/arch/powerpc/include/asm/unistd.h
> index b1129b4ef57d..659a996c75aa 100644
> --- a/arch/powerpc/include/asm/unistd.h
> +++ b/arch/powerpc/include/asm/unistd.h
> @@ -45,6 +45,7 @@
>  #define __ARCH_WANT_SYS_UTIME
>  #define __ARCH_WANT_SYS_NEWFSTATAT
>  #define __ARCH_WANT_COMPAT_STAT
> +#define __ARCH_WANT_COMPAT_FALLOCATE
>  #define __ARCH_WANT_COMPAT_SYS_SENDFILE
>  #endif
>  #define __ARCH_WANT_SYS_FORK
> -- 
> 2.34.1



More information about the Linuxppc-dev mailing list