xref: /OK3568_Linux_fs/kernel/include/uapi/linux/fcntl.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
2*4882a593Smuzhiyun #ifndef _UAPI_LINUX_FCNTL_H
3*4882a593Smuzhiyun #define _UAPI_LINUX_FCNTL_H
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun #include <asm/fcntl.h>
6*4882a593Smuzhiyun #include <linux/openat2.h>
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun #define F_SETLEASE	(F_LINUX_SPECIFIC_BASE + 0)
9*4882a593Smuzhiyun #define F_GETLEASE	(F_LINUX_SPECIFIC_BASE + 1)
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun /*
12*4882a593Smuzhiyun  * Cancel a blocking posix lock; internal use only until we expose an
13*4882a593Smuzhiyun  * asynchronous lock api to userspace:
14*4882a593Smuzhiyun  */
15*4882a593Smuzhiyun #define F_CANCELLK	(F_LINUX_SPECIFIC_BASE + 5)
16*4882a593Smuzhiyun 
17*4882a593Smuzhiyun /* Create a file descriptor with FD_CLOEXEC set. */
18*4882a593Smuzhiyun #define F_DUPFD_CLOEXEC	(F_LINUX_SPECIFIC_BASE + 6)
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun /*
21*4882a593Smuzhiyun  * Request nofications on a directory.
22*4882a593Smuzhiyun  * See below for events that may be notified.
23*4882a593Smuzhiyun  */
24*4882a593Smuzhiyun #define F_NOTIFY	(F_LINUX_SPECIFIC_BASE+2)
25*4882a593Smuzhiyun 
26*4882a593Smuzhiyun /*
27*4882a593Smuzhiyun  * Set and get of pipe page size array
28*4882a593Smuzhiyun  */
29*4882a593Smuzhiyun #define F_SETPIPE_SZ	(F_LINUX_SPECIFIC_BASE + 7)
30*4882a593Smuzhiyun #define F_GETPIPE_SZ	(F_LINUX_SPECIFIC_BASE + 8)
31*4882a593Smuzhiyun 
32*4882a593Smuzhiyun /*
33*4882a593Smuzhiyun  * Set/Get seals
34*4882a593Smuzhiyun  */
35*4882a593Smuzhiyun #define F_ADD_SEALS	(F_LINUX_SPECIFIC_BASE + 9)
36*4882a593Smuzhiyun #define F_GET_SEALS	(F_LINUX_SPECIFIC_BASE + 10)
37*4882a593Smuzhiyun 
38*4882a593Smuzhiyun /*
39*4882a593Smuzhiyun  * Types of seals
40*4882a593Smuzhiyun  */
41*4882a593Smuzhiyun #define F_SEAL_SEAL	0x0001	/* prevent further seals from being set */
42*4882a593Smuzhiyun #define F_SEAL_SHRINK	0x0002	/* prevent file from shrinking */
43*4882a593Smuzhiyun #define F_SEAL_GROW	0x0004	/* prevent file from growing */
44*4882a593Smuzhiyun #define F_SEAL_WRITE	0x0008	/* prevent writes */
45*4882a593Smuzhiyun #define F_SEAL_FUTURE_WRITE	0x0010  /* prevent future writes while mapped */
46*4882a593Smuzhiyun /* (1U << 31) is reserved for signed error codes */
47*4882a593Smuzhiyun 
48*4882a593Smuzhiyun /*
49*4882a593Smuzhiyun  * Set/Get write life time hints. {GET,SET}_RW_HINT operate on the
50*4882a593Smuzhiyun  * underlying inode, while {GET,SET}_FILE_RW_HINT operate only on
51*4882a593Smuzhiyun  * the specific file.
52*4882a593Smuzhiyun  */
53*4882a593Smuzhiyun #define F_GET_RW_HINT		(F_LINUX_SPECIFIC_BASE + 11)
54*4882a593Smuzhiyun #define F_SET_RW_HINT		(F_LINUX_SPECIFIC_BASE + 12)
55*4882a593Smuzhiyun #define F_GET_FILE_RW_HINT	(F_LINUX_SPECIFIC_BASE + 13)
56*4882a593Smuzhiyun #define F_SET_FILE_RW_HINT	(F_LINUX_SPECIFIC_BASE + 14)
57*4882a593Smuzhiyun 
58*4882a593Smuzhiyun /*
59*4882a593Smuzhiyun  * Valid hint values for F_{GET,SET}_RW_HINT. 0 is "not set", or can be
60*4882a593Smuzhiyun  * used to clear any hints previously set.
61*4882a593Smuzhiyun  */
62*4882a593Smuzhiyun #define RWH_WRITE_LIFE_NOT_SET	0
63*4882a593Smuzhiyun #define RWH_WRITE_LIFE_NONE	1
64*4882a593Smuzhiyun #define RWH_WRITE_LIFE_SHORT	2
65*4882a593Smuzhiyun #define RWH_WRITE_LIFE_MEDIUM	3
66*4882a593Smuzhiyun #define RWH_WRITE_LIFE_LONG	4
67*4882a593Smuzhiyun #define RWH_WRITE_LIFE_EXTREME	5
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun /*
70*4882a593Smuzhiyun  * The originally introduced spelling is remained from the first
71*4882a593Smuzhiyun  * versions of the patch set that introduced the feature, see commit
72*4882a593Smuzhiyun  * v4.13-rc1~212^2~51.
73*4882a593Smuzhiyun  */
74*4882a593Smuzhiyun #define RWF_WRITE_LIFE_NOT_SET	RWH_WRITE_LIFE_NOT_SET
75*4882a593Smuzhiyun 
76*4882a593Smuzhiyun /*
77*4882a593Smuzhiyun  * Types of directory notifications that may be requested.
78*4882a593Smuzhiyun  */
79*4882a593Smuzhiyun #define DN_ACCESS	0x00000001	/* File accessed */
80*4882a593Smuzhiyun #define DN_MODIFY	0x00000002	/* File modified */
81*4882a593Smuzhiyun #define DN_CREATE	0x00000004	/* File created */
82*4882a593Smuzhiyun #define DN_DELETE	0x00000008	/* File removed */
83*4882a593Smuzhiyun #define DN_RENAME	0x00000010	/* File renamed */
84*4882a593Smuzhiyun #define DN_ATTRIB	0x00000020	/* File changed attibutes */
85*4882a593Smuzhiyun #define DN_MULTISHOT	0x80000000	/* Don't remove notifier */
86*4882a593Smuzhiyun 
87*4882a593Smuzhiyun /*
88*4882a593Smuzhiyun  * The constants AT_REMOVEDIR and AT_EACCESS have the same value.  AT_EACCESS is
89*4882a593Smuzhiyun  * meaningful only to faccessat, while AT_REMOVEDIR is meaningful only to
90*4882a593Smuzhiyun  * unlinkat.  The two functions do completely different things and therefore,
91*4882a593Smuzhiyun  * the flags can be allowed to overlap.  For example, passing AT_REMOVEDIR to
92*4882a593Smuzhiyun  * faccessat would be undefined behavior and thus treating it equivalent to
93*4882a593Smuzhiyun  * AT_EACCESS is valid undefined behavior.
94*4882a593Smuzhiyun  */
95*4882a593Smuzhiyun #define AT_FDCWD		-100    /* Special value used to indicate
96*4882a593Smuzhiyun                                            openat should use the current
97*4882a593Smuzhiyun                                            working directory. */
98*4882a593Smuzhiyun #define AT_SYMLINK_NOFOLLOW	0x100   /* Do not follow symbolic links.  */
99*4882a593Smuzhiyun #define AT_EACCESS		0x200	/* Test access permitted for
100*4882a593Smuzhiyun                                            effective IDs, not real IDs.  */
101*4882a593Smuzhiyun #define AT_REMOVEDIR		0x200   /* Remove directory instead of
102*4882a593Smuzhiyun                                            unlinking file.  */
103*4882a593Smuzhiyun #define AT_SYMLINK_FOLLOW	0x400   /* Follow symbolic links.  */
104*4882a593Smuzhiyun #define AT_NO_AUTOMOUNT		0x800	/* Suppress terminal automount traversal */
105*4882a593Smuzhiyun #define AT_EMPTY_PATH		0x1000	/* Allow empty relative pathname */
106*4882a593Smuzhiyun 
107*4882a593Smuzhiyun #define AT_STATX_SYNC_TYPE	0x6000	/* Type of synchronisation required from statx() */
108*4882a593Smuzhiyun #define AT_STATX_SYNC_AS_STAT	0x0000	/* - Do whatever stat() does */
109*4882a593Smuzhiyun #define AT_STATX_FORCE_SYNC	0x2000	/* - Force the attributes to be sync'd with the server */
110*4882a593Smuzhiyun #define AT_STATX_DONT_SYNC	0x4000	/* - Don't sync attributes with the server */
111*4882a593Smuzhiyun 
112*4882a593Smuzhiyun #define AT_RECURSIVE		0x8000	/* Apply to the entire subtree */
113*4882a593Smuzhiyun 
114*4882a593Smuzhiyun #endif /* _UAPI_LINUX_FCNTL_H */
115