Skip to content
Snippets Groups Projects
Verified Commit 5e5656f1 authored by Jeremy Soller's avatar Jeremy Soller
Browse files

Make mount points not require an extra reference

parent 86b0d612
No related branches found
No related tags found
No related merge requests found
...@@ -20,7 +20,7 @@ const TTL: Timespec = Timespec { sec: 1, nsec: 0 }; // 1 second ...@@ -20,7 +20,7 @@ const TTL: Timespec = Timespec { sec: 1, nsec: 0 }; // 1 second
const NULL_TIME: Timespec = Timespec { sec: 0, nsec: 0 }; const NULL_TIME: Timespec = Timespec { sec: 0, nsec: 0 };
pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: filesystem::FileSystem<D>, mountpoint: &P, mut callback: F, options: &[&OsStr]) -> io::Result<()> { pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: filesystem::FileSystem<D>, mountpoint: P, mut callback: F, options: &[&OsStr]) -> io::Result<()> {
let mut session = Session::new(Fuse { let mut session = Session::new(Fuse {
fs: filesystem fs: filesystem
}, mountpoint.as_ref(), options)?; }, mountpoint.as_ref(), options)?;
......
...@@ -11,7 +11,7 @@ mod fuse; ...@@ -11,7 +11,7 @@ mod fuse;
mod redox; mod redox;
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mountpoint: &P, callback: F) -> io::Result<()> { pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mountpoint: P, callback: F) -> io::Result<()> {
use std::ffi::OsStr; use std::ffi::OsStr;
fuse::mount(filesystem, mountpoint, callback, &[ fuse::mount(filesystem, mountpoint, callback, &[
...@@ -25,11 +25,11 @@ pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mou ...@@ -25,11 +25,11 @@ pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mou
} }
#[cfg(all(not(target_os = "macos"), not(target_os = "redox")))] #[cfg(all(not(target_os = "macos"), not(target_os = "redox")))]
pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mountpoint: &P, callback: F) -> io::Result<()> { pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mountpoint: P, callback: F) -> io::Result<()> {
fuse::mount(filesystem, mountpoint, callback, &[]) fuse::mount(filesystem, mountpoint, callback, &[])
} }
#[cfg(target_os = "redox")] #[cfg(target_os = "redox")]
pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mountpoint: &P, callback: F) -> io::Result<()> { pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mountpoint: P, callback: F) -> io::Result<()> {
redox::mount(filesystem, mountpoint, callback) redox::mount(filesystem, mountpoint, callback)
} }
...@@ -14,7 +14,7 @@ use self::scheme::FileScheme; ...@@ -14,7 +14,7 @@ use self::scheme::FileScheme;
pub mod resource; pub mod resource;
pub mod scheme; pub mod scheme;
pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mountpoint: &P, mut callback: F) -> io::Result<()> { pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mountpoint: P, mut callback: F) -> io::Result<()> {
let mountpoint = mountpoint.as_ref(); let mountpoint = mountpoint.as_ref();
let mut socket = File::create(format!(":{}", mountpoint.display()))?; let mut socket = File::create(format!(":{}", mountpoint.display()))?;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment