Skip to content
Snippets Groups Projects
mod.rs 1.22 KiB
Newer Older
Jeremy Soller's avatar
Jeremy Soller committed
use std::io;
use std::path::Path;

use disk::Disk;
use filesystem::FileSystem;

#[cfg(not(target_os = "redox"))]
#[cfg(target_os = "macos")]
Jeremy Soller's avatar
Jeremy Soller committed
pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mountpoint: &P, callback: F) -> io::Result<()> {
Jeremy Soller's avatar
Jeremy Soller committed
    fuse::mount(filesystem, mountpoint, callback, &[
        // One of the uses of this redoxfs fuse wrapper is to populate a filesystem
        // while building the Redox OS kernel. This means that we need to write on
        // a filesystem that belongs to `root`, which in turn means that we need to
        // be `root`, thus that we need to allow `root` to have access.
        OsStr::new("-o"),
        OsStr::new("defer_permissions"),
Jeremy Soller's avatar
Jeremy Soller committed
    ])
#[cfg(all(not(target_os = "macos"), not(target_os = "redox")))]
Jeremy Soller's avatar
Jeremy Soller committed
pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mountpoint: &P, callback: F) -> io::Result<()> {
    fuse::mount(filesystem, mountpoint, callback, &[])
Jeremy Soller's avatar
Jeremy Soller committed
pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mountpoint: &P, callback: F) -> io::Result<()> {
    redox::mount(filesystem, mountpoint, callback)