• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 use crate::backend::c;
2 use bitflags::bitflags;
3 
4 bitflags! {
5     /// `MS_*` constants for use with [`mount`].
6     ///
7     /// [`mount`]: crate::mount::mount
8     #[repr(transparent)]
9     #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
10     pub struct MountFlags: c::c_uint {
11         /// `MS_BIND`
12         const BIND = linux_raw_sys::general::MS_BIND;
13 
14         /// `MS_DIRSYNC`
15         const DIRSYNC = linux_raw_sys::general::MS_DIRSYNC;
16 
17         /// `MS_LAZYTIME`
18         const LAZYTIME = linux_raw_sys::general::MS_LAZYTIME;
19 
20         /// `MS_MANDLOCK`
21         #[doc(alias = "MANDLOCK")]
22         const PERMIT_MANDATORY_FILE_LOCKING = linux_raw_sys::general::MS_MANDLOCK;
23 
24         /// `MS_NOATIME`
25         const NOATIME = linux_raw_sys::general::MS_NOATIME;
26 
27         /// `MS_NODEV`
28         const NODEV = linux_raw_sys::general::MS_NODEV;
29 
30         /// `MS_NODIRATIME`
31         const NODIRATIME = linux_raw_sys::general::MS_NODIRATIME;
32 
33         /// `MS_NOEXEC`
34         const NOEXEC = linux_raw_sys::general::MS_NOEXEC;
35 
36         /// `MS_NOSUID`
37         const NOSUID = linux_raw_sys::general::MS_NOSUID;
38 
39         /// `MS_RDONLY`
40         const RDONLY = linux_raw_sys::general::MS_RDONLY;
41 
42         /// `MS_REC`
43         const REC = linux_raw_sys::general::MS_REC;
44 
45         /// `MS_RELATIME`
46         const RELATIME = linux_raw_sys::general::MS_RELATIME;
47 
48         /// `MS_SILENT`
49         const SILENT = linux_raw_sys::general::MS_SILENT;
50 
51         /// `MS_STRICTATIME`
52         const STRICTATIME = linux_raw_sys::general::MS_STRICTATIME;
53 
54         /// `MS_SYNCHRONOUS`
55         const SYNCHRONOUS = linux_raw_sys::general::MS_SYNCHRONOUS;
56 
57         /// `MS_NOSYMFOLLOW`
58         const NOSYMFOLLOW = linux_raw_sys::general::MS_NOSYMFOLLOW;
59 
60         /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
61         const _ = !0;
62     }
63 }
64 
65 bitflags! {
66     /// `MNT_*` constants for use with [`unmount`].
67     ///
68     /// [`unmount`]: crate::mount::unmount
69     #[repr(transparent)]
70     #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
71     pub struct UnmountFlags: c::c_uint {
72         /// `MNT_FORCE`
73         const FORCE = linux_raw_sys::general::MNT_FORCE;
74         /// `MNT_DETACH`
75         const DETACH = linux_raw_sys::general::MNT_DETACH;
76         /// `MNT_EXPIRE`
77         const EXPIRE = linux_raw_sys::general::MNT_EXPIRE;
78         /// `UMOUNT_NOFOLLOW`
79         const NOFOLLOW = linux_raw_sys::general::UMOUNT_NOFOLLOW;
80 
81         /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
82         const _ = !0;
83     }
84 }
85 
86 #[cfg(feature = "mount")]
87 bitflags! {
88     /// `FSOPEN_*` constants for use with [`fsopen`].
89     ///
90     /// [`fsopen`]: crate::mount::fsopen
91     #[repr(transparent)]
92     #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
93     pub struct FsOpenFlags: c::c_uint {
94         /// `FSOPEN_CLOEXEC`
95         const FSOPEN_CLOEXEC = linux_raw_sys::general::FSOPEN_CLOEXEC;
96 
97         /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
98         const _ = !0;
99     }
100 }
101 
102 #[cfg(feature = "mount")]
103 bitflags! {
104     /// `FSMOUNT_*` constants for use with [`fsmount`].
105     ///
106     /// [`fsmount`]: crate::mount::fsmount
107     #[repr(transparent)]
108     #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
109     pub struct FsMountFlags: c::c_uint {
110         /// `FSMOUNT_CLOEXEC`
111         const FSMOUNT_CLOEXEC = linux_raw_sys::general::FSMOUNT_CLOEXEC;
112 
113         /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
114         const _ = !0;
115     }
116 }
117 
118 /// `FSCONFIG_*` constants for use with the `fsconfig` syscall.
119 #[cfg(feature = "mount")]
120 #[derive(Debug, Copy, Clone, Eq, PartialEq)]
121 #[repr(u32)]
122 pub(crate) enum FsConfigCmd {
123     /// `FSCONFIG_SET_FLAG`
124     SetFlag = linux_raw_sys::general::fsconfig_command::FSCONFIG_SET_FLAG as u32,
125 
126     /// `FSCONFIG_SET_STRING`
127     SetString = linux_raw_sys::general::fsconfig_command::FSCONFIG_SET_STRING as u32,
128 
129     /// `FSCONFIG_SET_BINARY`
130     SetBinary = linux_raw_sys::general::fsconfig_command::FSCONFIG_SET_BINARY as u32,
131 
132     /// `FSCONFIG_SET_PATH`
133     SetPath = linux_raw_sys::general::fsconfig_command::FSCONFIG_SET_PATH as u32,
134 
135     /// `FSCONFIG_SET_PATH_EMPTY`
136     SetPathEmpty = linux_raw_sys::general::fsconfig_command::FSCONFIG_SET_PATH_EMPTY as u32,
137 
138     /// `FSCONFIG_SET_FD`
139     SetFd = linux_raw_sys::general::fsconfig_command::FSCONFIG_SET_FD as u32,
140 
141     /// `FSCONFIG_CMD_CREATE`
142     Create = linux_raw_sys::general::fsconfig_command::FSCONFIG_CMD_CREATE as u32,
143 
144     /// `FSCONFIG_CMD_RECONFIGURE`
145     Reconfigure = linux_raw_sys::general::fsconfig_command::FSCONFIG_CMD_RECONFIGURE as u32,
146 }
147 
148 #[cfg(feature = "mount")]
149 bitflags! {
150     /// `MOUNT_ATTR_*` constants for use with [`fsmount`].
151     ///
152     /// [`fsmount`]: crate::mount::fsmount
153     #[repr(transparent)]
154     #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
155     pub struct MountAttrFlags: c::c_uint {
156         /// `MOUNT_ATTR_RDONLY`
157         const MOUNT_ATTR_RDONLY = linux_raw_sys::general::MOUNT_ATTR_RDONLY;
158 
159         /// `MOUNT_ATTR_NOSUID`
160         const MOUNT_ATTR_NOSUID = linux_raw_sys::general::MOUNT_ATTR_NOSUID;
161 
162         /// `MOUNT_ATTR_NODEV`
163         const MOUNT_ATTR_NODEV = linux_raw_sys::general::MOUNT_ATTR_NODEV;
164 
165         /// `MOUNT_ATTR_NOEXEC`
166         const MOUNT_ATTR_NOEXEC = linux_raw_sys::general::MOUNT_ATTR_NOEXEC;
167 
168         /// `MOUNT_ATTR__ATIME`
169         const MOUNT_ATTR__ATIME = linux_raw_sys::general::MOUNT_ATTR__ATIME;
170 
171         /// `MOUNT_ATTR_RELATIME`
172         const MOUNT_ATTR_RELATIME = linux_raw_sys::general::MOUNT_ATTR_RELATIME;
173 
174         /// `MOUNT_ATTR_NOATIME`
175         const MOUNT_ATTR_NOATIME = linux_raw_sys::general::MOUNT_ATTR_NOATIME;
176 
177         /// `MOUNT_ATTR_STRICTATIME`
178         const MOUNT_ATTR_STRICTATIME = linux_raw_sys::general::MOUNT_ATTR_STRICTATIME;
179 
180         /// `MOUNT_ATTR_NODIRATIME`
181         const MOUNT_ATTR_NODIRATIME = linux_raw_sys::general::MOUNT_ATTR_NODIRATIME;
182 
183         /// `MOUNT_ATTR_NOUSER`
184         const MOUNT_ATTR_IDMAP = linux_raw_sys::general::MOUNT_ATTR_IDMAP;
185 
186         /// `MOUNT_ATTR__ATIME_FLAGS`
187         const MOUNT_ATTR_NOSYMFOLLOW = linux_raw_sys::general::MOUNT_ATTR_NOSYMFOLLOW;
188 
189         /// `MOUNT_ATTR__ATIME_FLAGS`
190         const MOUNT_ATTR_SIZE_VER0 = linux_raw_sys::general::MOUNT_ATTR_SIZE_VER0;
191 
192         /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
193         const _ = !0;
194     }
195 }
196 
197 #[cfg(feature = "mount")]
198 bitflags! {
199     /// `MOVE_MOUNT_*` constants for use with [`move_mount`].
200     ///
201     /// [`move_mount`]: crate::mount::move_mount
202     #[repr(transparent)]
203     #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
204     pub struct MoveMountFlags: c::c_uint {
205         /// `MOVE_MOUNT_F_EMPTY_PATH`
206         const MOVE_MOUNT_F_SYMLINKS = linux_raw_sys::general::MOVE_MOUNT_F_SYMLINKS;
207 
208         /// `MOVE_MOUNT_F_AUTOMOUNTS`
209         const MOVE_MOUNT_F_AUTOMOUNTS = linux_raw_sys::general::MOVE_MOUNT_F_AUTOMOUNTS;
210 
211         /// `MOVE_MOUNT_F_EMPTY_PATH`
212         const MOVE_MOUNT_F_EMPTY_PATH = linux_raw_sys::general::MOVE_MOUNT_F_EMPTY_PATH;
213 
214         /// `MOVE_MOUNT_T_SYMLINKS`
215         const MOVE_MOUNT_T_SYMLINKS = linux_raw_sys::general::MOVE_MOUNT_T_SYMLINKS;
216 
217         /// `MOVE_MOUNT_T_AUTOMOUNTS`
218         const MOVE_MOUNT_T_AUTOMOUNTS = linux_raw_sys::general::MOVE_MOUNT_T_AUTOMOUNTS;
219 
220         /// `MOVE_MOUNT_T_EMPTY_PATH`
221         const MOVE_MOUNT_T_EMPTY_PATH = linux_raw_sys::general::MOVE_MOUNT_T_EMPTY_PATH;
222 
223         /// `MOVE_MOUNT__MASK`
224         const MOVE_MOUNT_SET_GROUP = linux_raw_sys::general::MOVE_MOUNT_SET_GROUP;
225 
226         // TODO: add when Linux 6.5 is released
227         // /// `MOVE_MOUNT_BENEATH`
228         // const MOVE_MOUNT_BENEATH = linux_raw_sys::general::MOVE_MOUNT_BENEATH;
229 
230         /// `MOVE_MOUNT__MASK`
231         const MOVE_MOUNT__MASK = linux_raw_sys::general::MOVE_MOUNT__MASK;
232 
233         /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
234         const _ = !0;
235     }
236 }
237 
238 #[cfg(feature = "mount")]
239 bitflags! {
240     /// `OPENTREE_*` constants for use with [`open_tree`].
241     ///
242     /// [`open_tree`]: crate::mount::open_tree
243     #[repr(transparent)]
244     #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
245     pub struct OpenTreeFlags: c::c_uint {
246         /// `OPENTREE_CLONE`
247         const OPEN_TREE_CLONE = linux_raw_sys::general::OPEN_TREE_CLONE;
248 
249         /// `OPENTREE_CLOEXEC`
250         const OPEN_TREE_CLOEXEC = linux_raw_sys::general::OPEN_TREE_CLOEXEC;
251 
252         /// `AT_EMPTY_PATH`
253         const AT_EMPTY_PATH = linux_raw_sys::general::AT_EMPTY_PATH;
254 
255         /// `AT_NO_AUTOMOUNT`
256         const AT_NO_AUTOMOUNT = linux_raw_sys::general::AT_NO_AUTOMOUNT;
257 
258         /// `AT_RECURSIVE`
259         const AT_RECURSIVE = linux_raw_sys::general::AT_RECURSIVE;
260 
261         /// `AT_SYMLINK_NOFOLLOW`
262         const AT_SYMLINK_NOFOLLOW = linux_raw_sys::general::AT_SYMLINK_NOFOLLOW;
263 
264         /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
265         const _ = !0;
266     }
267 }
268 
269 #[cfg(feature = "mount")]
270 bitflags! {
271     /// `FSPICK_*` constants for use with [`fspick`].
272     ///
273     /// [`fspick`]: crate::mount::fspick
274     #[repr(transparent)]
275     #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
276     pub struct FsPickFlags: c::c_uint {
277         /// `FSPICK_CLOEXEC`
278         const FSPICK_CLOEXEC = linux_raw_sys::general::FSPICK_CLOEXEC;
279 
280         /// `FSPICK_SYMLINK_NOFOLLOW`
281         const FSPICK_SYMLINK_NOFOLLOW = linux_raw_sys::general::FSPICK_SYMLINK_NOFOLLOW;
282 
283         /// `FSPICK_NO_AUTOMOUNT`
284         const FSPICK_NO_AUTOMOUNT = linux_raw_sys::general::FSPICK_NO_AUTOMOUNT;
285 
286         /// `FSPICK_EMPTY_PATH`
287         const FSPICK_EMPTY_PATH = linux_raw_sys::general::FSPICK_EMPTY_PATH;
288 
289         /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
290         const _ = !0;
291     }
292 }
293 
294 bitflags! {
295     /// `MS_*` constants for use with [`mount_change`].
296     ///
297     /// [`mount_change`]: crate::mount::mount_change
298     #[repr(transparent)]
299     #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
300     pub struct MountPropagationFlags: c::c_uint {
301         /// `MS_SILENT`
302         const SILENT = linux_raw_sys::general::MS_SILENT;
303         /// `MS_SHARED`
304         const SHARED = linux_raw_sys::general::MS_SHARED;
305         /// `MS_PRIVATE`
306         const PRIVATE = linux_raw_sys::general::MS_PRIVATE;
307         /// `MS_SLAVE`
308         const SLAVE = linux_raw_sys::general::MS_SLAVE;
309         /// `MS_UNBINDABLE`
310         const UNBINDABLE = linux_raw_sys::general::MS_UNBINDABLE;
311         /// `MS_REC`
312         const REC = linux_raw_sys::general::MS_REC;
313 
314         /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
315         const _ = !0;
316     }
317 }
318 
319 bitflags! {
320     #[repr(transparent)]
321     #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
322     pub(crate) struct InternalMountFlags: c::c_uint {
323         const REMOUNT = linux_raw_sys::general::MS_REMOUNT;
324         const MOVE = linux_raw_sys::general::MS_MOVE;
325 
326         /// <https://docs.rs/bitflags/*/bitflags/#externally-defined-flags>
327         const _ = !0;
328     }
329 }
330 
331 #[repr(transparent)]
332 pub(crate) struct MountFlagsArg(pub(crate) c::c_uint);
333