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

uapi: simplify __ARCH_FLOCK{,64}_PAD a little

Don't bother to define the symbols empty, just don't use them.
That makes the intent a little more clear.

Remove the unused HAVE_ARCH_STRUCT_FLOCK64 define and merge the
32-bit mips struct flock into the generic one.

Add a new __ARCH_FLOCK_EXTRA_SYSID macro following the style of
__ARCH_FLOCK_PAD to avoid having a separate definition just for
one architecture.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Guo Ren <guoren@kernel.org>
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Tested-by: Heiko Stuebner <heiko@sntech.de>
Link: https://lore.kernel.org/r/20220405071314.3225832-2-guoren@kernel.org
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>

authored by

Christoph Hellwig and committed by
Palmer Dabbelt
9f79b8b7 31231092

+17 -47
+3 -23
arch/mips/include/uapi/asm/fcntl.h
··· 50 50 #define F_SETLKW64 35 51 51 #endif 52 52 53 - /* 54 - * The flavours of struct flock. "struct flock" is the ABI compliant 55 - * variant. Finally struct flock64 is the LFS variant of struct flock. As 56 - * a historic accident and inconsistence with the ABI definition it doesn't 57 - * contain all the same fields as struct flock. 58 - */ 59 - 60 53 #if _MIPS_SIM != _MIPS_SIM_ABI64 61 - 62 - #include <linux/types.h> 63 - 64 - struct flock { 65 - short l_type; 66 - short l_whence; 67 - __kernel_off_t l_start; 68 - __kernel_off_t l_len; 69 - long l_sysid; 70 - __kernel_pid_t l_pid; 71 - long pad[4]; 72 - }; 73 - 74 - #define HAVE_ARCH_STRUCT_FLOCK 75 - 76 - #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */ 54 + #define __ARCH_FLOCK_EXTRA_SYSID long l_sysid; 55 + #define __ARCH_FLOCK_PAD long pad[4]; 56 + #endif 77 57 78 58 #include <asm-generic/fcntl.h> 79 59
+7 -12
include/uapi/asm-generic/fcntl.h
··· 192 192 193 193 #define F_LINUX_SPECIFIC_BASE 1024 194 194 195 - #ifndef HAVE_ARCH_STRUCT_FLOCK 196 - #ifndef __ARCH_FLOCK_PAD 197 - #define __ARCH_FLOCK_PAD 198 - #endif 199 - 200 195 struct flock { 201 196 short l_type; 202 197 short l_whence; 203 198 __kernel_off_t l_start; 204 199 __kernel_off_t l_len; 205 200 __kernel_pid_t l_pid; 201 + #ifdef __ARCH_FLOCK_EXTRA_SYSID 202 + __ARCH_FLOCK_EXTRA_SYSID 203 + #endif 204 + #ifdef __ARCH_FLOCK_PAD 206 205 __ARCH_FLOCK_PAD 206 + #endif 207 207 }; 208 - #endif 209 - 210 - #ifndef HAVE_ARCH_STRUCT_FLOCK64 211 - #ifndef __ARCH_FLOCK64_PAD 212 - #define __ARCH_FLOCK64_PAD 213 - #endif 214 208 215 209 struct flock64 { 216 210 short l_type; ··· 212 218 __kernel_loff_t l_start; 213 219 __kernel_loff_t l_len; 214 220 __kernel_pid_t l_pid; 221 + #ifdef __ARCH_FLOCK64_PAD 215 222 __ARCH_FLOCK64_PAD 216 - }; 217 223 #endif 224 + }; 218 225 219 226 #endif /* _ASM_GENERIC_FCNTL_H */
+7 -12
tools/include/uapi/asm-generic/fcntl.h
··· 187 187 188 188 #define F_LINUX_SPECIFIC_BASE 1024 189 189 190 - #ifndef HAVE_ARCH_STRUCT_FLOCK 191 - #ifndef __ARCH_FLOCK_PAD 192 - #define __ARCH_FLOCK_PAD 193 - #endif 194 - 195 190 struct flock { 196 191 short l_type; 197 192 short l_whence; 198 193 __kernel_off_t l_start; 199 194 __kernel_off_t l_len; 200 195 __kernel_pid_t l_pid; 196 + #ifdef __ARCH_FLOCK_EXTRA_SYSID 197 + __ARCH_FLOCK_EXTRA_SYSID 198 + #endif 199 + #ifdef __ARCH_FLOCK_PAD 201 200 __ARCH_FLOCK_PAD 201 + #endif 202 202 }; 203 - #endif 204 - 205 - #ifndef HAVE_ARCH_STRUCT_FLOCK64 206 - #ifndef __ARCH_FLOCK64_PAD 207 - #define __ARCH_FLOCK64_PAD 208 - #endif 209 203 210 204 struct flock64 { 211 205 short l_type; ··· 207 213 __kernel_loff_t l_start; 208 214 __kernel_loff_t l_len; 209 215 __kernel_pid_t l_pid; 216 + #ifdef __ARCH_FLOCK64_PAD 210 217 __ARCH_FLOCK64_PAD 211 - }; 212 218 #endif 219 + }; 213 220 214 221 #endif /* _ASM_GENERIC_FCNTL_H */