Skip to content

Commit

Permalink
builder: 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 <yinxin.x@bytedance.com>
  • Loading branch information
Xin Yin committed Dec 6, 2023
1 parent 362c4f6 commit 2bb9a7c
Show file tree
Hide file tree
Showing 2 changed files with 15 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
2 changes: 2 additions & 0 deletions service/src/fusedev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,7 @@ pub fn create_vfs_backend(
hybrid_mode: bool,
) -> Result<Arc<Vfs>> {
let mut opts = fuse_backend_rs::api::VfsOptions::default();
#[cfg(target_os = "linux")]
match fs_type {
FsBackendType::PassthroughFs => {
// passthroughfs requires !no_open
Expand All @@ -651,6 +652,7 @@ pub fn create_vfs_backend(
}
};

#[cfg(target_os = "linux")]
if !is_fuse && hybrid_mode {
opts.no_open = false;
opts.no_opendir = false;
Expand Down

0 comments on commit 2bb9a7c

Please sign in to comment.