xref: /openbmc/linux/include/linux/fcntl.h (revision 612a462a)
1 #ifndef _LINUX_FCNTL_H
2 #define _LINUX_FCNTL_H
3 
4 #include <uapi/linux/fcntl.h>
5 
6 /* list of all valid flags for the open/openat flags argument: */
7 #define VALID_OPEN_FLAGS \
8 	(O_RDONLY | O_WRONLY | O_RDWR | O_CREAT | O_EXCL | O_NOCTTY | O_TRUNC | \
9 	 O_APPEND | O_NDELAY | O_NONBLOCK | O_NDELAY | __O_SYNC | O_DSYNC | \
10 	 FASYNC	| O_DIRECT | O_LARGEFILE | O_DIRECTORY | O_NOFOLLOW | \
11 	 O_NOATIME | O_CLOEXEC | O_PATH | __O_TMPFILE)
12 
13 #ifndef force_o_largefile
14 #define force_o_largefile() (BITS_PER_LONG != 32)
15 #endif
16 
17 #if BITS_PER_LONG == 32
18 #define IS_GETLK32(cmd)		((cmd) == F_GETLK)
19 #define IS_SETLK32(cmd)		((cmd) == F_SETLK)
20 #define IS_SETLKW32(cmd)	((cmd) == F_SETLKW)
21 #define IS_GETLK64(cmd)		((cmd) == F_GETLK64)
22 #define IS_SETLK64(cmd)		((cmd) == F_SETLK64)
23 #define IS_SETLKW64(cmd)	((cmd) == F_SETLKW64)
24 #else
25 #define IS_GETLK32(cmd)		(0)
26 #define IS_SETLK32(cmd)		(0)
27 #define IS_SETLKW32(cmd)	(0)
28 #define IS_GETLK64(cmd)		((cmd) == F_GETLK)
29 #define IS_SETLK64(cmd)		((cmd) == F_SETLK)
30 #define IS_SETLKW64(cmd)	((cmd) == F_SETLKW)
31 #endif /* BITS_PER_LONG == 32 */
32 
33 #define IS_GETLK(cmd)	(IS_GETLK32(cmd)  || IS_GETLK64(cmd))
34 #define IS_SETLK(cmd)	(IS_SETLK32(cmd)  || IS_SETLK64(cmd))
35 #define IS_SETLKW(cmd)	(IS_SETLKW32(cmd) || IS_SETLKW64(cmd))
36 
37 #endif
38