diff options
Diffstat (limited to 'vendor/rustix/src/fs/mount.rs')
-rw-r--r-- | vendor/rustix/src/fs/mount.rs | 209 |
1 files changed, 44 insertions, 165 deletions
diff --git a/vendor/rustix/src/fs/mount.rs b/vendor/rustix/src/fs/mount.rs index 1439b1f32..d1e6a8238 100644 --- a/vendor/rustix/src/fs/mount.rs +++ b/vendor/rustix/src/fs/mount.rs @@ -1,166 +1,45 @@ //! Linux `mount`. - -use crate::backend::fs::types::{ - InternalMountFlags, MountFlags, MountFlagsArg, MountPropagationFlags, UnmountFlags, -}; -use crate::{backend, io, path}; - -/// `mount(source, target, filesystemtype, mountflags, data)` -/// -/// # References -/// - [Linux] -/// -/// [Linux]: https://man7.org/linux/man-pages/man2/mount.2.html -#[inline] -pub fn mount<Source: path::Arg, Target: path::Arg, Fs: path::Arg, Data: path::Arg>( - source: Source, - target: Target, - file_system_type: Fs, - flags: MountFlags, - data: Data, -) -> io::Result<()> { - source.into_with_c_str(|source| { - target.into_with_c_str(|target| { - file_system_type.into_with_c_str(|file_system_type| { - data.into_with_c_str(|data| { - backend::fs::syscalls::mount( - Some(source), - target, - Some(file_system_type), - MountFlagsArg(flags.bits()), - Some(data), - ) - }) - }) - }) - }) -} - -/// `mount(NULL, target, NULL, MS_REMOUNT | mountflags, data)` -/// -/// # References -/// - [Linux] -/// -/// [Linux]: https://man7.org/linux/man-pages/man2/mount.2.html -#[inline] -#[doc(alias = "mount")] -pub fn remount<Target: path::Arg, Data: path::Arg>( - target: Target, - flags: MountFlags, - data: Data, -) -> io::Result<()> { - target.into_with_c_str(|target| { - data.into_with_c_str(|data| { - backend::fs::syscalls::mount( - None, - target, - None, - MountFlagsArg(InternalMountFlags::REMOUNT.bits() | flags.bits()), - Some(data), - ) - }) - }) -} - -/// `mount(source, target, NULL, MS_BIND, NULL)` -/// -/// # References -/// - [Linux] -/// -/// [Linux]: https://man7.org/linux/man-pages/man2/mount.2.html -#[inline] -#[doc(alias = "mount")] -pub fn bind_mount<Source: path::Arg, Target: path::Arg>( - source: Source, - target: Target, -) -> io::Result<()> { - source.into_with_c_str(|source| { - target.into_with_c_str(|target| { - backend::fs::syscalls::mount( - Some(source), - target, - None, - MountFlagsArg(MountFlags::BIND.bits()), - None, - ) - }) - }) -} - -/// `mount(source, target, NULL, MS_BIND | MS_REC, NULL)` -/// -/// # References -/// - [Linux] -/// -/// [Linux]: https://man7.org/linux/man-pages/man2/mount.2.html -#[inline] -#[doc(alias = "mount")] -pub fn recursive_bind_mount<Source: path::Arg, Target: path::Arg>( - source: Source, - target: Target, -) -> io::Result<()> { - source.into_with_c_str(|source| { - target.into_with_c_str(|target| { - backend::fs::syscalls::mount( - Some(source), - target, - None, - MountFlagsArg(MountFlags::BIND.bits() | MountPropagationFlags::REC.bits()), - None, - ) - }) - }) -} - -/// `mount(NULL, target, NULL, mountflags, NULL)` -/// -/// # References -/// - [Linux] -/// -/// [Linux]: https://man7.org/linux/man-pages/man2/mount.2.html -#[inline] -#[doc(alias = "mount")] -pub fn change_mount<Target: path::Arg>( - target: Target, - flags: MountPropagationFlags, -) -> io::Result<()> { - target.into_with_c_str(|target| { - backend::fs::syscalls::mount(None, target, None, MountFlagsArg(flags.bits()), None) - }) -} - -/// `mount(source, target, NULL, MS_MOVE, NULL)` -/// -/// # References -/// - [Linux] -/// -/// [Linux]: https://man7.org/linux/man-pages/man2/mount.2.html -#[inline] -#[doc(alias = "mount")] -pub fn move_mount<Source: path::Arg, Target: path::Arg>( - source: Source, - target: Target, -) -> io::Result<()> { - source.into_with_c_str(|source| { - target.into_with_c_str(|target| { - backend::fs::syscalls::mount( - Some(source), - target, - None, - MountFlagsArg(InternalMountFlags::MOVE.bits()), - None, - ) - }) - }) -} - -/// `umount2(target, flags)` -/// -/// # References -/// - [Linux] -/// -/// [Linux]: https://man7.org/linux/man-pages/man2/umount.2.html -#[doc(alias = "umount", alias = "umount2")] -pub fn unmount<Target: path::Arg>(target: Target, flags: UnmountFlags) -> io::Result<()> { - target.into_with_c_str(|target| backend::fs::syscalls::unmount(target, flags)) -} +//! +//! These have been moved to a new `rustix::mount` module. + +#[deprecated(note = "rustix::fs::UnmountFlags` moved to `rustix::mount::UnmountFlags`.")] +pub use crate::mount::UnmountFlags; + +#[deprecated(note = "rustix::fs::MountFlags` moved to `rustix::mount::MountFlags`.")] +pub use crate::mount::MountFlags; + +#[deprecated( + note = "rustix::fs::MountPropagationFlags` moved to `rustix::mount::MountPropagationFlags`." +)] +pub use crate::mount::MountPropagationFlags; + +#[deprecated(note = "`rustix::fs::mount` moved to `rustix::mount::mount`.")] +pub use crate::mount::mount; + +#[deprecated(note = "`rustix::fs::unmount` moved to `rustix::mount::unmount`.")] +pub use crate::mount::unmount; + +#[deprecated( + note = "`rustix::fs::remount` is renamed and moved to `rustix::mount::mount_remount`." +)] +pub use crate::mount::mount_remount as remount; + +#[deprecated( + note = "`rustix::fs::bind_mount` is renamed and moved to `rustix::mount::mount_bind`." +)] +pub use crate::mount::mount_bind as bind_mount; + +#[deprecated( + note = "`rustix::fs::recursive_bind_mount` is renamed and moved to `rustix::mount::mount_recursive_bind`." +)] +pub use crate::mount::mount_recursive_bind as recursive_bind_mount; + +#[deprecated( + note = "`rustix::fs::change_mount` is renamed and moved to `rustix::mount::mount_change`." +)] +pub use crate::mount::mount_change as change_mount; + +#[deprecated( + note = "`rustix::fs::move_mount` is renamed and moved to `rustix::mount::mount_move`." +)] +pub use crate::mount::mount_move as move_mount; |