summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorKamal Marhubi <kamal@marhubi.com>2016-01-01 14:24:46 -0500
committerKamal Marhubi <kamal@marhubi.com>2016-01-27 21:37:25 -0500
commitd0881f63ec375b45a0b160a7017e4940b18edf4e (patch)
tree8df74fa69d2c711c16bda885325394c92c034bda /src
parent25ea210ef927c9cdb8fa1c9c6658a0659796e3f4 (diff)
downloadnix-d0881f63ec375b45a0b160a7017e4940b18edf4e.zip
Bring back mount
Fixes https://github.com/carllerche/nix-rust/issues/85
Diffstat (limited to 'src')
-rw-r--r--src/mount.rs21
1 files changed, 7 insertions, 14 deletions
diff --git a/src/mount.rs b/src/mount.rs
index 683cabb8..cd0afa0a 100644
--- a/src/mount.rs
+++ b/src/mount.rs
@@ -49,18 +49,15 @@ bitflags!(
);
mod ffi {
- use libc::{c_char, c_int};
+ use libc::{c_char, c_int, c_ulong, c_void};
extern {
- /*
- * TODO: Bring back
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;
@@ -68,12 +65,9 @@ mod ffi {
}
}
-/*
- * TODO: Bring this back with a test
- *
pub fn mount<P1: ?Sized + NixPath, P2: ?Sized + NixPath, P3: ?Sized + NixPath, P4: ?Sized + NixPath>(
source: Option<&P1>,
- target: P2,
+ target: &P2,
fstype: Option<&P3>,
flags: MsFlags,
data: Option<&P4>) -> Result<()> {
@@ -85,20 +79,19 @@ pub fn mount<P1: ?Sized + NixPath, P2: ?Sized + NixPath, P3: ?Sized + NixPath, P
fstype.with_nix_path(|fstype| {
data.with_nix_path(|data| {
unsafe {
- ffi::mount(source.as_ext_str(),
- target.as_ext_str(),
- fstype,
+ ffi::mount(source.as_ptr(),
+ target.as_ptr(),
+ fstype.as_ptr(),
flags.bits,
- data as *const libc::c_void)
+ data.as_ptr() as *const libc::c_void)
}
})
})
})
})))));
- return from_ffi(res);
+ from_ffi(res)
}
-*/
pub fn umount<P: ?Sized + NixPath>(target: &P) -> Result<()> {
let res = try!(target.with_nix_path(|cstr| {