From c9cd8d8f6391fdec1197031f6ef384ec8beeaa56 Mon Sep 17 00:00:00 2001 From: Alex Saveau Date: Thu, 15 Aug 2024 11:33:49 -0700 Subject: [PATCH 1/2] Remove incorrect mount API Signed-off-by: Alex Saveau --- src/mount/mount_unmount.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/mount/mount_unmount.rs b/src/mount/mount_unmount.rs index db6cc1b33..4e20a1dcb 100644 --- a/src/mount/mount_unmount.rs +++ b/src/mount/mount_unmount.rs @@ -19,18 +19,18 @@ pub fn mount>, ) -> 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, ) }) }) @@ -49,6 +49,8 @@ pub fn mount( source: Option, target: Target, From 986d0b536fe218d66338fc9c82bfdb46ed876501 Mon Sep 17 00:00:00 2001 From: Alex Saveau Date: Sat, 8 Feb 2025 15:38:02 -0500 Subject: [PATCH 2/2] Address review comments Signed-off-by: Alex Saveau --- src/mount/mount_unmount.rs | 39 ++------------------------------------ 1 file changed, 2 insertions(+), 37 deletions(-) diff --git a/src/mount/mount_unmount.rs b/src/mount/mount_unmount.rs index 4e20a1dcb..bb9aa0921 100644 --- a/src/mount/mount_unmount.rs +++ b/src/mount/mount_unmount.rs @@ -14,12 +14,12 @@ 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: impl Into>, + data: impl Into>, ) -> io::Result<()> { source.into_with_c_str(|source| { target.into_with_c_str(|target| { @@ -38,41 +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