diff --git a/Cargo.toml b/Cargo.toml index 80e0a89e6947a418811071631c1b956d8b9ba14c..8c9086729f8aa26527761a8dd5c48a2dad3e8d3b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ doc = false redox_syscall = "0.1" uuid = { version = "0.5", features = ["v4"] } -[target.'cfg(unix)'.dependencies] +[target.'cfg(not(target_os = "redox"))'.dependencies] fuse = "0.3" libc = "0.2" time = "0.1" diff --git a/src/bin/mount.rs b/src/bin/mount.rs index d7587a8ca4017bf69617579110db0f396be877a0..7a251bfb76b29ee46b574eb8bb34aace22994239 100644 --- a/src/bin/mount.rs +++ b/src/bin/mount.rs @@ -1,7 +1,7 @@ #![deny(warnings)] -#![cfg_attr(unix, feature(libc))] +#![cfg_attr(not(target_os = "redox"), feature(libc))] -#[cfg(unix)] +#[cfg(not(target_os = "redox"))] extern crate libc; #[cfg(target_os = "redox")] @@ -13,7 +13,7 @@ extern crate uuid; use std::env; use std::fs::File; use std::io::{Read, Write}; -use std::os::unix::io::FromRawFd; +use std::os::unix::io::{FromRawFd, RawFd}; use std::process; use redoxfs::{DiskCache, DiskFile, mount}; @@ -41,18 +41,18 @@ fn setsig() { sigaction(SIGTERM, Some(&sig_action), None).unwrap(); } -#[cfg(unix)] +#[cfg(not(target_os = "redox"))] // on linux, this is implemented properly, so no need for this unscrupulous nonsense! fn setsig() { () } -#[cfg(unix)] +#[cfg(not(target_os = "redox"))] fn fork() -> isize { unsafe { libc::fork() as isize } } -#[cfg(unix)] +#[cfg(not(target_os = "redox"))] fn pipe(pipes: &mut [i32; 2]) -> isize { unsafe { libc::pipe(pipes.as_mut_ptr()) as isize } } @@ -254,8 +254,8 @@ fn main() { let mut pipes = [0; 2]; if pipe(&mut pipes) == 0 { - let mut read = unsafe { File::from_raw_fd(pipes[0]) }; - let write = unsafe { File::from_raw_fd(pipes[1]) }; + let mut read = unsafe { File::from_raw_fd(pipes[0] as RawFd) }; + let write = unsafe { File::from_raw_fd(pipes[1] as RawFd) }; let pid = fork(); if pid == 0 { diff --git a/src/mount/mod.rs b/src/mount/mod.rs index 4bcf5a131b2e6f6dbbd92a24909e04970cf3fd71..892c2642dcb95728a8e0f60c8517d4c07867e9dd 100644 --- a/src/mount/mod.rs +++ b/src/mount/mod.rs @@ -4,13 +4,13 @@ use std::path::Path; use disk::Disk; use filesystem::FileSystem; -#[cfg(unix)] +#[cfg(not(target_os = "redox"))] mod fuse; #[cfg(target_os = "redox")] mod redox; -#[cfg(all(unix, 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<()> { use std::ffi::OsStr; @@ -24,7 +24,7 @@ pub fn mount<D: Disk, P: AsRef<Path>, F: FnMut()>(filesystem: FileSystem<D>, mou ]) } -#[cfg(all(unix, not(target_os = "macos")))] +#[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<()> { fuse::mount(filesystem, mountpoint, callback, &[]) }