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