[PATCH 2/2] powerpc: move sync_file_range2 compat definition

Nicholas Piggin npiggin at gmail.com
Wed Oct 12 14:53:35 AEDT 2022


sync_file_range2 is not a special unaligned-odd-pair calling convention
syscall, it's just a regular one that does not have a generic compat
definition. Move it out of sys_ppc32.c and into syscalls.c.

Signed-off-by: Nicholas Piggin <npiggin at gmail.com>
---
This one doesn't fix anything and is not required for the previous
fix, so it could be merged later. Now that we've repurposed sys_ppc32.c
for the difficult syscalls and compat syscalls live all over the kernel
now anyway, IMO it's makes things less confusing to move this.

Thanks,
Nick

 arch/powerpc/include/asm/syscalls.h | 23 ++++++++++++-----------
 arch/powerpc/kernel/sys_ppc32.c     | 11 -----------
 arch/powerpc/kernel/syscalls.c      | 11 +++++++++++
 3 files changed, 23 insertions(+), 22 deletions(-)

diff --git a/arch/powerpc/include/asm/syscalls.h b/arch/powerpc/include/asm/syscalls.h
index a1142496cd58..810ce45d670b 100644
--- a/arch/powerpc/include/asm/syscalls.h
+++ b/arch/powerpc/include/asm/syscalls.h
@@ -79,8 +79,20 @@ long compat_sys_old_getrlimit(unsigned int resource,
 			      struct compat_rlimit __user *rlim);
 long compat_sys_sigreturn(void);
 long compat_sys_rt_sigreturn(void);
+long compat_sys_ppc_sync_file_range2(int fd, unsigned int flags,
+				     unsigned int offset1,
+				     unsigned int offset2,
+				     unsigned int nbytes1,
+				     unsigned int nbytes2);
 #endif /* CONFIG_COMPAT */
 
+#if defined(CONFIG_PPC32) || defined(CONFIG_COMPAT)
+long sys_ppc_fadvise64_64(int fd, int advice,
+			  u32 offset_high, u32 offset_low,
+			  u32 len_high, u32 len_low);
+#endif
+
+
 /*
  * Architecture specific signatures required by long long munging:
  * The 32 bit ABI passes long longs in an odd even register pair.
@@ -123,19 +135,8 @@ long compat_sys_ppc_ftruncate64(unsigned int fd, u32 reg4,
 				unsigned long len1, unsigned long len2);
 long compat_sys_ppc32_fadvise64(int fd, u32 unused, u32 offset1, u32 offset2,
 				size_t len, int advice);
-long compat_sys_ppc_sync_file_range2(int fd, unsigned int flags,
-				     unsigned int offset1,
-				     unsigned int offset2,
-				     unsigned int nbytes1,
-				     unsigned int nbytes2);
 #endif /* CONFIG_COMPAT */
 
-#if defined(CONFIG_PPC32) || defined(CONFIG_COMPAT)
-long sys_ppc_fadvise64_64(int fd, int advice,
-			  u32 offset_high, u32 offset_low,
-			  u32 len_high, u32 len_low);
-#endif
-
 #else
 
 #define __SYSCALL_WITH_COMPAT(nr, native, compat)	__SYSCALL(nr, native)
diff --git a/arch/powerpc/kernel/sys_ppc32.c b/arch/powerpc/kernel/sys_ppc32.c
index 6bdfe11a7689..53927abcda82 100644
--- a/arch/powerpc/kernel/sys_ppc32.c
+++ b/arch/powerpc/kernel/sys_ppc32.c
@@ -111,14 +111,3 @@ PPC32_SYSCALL_DEFINE6(ppc32_fadvise64,
 	return ksys_fadvise64_64(fd, merge_64(offset1, offset2), len,
 				 advice);
 }
-
-COMPAT_SYSCALL_DEFINE6(ppc_sync_file_range2,
-		       int, fd, unsigned int, flags,
-		       unsigned int, offset1, unsigned int, offset2,
-		       unsigned int, nbytes1, unsigned int, nbytes2)
-{
-	loff_t offset = merge_64(offset1, offset2);
-	loff_t nbytes = merge_64(nbytes1, nbytes2);
-
-	return ksys_sync_file_range(fd, offset, nbytes, flags);
-}
diff --git a/arch/powerpc/kernel/syscalls.c b/arch/powerpc/kernel/syscalls.c
index 68ebb23a5af4..8bdc41879045 100644
--- a/arch/powerpc/kernel/syscalls.c
+++ b/arch/powerpc/kernel/syscalls.c
@@ -97,6 +97,17 @@ COMPAT_SYSCALL_DEFINE1(ppc64_personality, unsigned long, personality)
 {
 	return do_ppc64_personality(personality);
 }
+
+COMPAT_SYSCALL_DEFINE6(ppc_sync_file_range2,
+		       int, fd, unsigned int, flags,
+		       unsigned int, offset1, unsigned int, offset2,
+		       unsigned int, nbytes1, unsigned int, nbytes2)
+{
+	loff_t offset = merge_64(offset1, offset2);
+	loff_t nbytes = merge_64(nbytes1, nbytes2);
+
+	return ksys_sync_file_range(fd, offset, nbytes, flags);
+}
 #endif /* CONFIG_COMPAT */
 #endif /* CONFIG_PPC64 */
 
-- 
2.37.2



More information about the Linuxppc-dev mailing list