Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

selftest/powerpc/ptrace: Cleanup duplicate macro definitions

Both core-pkey.c and ptrace-pkey.c tests have
similar macro definitions, move them to "pkeys.h"
and remove the macro definitions from the C file.

Reviewed-by: Ritesh Harjani (IBM) <ritesh.list@gmail.com>
Signed-off-by: Madhavan Srinivasan <maddy@linux.ibm.com>
Link: https://patch.msgid.link/20241216160257.87252-3-maddy@linux.ibm.com

+8 -24
+8
tools/testing/selftests/powerpc/include/pkeys.h
··· 35 35 #define __NR_pkey_alloc 384 36 36 #define __NR_pkey_free 385 37 37 38 + #ifndef NT_PPC_PKEY 39 + #define NT_PPC_PKEY 0x110 40 + #endif 41 + 38 42 #define PKEY_BITS_PER_PKEY 2 39 43 #define NR_PKEYS 32 40 44 #define PKEY_BITS_MASK ((1UL << PKEY_BITS_PER_PKEY) - 1) 45 + 46 + #define AMR_BITS_PER_PKEY 2 47 + #define PKEY_REG_BITS (sizeof(u64) * 8) 48 + #define pkeyshift(pkey) (PKEY_REG_BITS - ((pkey + 1) * AMR_BITS_PER_PKEY)) 41 49 42 50 inline unsigned long pkeyreg_get(void) 43 51 {
-12
tools/testing/selftests/powerpc/ptrace/core-pkey.c
··· 18 18 #include "child.h" 19 19 #include "pkeys.h" 20 20 21 - #ifndef NT_PPC_PKEY 22 - #define NT_PPC_PKEY 0x110 23 - #endif 24 - 25 - #ifndef PKEY_DISABLE_EXECUTE 26 - #define PKEY_DISABLE_EXECUTE 0x4 27 - #endif 28 - 29 - #define AMR_BITS_PER_PKEY 2 30 - #define PKEY_REG_BITS (sizeof(u64) * 8) 31 - #define pkeyshift(pkey) (PKEY_REG_BITS - ((pkey + 1) * AMR_BITS_PER_PKEY)) 32 - 33 21 #define CORE_FILE_LIMIT (5 * 1024 * 1024) /* 5 MB should be enough */ 34 22 35 23 static const char core_pattern_file[] = "/proc/sys/kernel/core_pattern";
-12
tools/testing/selftests/powerpc/ptrace/ptrace-pkey.c
··· 9 9 #include "child.h" 10 10 #include "pkeys.h" 11 11 12 - #ifndef NT_PPC_PKEY 13 - #define NT_PPC_PKEY 0x110 14 - #endif 15 - 16 - #ifndef PKEY_DISABLE_EXECUTE 17 - #define PKEY_DISABLE_EXECUTE 0x4 18 - #endif 19 - 20 - #define AMR_BITS_PER_PKEY 2 21 - #define PKEY_REG_BITS (sizeof(u64) * 8) 22 - #define pkeyshift(pkey) (PKEY_REG_BITS - ((pkey + 1) * AMR_BITS_PER_PKEY)) 23 - 24 12 static const char user_read[] = "[User Read (Running)]"; 25 13 static const char user_write[] = "[User Write (Running)]"; 26 14 static const char ptrace_read_running[] = "[Ptrace Read (Running)]";