1
- use libc:: { c_ulong, c_int, c_void } ;
2
- use { NixResult , NixPath , from_ffi} ;
1
+ use libc:: { c_ulong, c_int} ;
2
+ use { NixResult , NixPath , AsExtStr , from_ffi} ;
3
3
4
4
bitflags ! (
5
5
flags MsFlags : c_ulong {
@@ -49,29 +49,34 @@ bitflags!(
49
49
) ;
50
50
51
51
mod ffi {
52
- use libc:: { c_char, c_int, c_void , c_ulong } ;
52
+ use libc:: { c_char, c_int} ;
53
53
54
54
extern {
55
+ /*
56
+ * TODO: Bring back
55
57
pub fn mount(
56
58
source: *const c_char,
57
59
target: *const c_char,
58
60
fstype: *const c_char,
59
61
flags: c_ulong,
60
62
data: *const c_void) -> c_int;
63
+ */
61
64
62
65
pub fn umount ( target : * const c_char ) -> c_int ;
63
66
64
67
pub fn umount2 ( target : * const c_char , flags : c_int ) -> c_int ;
65
68
}
66
69
}
67
70
68
- // XXX: Should `data` be a `NixPath` here?
71
+ /*
72
+ * TODO: Bring this back with a test
73
+ *
69
74
pub fn mount<P1: ?Sized + NixPath, P2: ?Sized + NixPath, P3: ?Sized + NixPath, P4: ?Sized + NixPath>(
70
- source : Option < P1 > ,
75
+ source: Option<& P1>,
71
76
target: P2,
72
- fstype : Option < P3 > ,
77
+ fstype: Option<& P3>,
73
78
flags: MsFlags,
74
- data : Option < P4 > ) -> NixResult < ( ) > {
79
+ data: Option<& P4>) -> NixResult<()> {
75
80
use libc;
76
81
77
82
let res = try!(try!(try!(try!(
@@ -80,8 +85,8 @@ pub fn mount<P1: ?Sized + NixPath, P2: ?Sized + NixPath, P3: ?Sized + NixPath, P
80
85
fstype.with_nix_path(|fstype| {
81
86
data.with_nix_path(|data| {
82
87
unsafe {
83
- ffi:: mount ( source,
84
- target,
88
+ ffi::mount(source.as_ext_str() ,
89
+ target.as_ext_str() ,
85
90
fstype,
86
91
flags.bits,
87
92
data as *const libc::c_void)
@@ -93,18 +98,19 @@ pub fn mount<P1: ?Sized + NixPath, P2: ?Sized + NixPath, P3: ?Sized + NixPath, P
93
98
94
99
return from_ffi(res);
95
100
}
101
+ */
96
102
97
- pub fn umount < P : ?Sized + NixPath > ( target : P ) -> NixResult < ( ) > {
103
+ pub fn umount < P : ?Sized + NixPath > ( target : & P ) -> NixResult < ( ) > {
98
104
let res = try!( target. with_nix_path ( |ptr| {
99
- unsafe { ffi:: umount ( ptr) }
105
+ unsafe { ffi:: umount ( ptr. as_ext_str ( ) ) }
100
106
} ) ) ;
101
107
102
108
from_ffi ( res)
103
109
}
104
110
105
- pub fn umount2 < P : ?Sized + NixPath > ( target : P , flags : MntFlags ) -> NixResult < ( ) > {
111
+ pub fn umount2 < P : ?Sized + NixPath > ( target : & P , flags : MntFlags ) -> NixResult < ( ) > {
106
112
let res = try!( target. with_nix_path ( |ptr| {
107
- unsafe { ffi:: umount2 ( ptr, flags. bits ) }
113
+ unsafe { ffi:: umount2 ( ptr. as_ext_str ( ) , flags. bits ) }
108
114
} ) ) ;
109
115
110
116
from_ffi ( res)
0 commit comments