Debian Codegraph @

src/include/uapi/linux/mount.h

raw
1 #ifndef _LINUX_MOUNT_H
2 #define _LINUX_MOUNT_H
3
4 #include <linux/types.h>
5
6 /*
7 * These are the fs-independent mount-flags: up to 32 flags are supported
8 *
9 * Usage of these is restricted within the kernel to core mount(2) code and
10 * callers of sys_mount() only. Filesystems should be using the SB_*
11 * equivalent instead.
12 */
13 #define MS_RDONLY 1 /* Mount read-only */
14 #define MS_NOSUID 2 /* Ignore suid and sgid bits */
15 #define MS_NODEV 4 /* Disallow access to device special files */
16 #define MS_NOEXEC 8 /* Disallow program execution */
17 #define MS_SYNCHRONOUS 16 /* Writes are synced at once */
18 #define MS_REMOUNT 32 /* Alter flags of a mounted FS */
19 #define MS_MANDLOCK 64 /* Allow mandatory locks on an FS */
20 #define MS_DIRSYNC 128 /* Directory modifications are synchronous */
21 #define MS_NOSYMFOLLOW 256 /* Do not follow symlinks */
22 #define MS_NOATIME 1024 /* Do not update access times. */
23 #define MS_NODIRATIME 2048 /* Do not update directory access times */
24 #define MS_BIND 4096
25 #define MS_MOVE 8192
26 #define MS_REC 16384
27 #define MS_VERBOSE 32768 /* War is peace. Verbosity is silence.
28 MS_VERBOSE is deprecated. */
29 #define MS_SILENT 32768
30 #define MS_POSIXACL (1<<16) /* VFS does not apply the umask */
31 #define MS_UNBINDABLE (1<<17) /* change to unbindable */
32 #define MS_PRIVATE (1<<18) /* change to private */
33 #define MS_SLAVE (1<<19) /* change to slave */
34 #define MS_SHARED (1<<20) /* change to shared */
35 #define MS_RELATIME (1<<21) /* Update atime relative to mtime/ctime. */
36 #define MS_KERNMOUNT (1<<22) /* this is a kern_mount call */
37 #define MS_I_VERSION (1<<23) /* Update inode I_version field */
38 #define MS_STRICTATIME (1<<24) /* Always perform atime updates */
39 #define MS_LAZYTIME (1<<25) /* Update the on-disk [acm]times lazily */
40
41 /* These sb flags are internal to the kernel */
42 #define MS_SUBMOUNT (1<<26)
43 #define MS_NOREMOTELOCK (1<<27)
44 #define MS_NOSEC (1<<28)
45 #define MS_BORN (1<<29)
46 #define MS_ACTIVE (1<<30)
47 #define MS_NOUSER (1<<31)
48
49 /*
50 * Superblock flags that can be altered by MS_REMOUNT
51 */
52 #define MS_RMT_MASK (MS_RDONLY|MS_SYNCHRONOUS|MS_MANDLOCK|MS_I_VERSION|\
53 MS_LAZYTIME)
54
55 /*
56 * Old magic mount flag and mask
57 */
58 #define MS_MGC_VAL 0xC0ED0000
59 #define MS_MGC_MSK 0xffff0000
60
61 /*
62 * open_tree() flags.
63 */
64 #define OPEN_TREE_CLONE (1 << 0) /* Clone the target tree and attach the clone */
65 #define OPEN_TREE_NAMESPACE (1 << 1) /* Clone the target tree into a new mount namespace */
66 #define OPEN_TREE_CLOEXEC O_CLOEXEC /* Close the file on execve() */
67
68 /*
69 * move_mount() flags.
70 */
71 #define MOVE_MOUNT_F_SYMLINKS 0x00000001 /* Follow symlinks on from path */
72 #define MOVE_MOUNT_F_AUTOMOUNTS 0x00000002 /* Follow automounts on from path */
73 #define MOVE_MOUNT_F_EMPTY_PATH 0x00000004 /* Empty from path permitted */
74 #define MOVE_MOUNT_T_SYMLINKS 0x00000010 /* Follow symlinks on to path */
75 #define MOVE_MOUNT_T_AUTOMOUNTS 0x00000020 /* Follow automounts on to path */
76 #define MOVE_MOUNT_T_EMPTY_PATH 0x00000040 /* Empty to path permitted */
77 #define MOVE_MOUNT_SET_GROUP 0x00000100 /* Set sharing group instead */
78 #define MOVE_MOUNT_BENEATH 0x00000200 /* Mount beneath top mount */
79 #define MOVE_MOUNT__MASK 0x00000377
80
81 /*
82 * fsopen() flags.
83 */
84 #define FSOPEN_CLOEXEC 0x00000001
85
86 /*
87 * fspick() flags.
88 */
89 #define FSPICK_CLOEXEC 0x00000001
90 #define FSPICK_SYMLINK_NOFOLLOW 0x00000002
91 #define FSPICK_NO_AUTOMOUNT 0x00000004
92 #define FSPICK_EMPTY_PATH 0x00000008
93
94 /*
95 * The type of fsconfig() call made.
96 */
97 enum fsconfig_command {
98 FSCONFIG_SET_FLAG = 0, /* Set parameter, supplying no value */
99 FSCONFIG_SET_STRING = 1, /* Set parameter, supplying a string value */
100 FSCONFIG_SET_BINARY = 2, /* Set parameter, supplying a binary blob value */
101 FSCONFIG_SET_PATH = 3, /* Set parameter, supplying an object by path */
102 FSCONFIG_SET_PATH_EMPTY = 4, /* Set parameter, supplying an object by (empty) path */
103 FSCONFIG_SET_FD = 5, /* Set parameter, supplying an object by fd */
104 FSCONFIG_CMD_CREATE = 6, /* Create new or reuse existing superblock */
105 FSCONFIG_CMD_RECONFIGURE = 7, /* Invoke superblock reconfiguration */
106 FSCONFIG_CMD_CREATE_EXCL = 8, /* Create new superblock, fail if reusing existing superblock */
107 };
108
109 /*
110 * fsmount() flags.
111 */
112 #define FSMOUNT_CLOEXEC 0x00000001
113 #define FSMOUNT_NAMESPACE 0x00000002 /* Create the mount in a new mount namespace */
114
115 /*
116 * Mount attributes.
117 */
118 #define MOUNT_ATTR_RDONLY 0x00000001 /* Mount read-only */
119 #define MOUNT_ATTR_NOSUID 0x00000002 /* Ignore suid and sgid bits */
120 #define MOUNT_ATTR_NODEV 0x00000004 /* Disallow access to device special files */
121 #define MOUNT_ATTR_NOEXEC 0x00000008 /* Disallow program execution */
122 #define MOUNT_ATTR__ATIME 0x00000070 /* Setting on how atime should be updated */
123 #define MOUNT_ATTR_RELATIME 0x00000000 /* - Update atime relative to mtime/ctime. */
124 #define MOUNT_ATTR_NOATIME 0x00000010 /* - Do not update access times. */
125 #define MOUNT_ATTR_STRICTATIME 0x00000020 /* - Always perform atime updates */
126 #define MOUNT_ATTR_NODIRATIME 0x00000080 /* Do not update directory access times */
127 #define MOUNT_ATTR_IDMAP 0x00100000 /* Idmap mount to @userns_fd in struct mount_attr. */
128 #define MOUNT_ATTR_NOSYMFOLLOW 0x00200000 /* Do not follow symlinks */
129
130 /*
131 * mount_setattr()
132 */
133 struct mount_attr {
134 __u64 attr_set;
135 __u64 attr_clr;
136 __u64 propagation;
137 __u64 userns_fd;
138 };
139
140 /* List of all mount_attr versions. */
141 #define MOUNT_ATTR_SIZE_VER0 32 /* sizeof first published struct */
142
143
144 /*
145 * Structure for getting mount/superblock/filesystem info with statmount(2).
146 *
147 * The interface is similar to statx(2): individual fields or groups can be
148 * selected with the @mask argument of statmount(). Kernel will set the @mask
149 * field according to the supported fields.
150 *
151 * If string fields are selected, then the caller needs to pass a buffer that
152 * has space after the fixed part of the structure. Nul terminated strings are
153 * copied there and offsets relative to @str are stored in the relevant fields.
154 * If the buffer is too small, then EOVERFLOW is returned. The actually used
155 * size is returned in @size.
156 */
157 struct statmount {
158 __u32 size; /* Total size, including strings */
159 __u32 mnt_opts; /* [str] Options (comma separated, escaped) */
160 __u64 mask; /* What results were written */
161 __u32 sb_dev_major; /* Device ID */
162 __u32 sb_dev_minor;
163 __u64 sb_magic; /* ..._SUPER_MAGIC */
164 __u32 sb_flags; /* SB_{RDONLY,SYNCHRONOUS,DIRSYNC,LAZYTIME} */
165 __u32 fs_type; /* [str] Filesystem type */
166 __u64 mnt_id; /* Unique ID of mount */
167 __u64 mnt_parent_id; /* Unique ID of parent (for root == mnt_id) */
168 __u32 mnt_id_old; /* Reused IDs used in proc/.../mountinfo */
169 __u32 mnt_parent_id_old;
170 __u64 mnt_attr; /* MOUNT_ATTR_... */
171 __u64 mnt_propagation; /* MS_{SHARED,SLAVE,PRIVATE,UNBINDABLE} */
172 __u64 mnt_peer_group; /* ID of shared peer group */
173 __u64 mnt_master; /* Mount receives propagation from this ID */
174 __u64 propagate_from; /* Propagation from in current namespace */
175 __u32 mnt_root; /* [str] Root of mount relative to root of fs */
176 __u32 mnt_point; /* [str] Mountpoint relative to current root */
177 __u64 mnt_ns_id; /* ID of the mount namespace */
178 __u32 fs_subtype; /* [str] Subtype of fs_type (if any) */
179 __u32 sb_source; /* [str] Source string of the mount */
180 __u32 opt_num; /* Number of fs options */
181 __u32 opt_array; /* [str] Array of nul terminated fs options */
182 __u32 opt_sec_num; /* Number of security options */
183 __u32 opt_sec_array; /* [str] Array of nul terminated security options */
184 __u64 supported_mask; /* Mask flags that this kernel supports */
185 __u32 mnt_uidmap_num; /* Number of uid mappings */
186 __u32 mnt_uidmap; /* [str] Array of uid mappings (as seen from callers namespace) */
187 __u32 mnt_gidmap_num; /* Number of gid mappings */
188 __u32 mnt_gidmap; /* [str] Array of gid mappings (as seen from callers namespace) */
189 __u64 __spare2[43];
190 char str[]; /* Variable size part containing strings */
191 };
192
193 /*
194 * Structure for passing mount ID and miscellaneous parameters to statmount(2)
195 * and listmount(2).
196 *
197 * For statmount(2) @param represents the request mask.
198 * For listmount(2) @param represents the last listed mount id (or zero).
199 */
200 struct mnt_id_req {
201 __u32 size;
202 union {
203 __u32 mnt_ns_fd;
204 __u32 mnt_fd;
205 };
206 __u64 mnt_id;
207 __u64 param;
208 __u64 mnt_ns_id;
209 };
210
211 /* List of all mnt_id_req versions. */
212 #define MNT_ID_REQ_SIZE_VER0 24 /* sizeof first published struct */
213 #define MNT_ID_REQ_SIZE_VER1 32 /* sizeof second published struct */
214
215 /*
216 * @mask bits for statmount(2)
217 */
218 #define STATMOUNT_SB_BASIC 0x00000001U /* Want/got sb_... */
219 #define STATMOUNT_MNT_BASIC 0x00000002U /* Want/got mnt_... */
220 #define STATMOUNT_PROPAGATE_FROM 0x00000004U /* Want/got propagate_from */
221 #define STATMOUNT_MNT_ROOT 0x00000008U /* Want/got mnt_root */
222 #define STATMOUNT_MNT_POINT 0x00000010U /* Want/got mnt_point */
223 #define STATMOUNT_FS_TYPE 0x00000020U /* Want/got fs_type */
224 #define STATMOUNT_MNT_NS_ID 0x00000040U /* Want/got mnt_ns_id */
225 #define STATMOUNT_MNT_OPTS 0x00000080U /* Want/got mnt_opts */
226 #define STATMOUNT_FS_SUBTYPE 0x00000100U /* Want/got fs_subtype */
227 #define STATMOUNT_SB_SOURCE 0x00000200U /* Want/got sb_source */
228 #define STATMOUNT_OPT_ARRAY 0x00000400U /* Want/got opt_... */
229 #define STATMOUNT_OPT_SEC_ARRAY 0x00000800U /* Want/got opt_sec... */
230 #define STATMOUNT_SUPPORTED_MASK 0x00001000U /* Want/got supported mask flags */
231 #define STATMOUNT_MNT_UIDMAP 0x00002000U /* Want/got uidmap... */
232 #define STATMOUNT_MNT_GIDMAP 0x00004000U /* Want/got gidmap... */
233
234 /*
235 * Special @mnt_id values that can be passed to listmount
236 */
237 #define LSMT_ROOT 0xffffffffffffffff /* root mount */
238 #define LISTMOUNT_REVERSE (1 << 0) /* List later mounts first */
239
240 /*
241 * @flag bits for statmount(2)
242 */
243 #define STATMOUNT_BY_FD 0x00000001U /* want mountinfo for given fd */
244
245 #endif /* _LINUX_MOUNT_H */