From 30ae3c233185b4371e276369961c41b2b1e191e2 Mon Sep 17 00:00:00 2001 From: Jun Ouyang Date: Tue, 26 Mar 2024 01:08:24 +0800 Subject: [PATCH] feat(ofs): support getattr --- bin/ofs/src/fuse.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/bin/ofs/src/fuse.rs b/bin/ofs/src/fuse.rs index 10bc6c1426ba..b457a972bc7a 100644 --- a/bin/ofs/src/fuse.rs +++ b/bin/ofs/src/fuse.rs @@ -23,6 +23,8 @@ use std::time::Duration; use std::time::SystemTime; use bytes::Bytes; + + use fuse3::async_trait; use fuse3::path::prelude::*; use fuse3::Errno; @@ -207,7 +209,8 @@ impl PathFilesystem for Fuse { fh, set_attr ); - Err(libc::EOPNOTSUPP.into()) + + self.getattr(_req, path, fh, 0).await } async fn symlink( @@ -664,7 +667,13 @@ impl PathFilesystem for Fuse { offset: u64, whence: u32, ) -> Result { - log::debug!("lseek(path={:?}, fh={}, offset={}, whence={})", path, _fh, offset, whence); + log::debug!( + "lseek(path={:?}, fh={}, offset={}, whence={})", + path, + _fh, + offset, + whence + ); let whence = whence as i32; @@ -677,7 +686,7 @@ impl PathFilesystem for Fuse { .await .map_err(opendal_error2errno)?; let content_size = metadata.content_length(); - + if content_size >= offset as _ { content_size as u64 - offset } else { @@ -690,7 +699,6 @@ impl PathFilesystem for Fuse { Ok(ReplyLSeek { offset }) } - async fn copy_file_range( &self, req: Request,