linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: "Jason A . Donenfeld" <Jason@zx2c4.com>,
	Nicholas Piggin <npiggin@gmail.com>
Subject: [PATCH 2/2] powerpc: move sync_file_range2 compat definition
Date: Wed, 12 Oct 2022 13:53:35 +1000	[thread overview]
Message-ID: <20221012035335.866440-2-npiggin@gmail.com> (raw)
In-Reply-To: <20221012035335.866440-1-npiggin@gmail.com>

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@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


  reply	other threads:[~2022-10-12  4:04 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-12  3:53 [PATCH 1/2] powerpc/32: fix syscall wrappers with 64-bit arguments of unaligned register-pairs Nicholas Piggin
2022-10-12  3:53 ` Nicholas Piggin [this message]
2022-10-12 10:21   ` [PATCH 2/2] powerpc: move sync_file_range2 compat definition Arnd Bergmann
2022-10-12  7:56 ` [PATCH 1/2] powerpc/32: fix syscall wrappers with 64-bit arguments of unaligned register-pairs Andrew Donnellan
2022-10-12 10:15 ` Arnd Bergmann
2022-10-14 23:21 ` (subset) " Michael Ellerman
2022-10-30 17:03 ` Andreas Schwab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221012035335.866440-2-npiggin@gmail.com \
    --to=npiggin@gmail.com \
    --cc=Jason@zx2c4.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).