diff --git a/src/mount.rs b/src/mount.rs index 13b11e5fe1..6cef3fb58f 100644 --- a/src/mount.rs +++ b/src/mount.rs @@ -1,4 +1,5 @@ use libc::{c_ulong, c_int}; +use libc; use {Errno, Result, NixPath}; bitflags!( @@ -48,23 +49,6 @@ bitflags!( } ); -mod ffi { - use libc::{c_char, c_int, c_ulong, c_void}; - - extern { - pub fn mount( - source: *const c_char, - target: *const c_char, - fstype: *const c_char, - flags: c_ulong, - data: *const c_void) -> c_int; - - pub fn umount(target: *const c_char) -> c_int; - - pub fn umount2(target: *const c_char, flags: c_int) -> c_int; - } -} - pub fn mount( source: Option<&P1>, target: &P2, @@ -79,7 +63,7 @@ pub fn mount(target: &P) -> Result<()> { let res = try!(target.with_nix_path(|cstr| { - unsafe { ffi::umount(cstr.as_ptr()) } + unsafe { libc::umount(cstr.as_ptr()) } })); Errno::result(res).map(drop) @@ -103,7 +87,7 @@ pub fn umount(target: &P) -> Result<()> { pub fn umount2(target: &P, flags: MntFlags) -> Result<()> { let res = try!(target.with_nix_path(|cstr| { - unsafe { ffi::umount2(cstr.as_ptr(), flags.bits) } + unsafe { libc::umount2(cstr.as_ptr(), flags.bits) } })); Errno::result(res).map(drop)