powerpc: Use generic fallocate compatibility syscall
PATCH v2 5/14 powerpc: Use generic fallocate compatibility syscall
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.
---
V1 -> V2: Remove arch-specific fallocate handler.
--- arch/powerpc/include/asm/compat.h | 5 +++++ arch/powerpc/include/asm/unistd.h | 1 + arch/powerpc/kernel/asm-offsets.c | 1 + arch/powerpc/kernel/sys_ppc32.c | 8 -------- arch/powerpc/kernel/syscalls/syscall.tbl | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-)
arch/powerpc/include/asm/compat.h +5 -0
@@ -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)) +#define COMPAT_UTS_MACHINE "ppc\0\0"#else #define COMPAT_UTS_MACHINE "ppcle\0\0"
arch/powerpc/include/asm/unistd.h +1 -0
@@ -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
arch/powerpc/kernel/asm-offsets.c +1 -0
@@ -9,6 +9,7 @@* #defines from the assembly-language output. */ +#include <asm/compat.h> #include <linux/compat.h> #include <linux/signal.h> #include <linux/sched.h>
arch/powerpc/kernel/sys_ppc32.c +0 -8
@@ -89,14 +89,6 @@ COMPAT_SYSCALL_DEFINE4(ppc_truncate64,return ksys_truncate (path,merge_64 (len1, len2)); } -COMPAT_SYSCALL_DEFINE6 (ppc_fallocate, - int, fd, int, mode, u32, offset1, u32, offset2, - u32, len1, u32, len2) -{ -return ksys_fallocate (fd, mode, ((loff_t )offset1 <<32 ) | offset2, -merge_64 (len1, len2)); -} -COMPAT_SYSCALL_DEFINE4 (ppc_ftruncate64, unsigned int, fd, u32, reg4, unsigned long, len1, unsigned long, len2)
arch/powerpc/kernel/syscalls/syscall.tbl +1 -1
@@ -391,7 +391,7 @@ 306 common timerfd_create sys_timerfd_create 307 common eventfd sys_eventfd 308 common sync_file_range2 sys_sync_file_range2 compat_sys_ppc_sync_file_range2 -309 nospu fallocate sys_fallocate compat_sys_ppc_fallocate +309 nospu fallocate sys_fallocate compat_sys_fallocate 310 nospu subpage_prot sys_subpage_prot 311 32 timerfd_settime sys_timerfd_settime32 311 64 timerfd_settime sys_timerfd_settime
Signature · 1 line
2.34.1
Quoted 32 lines · Rohan McLure
The powerpc fallocate compat syscall handler is identical to the generic implementation provided by commit
59c10c52f573f("riscv:
compat: syscall: Addcompat_sys_call_tableimplementation"), 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 <[email protected]>Signed-off-by Rohan McLure <[email protected]>---
V1 -> V2: Remove arch-specific fallocate handler.
---arch/powerpc/include/asm/compat.h | 5 +++++ arch/powerpc/include/asm/unistd.h | 1 + arch/powerpc/kernel/asm-offsets.c | 1 + arch/powerpc/kernel/sys_ppc32.c | 8 -------- arch/powerpc/kernel/syscalls/syscall.tbl | 2 +- 5 files changed, 8 insertions(+), 9 deletions(-)arch/powerpc/include/asm/compat.h +0
-0@@ -16,6 +16,11 @@ typedef u16 compat_ipc_pid_t; #include <asm-generic/compat.h>
#ifdef__BIG_ENDIAN__
Quoted 8 lines
+#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 any reason this can't go into include/asm-generic/compat.h?
Quoted 24 lines
#define COMPAT_UTS_MACHINE "ppc\0\0"
#else
#define COMPAT_UTS_MACHINE "ppcle\0\0"arch/powerpc/include/asm/unistd.h +1
-0@@ -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_FORKarch/powerpc/kernel/asm-offsets.c +0
-0@@ -9,6 +9,7 @@* #defines from the assembly-language output. */
Quoted 2 lines
+#include <asm/compat.h>
What's this for?
Quoted 44 lines
#include <
linux/compat.h>
#include <linux/signal.h>
#include <linux/sched.h>arch/powerpc/kernel/sys_ppc32.c +0
-0@@ -89,14 +89,6 @@ COMPAT_SYSCALL_DEFINE4(ppc_truncate64, return ksys_truncate(path, merge_64(len1, len2)); }
-COMPAT_SYSCALL_DEFINE6(ppc_fallocate,
- int, fd, int, mode, u32, offset1, u32, offset2,
- u32, len1, u32, len2)
-{
- return ksys_fallocate(fd, mode, ((loff_t)offset1 << 32) | offset2,
-merge_64(len1, len2));arch/powerpc/kernel/sys_ppc32.c +0
-2-} -COMPAT_SYSCALL_DEFINE4(ppc_ftruncate64,
unsigned int, fd, u32, reg4, unsigned long, len1,
unsigned long, len2)arch/powerpc/kernel/syscalls/syscall.tbl +0
-0@@ -391,7 +391,7 @@306 common timerfd_create sys_timerfd_create 307 common eventfd sys_eventfd 308 common sync_file_range2 sys_sync_file_range2
compat_sys_ppc_sync_file_range2
-
309 nospu fallocate sys_fallocatecompat_sys_ppc_fallocate
+309 nospu fallocate sys_fallocatecompat_sys_fallocate
310 nospu subpage_prot sys_subpage_prot 311 32 timerfd_settime sys_timerfd_settime32 311 64 timerfd_settime sys_timerfd_settime
Signature · 2 lines
Andrew Donnellan OzLabs, ADL Canberra [email protected] IBM Australia Limited
Quoted 9 lines
arch/powerpc/kernel/asm-offsets.c line 12
Quoted 7 lines
arch/powerpc/kernel/asm-offsets.c +1
-0@@ -9,6 +9,7 @@* #defines from the assembly-language output. */ +#include <asm/compat.h> What's this for?
Good spot.