diff --git a/torture/Cargo.toml b/torture/Cargo.toml index 714908bc14..302ab9444d 100644 --- a/torture/Cargo.toml +++ b/torture/Cargo.toml @@ -25,6 +25,4 @@ tracing-subscriber = { version = "0.3.19", features = ["env-filter"] } hex = "0.4.3" futures-util = "0.3.31" clap = { version = "4.5.23", features = ["derive"] } - -[target.'cfg(target_os = "linux")'.dependencies] trickfs = { path = "../trickfs" } diff --git a/torture/src/supervisor/comms.rs b/torture/src/supervisor/comms.rs index 56428868da..872f08e457 100644 --- a/torture/src/supervisor/comms.rs +++ b/torture/src/supervisor/comms.rs @@ -168,11 +168,18 @@ pub fn run(stream: UnixStream) -> (RequestResponse, impl Future bool { - true - } - } else { - pub struct TrickHandle; - - impl TrickHandle { - pub fn set_trigger_enospc(&self, enabled: bool) { - let _ = enabled; - unimplemented!("TrickHandle::set_trigger_enospc"); - } - - pub fn unmount_and_join(self) { - } - } - - pub fn is_supported() -> bool { - false - } - } -} diff --git a/torture/src/supervisor/workload.rs b/torture/src/supervisor/workload.rs index 1b2c79af0a..03d2755760 100644 --- a/torture/src/supervisor/workload.rs +++ b/torture/src/supervisor/workload.rs @@ -244,7 +244,7 @@ pub struct Workload { /// The handle to the trickfs FUSE FS. /// /// `Some` until the workload is torn down. - trick_handle: Option, + trick_handle: Option, /// The currently spawned agent. /// /// Initially `None`. diff --git a/trickfs/README.md b/trickfs/README.md index 023911ad10..c4ef05567c 100644 --- a/trickfs/README.md +++ b/trickfs/README.md @@ -21,3 +21,9 @@ the following commands: sudo apt update sudo apt install libfuse3-dev libfuse-dev ``` + +On macOS you may need to install osxfuse: + +```sh +brew install macfuse +``` diff --git a/trickfs/src/lib.rs b/trickfs/src/lib.rs index cec41ccb7e..53c4057d65 100644 --- a/trickfs/src/lib.rs +++ b/trickfs/src/lib.rs @@ -560,7 +560,11 @@ impl fuser::Filesystem for Trick { let content = &inode_data.content(); if content.is_empty() { // The backing buffer has not yet been created. Let's just return an empty buffer. - if has_odirect(flags) { + #[cfg(target_os = "linux")] + let pageworth = has_odirect(flags); + #[cfg(not(target_os = "linux"))] + let pageworth = false; + if pageworth { reply.data(&[0u8; 4096]); } else { reply.data(&[]); @@ -854,6 +858,7 @@ impl fuser::Filesystem for Trick { } } +#[cfg(target_os = "linux")] fn has_odirect(flags: i32) -> bool { (flags & libc::O_DIRECT) != 0 }