diff --git a/src/mount/mount_unmount.rs b/src/mount/mount_unmount.rs index db6cc1b33..bb9aa0921 100644 --- a/src/mount/mount_unmount.rs +++ b/src/mount/mount_unmount.rs @@ -14,23 +14,23 @@ use crate::{backend, io}; /// /// [Linux]: https://man7.org/linux/man-pages/man2/mount.2.html #[inline] -pub fn mount( +pub fn mount<'a, Source: path::Arg, Target: path::Arg, Fs: path::Arg>( source: Source, target: Target, file_system_type: Fs, flags: MountFlags, - data: Data, + data: impl Into>, ) -> 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| { + option_into_with_c_str(data.into(), |data| { backend::mount::syscalls::mount( Some(source), target, Some(file_system_type), MountFlagsArg(flags.bits()), - Some(data), + data, ) }) }) @@ -38,39 +38,6 @@ pub fn mount( - source: Option, - target: Target, - file_system_type: Option, - flags: MountFlags, - data: Option<&CStr>, -) -> io::Result<()> { - option_into_with_c_str(source, |source| { - target.into_with_c_str(|target| { - option_into_with_c_str(file_system_type, |file_system_type| { - backend::mount::syscalls::mount( - source, - target, - file_system_type, - MountFlagsArg(flags.bits()), - data, - ) - }) - }) - }) -} - /// `mount(NULL, target, NULL, MS_REMOUNT | mountflags, data)` /// /// # References