Skip to content

Commit

Permalink
rafs: fix compile error for macos
Browse files Browse the repository at this point in the history
Fix the compile error for macos due to upgrading fuse-backend-rs.

Signed-off-by: Xin Yin <[email protected]>
  • Loading branch information
Xin Yin committed Dec 6, 2023
1 parent db8db96 commit d5028ff
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion rafs/src/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,15 @@ impl FileSystem for Rafs {
type Inode = Inode;
type Handle = Handle;

#[cfg(target_os = "macos")]
fn init(&self, _opts: FsOptions) -> Result<FsOptions> {
Ok(
// These fuse features are supported by rafs by default.
FsOptions::ASYNC_READ | FsOptions::BIG_WRITES | FsOptions::ATOMIC_O_TRUNC,
)
}

#[cfg(target_os = "linux")]
fn init(&self, _opts: FsOptions) -> Result<FsOptions> {
Ok(
// These fuse features are supported by rafs by default.
Expand Down Expand Up @@ -823,7 +832,10 @@ impl FileSystem for Rafs {
_flags: u32,
) -> Result<(Option<Self::Handle>, OpenOptions)> {
// Cache dir since we are readonly
Ok((None, OpenOptions::CACHE_DIR | OpenOptions::KEEP_CACHE))
#[cfg(target_os = "macos")]
return Ok((None, OpenOptions::KEEP_CACHE));
#[cfg(target_os = "linux")]
return Ok((None, OpenOptions::CACHE_DIR | OpenOptions::KEEP_CACHE));
}

fn releasedir(&self, _ctx: &Context, _inode: u64, _flags: u32, _handle: u64) -> Result<()> {
Expand Down

0 comments on commit d5028ff

Please sign in to comment.