]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
selftests/pidfd: move syscall definitions into wrappers.h
authorAmir Goldstein <amir73il@gmail.com>
Fri, 9 May 2025 13:32:35 +0000 (15:32 +0200)
committerChristian Brauner <brauner@kernel.org>
Mon, 12 May 2025 09:40:12 +0000 (11:40 +0200)
There was already duplicity in some of the defintions.

Remove syscall number defintions for __ia64__ that are
both stale and incorrect.

Signed-off-by: Amir Goldstein <amir73il@gmail.com>
Link: https://lore.kernel.org/20250509133240.529330-4-amir73il@gmail.com
Reviewed-by: Christian Brauner <brauner@kernel.org>
Signed-off-by: Christian Brauner <brauner@kernel.org>
tools/testing/selftests/filesystems/wrappers.h
tools/testing/selftests/pidfd/pidfd_bind_mount.c

index b9b090ef47b476979d03e95cf569c0ee4d7d0fd2..420ae4f908cf2d9cfa4328ffb04cba7fecd58897 100644 (file)
@@ -40,6 +40,28 @@ static inline int sys_mount(const char *src, const char *tgt, const char *fst,
 #define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 /* Empty from path permitted */
 #endif
 
+#ifndef MOVE_MOUNT_T_EMPTY_PATH
+#define MOVE_MOUNT_T_EMPTY_PATH 0x00000040 /* Empty to path permitted */
+#endif
+
+#ifndef __NR_move_mount
+       #if defined __alpha__
+               #define __NR_move_mount 539
+       #elif defined _MIPS_SIM
+               #if _MIPS_SIM == _MIPS_SIM_ABI32        /* o32 */
+                       #define __NR_move_mount 4429
+               #endif
+               #if _MIPS_SIM == _MIPS_SIM_NABI32       /* n32 */
+                       #define __NR_move_mount 6429
+               #endif
+               #if _MIPS_SIM == _MIPS_SIM_ABI64        /* n64 */
+                       #define __NR_move_mount 5429
+               #endif
+       #else
+               #define __NR_move_mount 429
+       #endif
+#endif
+
 static inline int sys_move_mount(int from_dfd, const char *from_pathname,
                                 int to_dfd, const char *to_pathname,
                                 unsigned int flags)
@@ -57,7 +79,25 @@ static inline int sys_move_mount(int from_dfd, const char *from_pathname,
 #endif
 
 #ifndef AT_RECURSIVE
-#define AT_RECURSIVE 0x8000
+#define AT_RECURSIVE 0x8000 /* Apply to the entire subtree */
+#endif
+
+#ifndef __NR_open_tree
+       #if defined __alpha__
+               #define __NR_open_tree 538
+       #elif defined _MIPS_SIM
+               #if _MIPS_SIM == _MIPS_SIM_ABI32        /* o32 */
+                       #define __NR_open_tree 4428
+               #endif
+               #if _MIPS_SIM == _MIPS_SIM_NABI32       /* n32 */
+                       #define __NR_open_tree 6428
+               #endif
+               #if _MIPS_SIM == _MIPS_SIM_ABI64        /* n64 */
+                       #define __NR_open_tree 5428
+               #endif
+       #else
+               #define __NR_open_tree 428
+       #endif
 #endif
 
 static inline int sys_open_tree(int dfd, const char *filename, unsigned int flags)
index 7822dd080258b12786660c3a7d94f8dd5fe5b76f..c094aeb1c620e4692e6840e2e73b9ebcaaa2fb50 100644 (file)
 
 #include "pidfd.h"
 #include "../kselftest_harness.h"
-
-#ifndef __NR_open_tree
-       #if defined __alpha__
-               #define __NR_open_tree 538
-       #elif defined _MIPS_SIM
-               #if _MIPS_SIM == _MIPS_SIM_ABI32        /* o32 */
-                       #define __NR_open_tree 4428
-               #endif
-               #if _MIPS_SIM == _MIPS_SIM_NABI32       /* n32 */
-                       #define __NR_open_tree 6428
-               #endif
-               #if _MIPS_SIM == _MIPS_SIM_ABI64        /* n64 */
-                       #define __NR_open_tree 5428
-               #endif
-       #elif defined __ia64__
-               #define __NR_open_tree (428 + 1024)
-       #else
-               #define __NR_open_tree 428
-       #endif
-#endif
-
-#ifndef __NR_move_mount
-       #if defined __alpha__
-               #define __NR_move_mount 539
-       #elif defined _MIPS_SIM
-               #if _MIPS_SIM == _MIPS_SIM_ABI32        /* o32 */
-                       #define __NR_move_mount 4429
-               #endif
-               #if _MIPS_SIM == _MIPS_SIM_NABI32       /* n32 */
-                       #define __NR_move_mount 6429
-               #endif
-               #if _MIPS_SIM == _MIPS_SIM_ABI64        /* n64 */
-                       #define __NR_move_mount 5429
-               #endif
-       #elif defined __ia64__
-               #define __NR_move_mount (428 + 1024)
-       #else
-               #define __NR_move_mount 429
-       #endif
-#endif
-
-#ifndef MOVE_MOUNT_F_EMPTY_PATH
-#define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 /* Empty from path permitted */
-#endif
-
-#ifndef MOVE_MOUNT_F_EMPTY_PATH
-#define MOVE_MOUNT_T_EMPTY_PATH 0x00000040 /* Empty to path permitted */
-#endif
-
-static inline int sys_move_mount(int from_dfd, const char *from_pathname,
-                                 int to_dfd, const char *to_pathname,
-                                 unsigned int flags)
-{
-        return syscall(__NR_move_mount, from_dfd, from_pathname, to_dfd,
-                       to_pathname, flags);
-}
-
-#ifndef OPEN_TREE_CLONE
-#define OPEN_TREE_CLONE 1
-#endif
-
-#ifndef OPEN_TREE_CLOEXEC
-#define OPEN_TREE_CLOEXEC O_CLOEXEC
-#endif
-
-#ifndef AT_RECURSIVE
-#define AT_RECURSIVE 0x8000 /* Apply to the entire subtree */
-#endif
-
-static inline int sys_open_tree(int dfd, const char *filename, unsigned int flags)
-{
-       return syscall(__NR_open_tree, dfd, filename, flags);
-}
+#include "../filesystems/wrappers.h"
 
 FIXTURE(pidfd_bind_mount) {
        char template[PATH_MAX];