summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarl Lerche <me@carllerche.com>2015-02-27 22:41:32 -0800
committerCarl Lerche <me@carllerche.com>2015-02-27 22:41:32 -0800
commit5d7f9c618655472654b79eeb22a9d13ec89035e7 (patch)
treef58dfdaa402cca333e4e5ce17aba097d3177e62a
parente8a58c83a50ef7e197767b5a491050ae91c9e503 (diff)
downloadnix-5d7f9c618655472654b79eeb22a9d13ec89035e7.zip
Temporarily remove mount
-rw-r--r--src/mount.rs32
-rw-r--r--src/unistd.rs2
2 files changed, 20 insertions, 14 deletions
diff --git a/src/mount.rs b/src/mount.rs
index e113b970..c8264559 100644
--- a/src/mount.rs
+++ b/src/mount.rs
@@ -1,5 +1,5 @@
-use libc::{c_ulong, c_int, c_void};
-use {NixResult, NixPath, from_ffi};
+use libc::{c_ulong, c_int};
+use {NixResult, NixPath, AsExtStr, from_ffi};
bitflags!(
flags MsFlags: c_ulong {
@@ -49,15 +49,18 @@ bitflags!(
);
mod ffi {
- use libc::{c_char, c_int, c_void, c_ulong};
+ use libc::{c_char, c_int};
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;
@@ -65,13 +68,15 @@ mod ffi {
}
}
-// XXX: Should `data` be a `NixPath` here?
+/*
+ * 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>,
+ source: Option<&P1>,
target: P2,
- fstype: Option<P3>,
+ fstype: Option<&P3>,
flags: MsFlags,
- data: Option<P4>) -> NixResult<()> {
+ data: Option<&P4>) -> NixResult<()> {
use libc;
let res = try!(try!(try!(try!(
@@ -80,8 +85,8 @@ 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,
- target,
+ ffi::mount(source.as_ext_str(),
+ target.as_ext_str(),
fstype,
flags.bits,
data as *const libc::c_void)
@@ -93,18 +98,19 @@ pub fn mount<P1: ?Sized + NixPath, P2: ?Sized + NixPath, P3: ?Sized + NixPath, P
return from_ffi(res);
}
+*/
-pub fn umount<P: ?Sized + NixPath>(target: P) -> NixResult<()> {
+pub fn umount<P: ?Sized + NixPath>(target: &P) -> NixResult<()> {
let res = try!(target.with_nix_path(|ptr| {
- unsafe { ffi::umount(ptr) }
+ unsafe { ffi::umount(ptr.as_ext_str()) }
}));
from_ffi(res)
}
-pub fn umount2<P: ?Sized + NixPath>(target: P, flags: MntFlags) -> NixResult<()> {
+pub fn umount2<P: ?Sized + NixPath>(target: &P, flags: MntFlags) -> NixResult<()> {
let res = try!(target.with_nix_path(|ptr| {
- unsafe { ffi::umount2(ptr, flags.bits) }
+ unsafe { ffi::umount2(ptr.as_ext_str(), flags.bits) }
}));
from_ffi(res)
diff --git a/src/unistd.rs b/src/unistd.rs
index 47eb667a..a54bba3a 100644
--- a/src/unistd.rs
+++ b/src/unistd.rs
@@ -361,7 +361,7 @@ mod linux {
use {NixError, NixResult, NixPath};
pub fn pivot_root<P1: ?Sized + NixPath, P2: ?Sized + NixPath>(
- new_root: P1, put_old: P2) -> NixResult<()> {
+ new_root: &P1, put_old: &P2) -> NixResult<()> {
let res = try!(try!(new_root.with_nix_path(|new_root| {
put_old.with_nix_path(|put_old| {
unsafe {