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 <[email protected]>
  • Loading branch information
Xin Yin committed Dec 7, 2023
1 parent de1b2ef commit a8ce6f9
Show file tree
Hide file tree
Showing 2 changed files with 25 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
12 changes: 12 additions & 0 deletions service/src/fusedev.rs
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,18 @@ pub fn create_fuse_daemon(
}

/// Create vfs backend with rafs or passthrough as the fuse filesystem driver

#[cfg(target_os = "macos")]
pub fn create_vfs_backend(
_fs_type: FsBackendType,
_is_fuse: bool,
_hybrid_mode: bool,
) -> Result<Arc<Vfs>> {
let vfs = fuse_backend_rs::api::Vfs::new(fuse_backend_rs::api::VfsOptions::default());
Ok(Arc::new(vfs))
}

#[cfg(target_os = "linux")]
pub fn create_vfs_backend(
fs_type: FsBackendType,
is_fuse: bool,
Expand Down

0 comments on commit a8ce6f9

Please sign in to comment.