1
1
use libc:: { c_ulong, c_int} ;
2
+ use libc;
2
3
use { Errno , Result , NixPath } ;
3
4
4
5
bitflags ! (
@@ -48,23 +49,6 @@ bitflags!(
48
49
}
49
50
) ;
50
51
51
- mod ffi {
52
- use libc:: { c_char, c_int, c_ulong, c_void} ;
53
-
54
- extern {
55
- pub fn mount (
56
- source : * const c_char ,
57
- target : * const c_char ,
58
- fstype : * const c_char ,
59
- flags : c_ulong ,
60
- data : * const c_void ) -> c_int ;
61
-
62
- pub fn umount ( target : * const c_char ) -> c_int ;
63
-
64
- pub fn umount2 ( target : * const c_char , flags : c_int ) -> c_int ;
65
- }
66
- }
67
-
68
52
pub fn mount < P1 : ?Sized + NixPath , P2 : ?Sized + NixPath , P3 : ?Sized + NixPath , P4 : ?Sized + NixPath > (
69
53
source : Option < & P1 > ,
70
54
target : & P2 ,
@@ -79,7 +63,7 @@ pub fn mount<P1: ?Sized + NixPath, P2: ?Sized + NixPath, P3: ?Sized + NixPath, P
79
63
fstype. with_nix_path ( |fstype| {
80
64
data. with_nix_path ( |data| {
81
65
unsafe {
82
- ffi :: mount ( source. as_ptr ( ) ,
66
+ libc :: mount ( source. as_ptr ( ) ,
83
67
target. as_ptr ( ) ,
84
68
fstype. as_ptr ( ) ,
85
69
flags. bits ,
@@ -95,15 +79,15 @@ pub fn mount<P1: ?Sized + NixPath, P2: ?Sized + NixPath, P3: ?Sized + NixPath, P
95
79
96
80
pub fn umount < P : ?Sized + NixPath > ( target : & P ) -> Result < ( ) > {
97
81
let res = try!( target. with_nix_path ( |cstr| {
98
- unsafe { ffi :: umount ( cstr. as_ptr ( ) ) }
82
+ unsafe { libc :: umount ( cstr. as_ptr ( ) ) }
99
83
} ) ) ;
100
84
101
85
Errno :: result ( res) . map ( drop)
102
86
}
103
87
104
88
pub fn umount2 < P : ?Sized + NixPath > ( target : & P , flags : MntFlags ) -> Result < ( ) > {
105
89
let res = try!( target. with_nix_path ( |cstr| {
106
- unsafe { ffi :: umount2 ( cstr. as_ptr ( ) , flags. bits ) }
90
+ unsafe { libc :: umount2 ( cstr. as_ptr ( ) , flags. bits ) }
107
91
} ) ) ;
108
92
109
93
Errno :: result ( res) . map ( drop)
0 commit comments