@@ -39,7 +39,7 @@ pub use reply::{
39
39
ReplyStatfs , ReplyWrite ,
40
40
} ;
41
41
pub use request:: Request ;
42
- pub use session:: { BackgroundSession , Session , SessionUnmounter } ;
42
+ pub use session:: { BackgroundSession , Session , Unmounter } ;
43
43
#[ cfg( feature = "abi-7-28" ) ]
44
44
use std:: cmp:: max;
45
45
#[ cfg( feature = "abi-7-13" ) ]
@@ -1008,7 +1008,8 @@ pub fn mount<FS: Filesystem, P: AsRef<Path>>(
1008
1008
}
1009
1009
1010
1010
/// Mount the given filesystem to the given mountpoint. This function will
1011
- /// not return until the filesystem is unmounted.
1011
+ /// not return until the filesystem is unmounted. This function requires
1012
+ /// CAP_SYS_ADMIN to run.
1012
1013
///
1013
1014
/// NOTE: This will eventually replace mount(), once the API is stable
1014
1015
pub fn mount2 < FS : Filesystem , P : AsRef < Path > > (
@@ -1017,7 +1018,9 @@ pub fn mount2<FS: Filesystem, P: AsRef<Path>>(
1017
1018
options : & [ MountOption ] ,
1018
1019
) -> io:: Result < ( ) > {
1019
1020
check_option_conflicts ( options, false ) ?;
1020
- Session :: new ( filesystem, mountpoint. as_ref ( ) , options) . and_then ( |mut se| se. run ( ) )
1021
+ let ( mut session, _mount) = Session :: new ( filesystem, mountpoint, options) ?;
1022
+
1023
+ session. run ( )
1021
1024
}
1022
1025
1023
1026
/// Mount the given filesystem using fusermount(1). The binary must exist on
@@ -1028,7 +1031,9 @@ pub fn fusermount(
1028
1031
options : & [ MountOption ] ,
1029
1032
) -> io:: Result < ( ) > {
1030
1033
check_option_conflicts ( options, true ) ?;
1031
- Session :: new_fusermount ( filesystem, mountpoint, options) . and_then ( |mut se| se. run ( ) )
1034
+ let ( mut session, _mount) = Session :: new_fusermount ( filesystem, mountpoint, options) ?;
1035
+
1036
+ session. run ( )
1032
1037
}
1033
1038
1034
1039
/// Mount the given filesystem to the given mountpoint. This function spawns
@@ -1066,7 +1071,9 @@ pub fn spawn_mount2<'a, FS: Filesystem + Send + 'static + 'a, P: AsRef<Path>>(
1066
1071
options : & [ MountOption ] ,
1067
1072
) -> io:: Result < BackgroundSession > {
1068
1073
check_option_conflicts ( options, false ) ?;
1069
- Session :: new ( filesystem, mountpoint. as_ref ( ) , options) . and_then ( |se| se. spawn ( ) )
1074
+
1075
+ let ( session, mount) = Session :: new ( filesystem, mountpoint, options) ?;
1076
+ BackgroundSession :: new ( session, mount)
1070
1077
}
1071
1078
1072
1079
/// Mount the given filesystem to the given mountpoint. This function spawns
@@ -1084,5 +1091,7 @@ pub fn spawn_fusermount<'a, FS: Filesystem + Send + 'static + 'a>(
1084
1091
options : & [ MountOption ] ,
1085
1092
) -> io:: Result < BackgroundSession > {
1086
1093
check_option_conflicts ( options, true ) ?;
1087
- Session :: new_fusermount ( filesystem, mountpoint, options) . and_then ( |se| se. spawn ( ) )
1094
+
1095
+ let ( session, mount) = Session :: new ( filesystem, mountpoint, options) ?;
1096
+ BackgroundSession :: new ( session, mount)
1088
1097
}
0 commit comments