Trait axfs_vfs::VfsNodeOps
source · pub trait VfsNodeOps: Send + Sync {
Show 14 methods
// Provided methods
fn open(&self) -> VfsResult { ... }
fn release(&self) -> VfsResult { ... }
fn get_attr(&self) -> VfsResult<VfsNodeAttr> { ... }
fn read_at(&self, _offset: u64, _buf: &mut [u8]) -> VfsResult<usize> { ... }
fn write_at(&self, _offset: u64, _buf: &[u8]) -> VfsResult<usize> { ... }
fn fsync(&self) -> VfsResult { ... }
fn truncate(&self, _size: u64) -> VfsResult { ... }
fn parent(&self) -> Option<VfsNodeRef> { ... }
fn lookup(self: Arc<Self>, _path: &str) -> VfsResult<VfsNodeRef> { ... }
fn create(&self, _path: &str, _ty: VfsNodeType) -> VfsResult { ... }
fn remove(&self, _path: &str) -> VfsResult { ... }
fn read_dir(
&self,
_start_idx: usize,
_dirents: &mut [VfsDirEntry]
) -> VfsResult<usize> { ... }
fn rename(&self, _src_path: &str, _dst_path: &str) -> VfsResult { ... }
fn as_any(&self) -> &dyn Any { ... }
}
Expand description
Node (file/directory) operations.
Provided Methods§
sourcefn get_attr(&self) -> VfsResult<VfsNodeAttr>
fn get_attr(&self) -> VfsResult<VfsNodeAttr>
Get the attributes of the node.
sourcefn read_at(&self, _offset: u64, _buf: &mut [u8]) -> VfsResult<usize>
fn read_at(&self, _offset: u64, _buf: &mut [u8]) -> VfsResult<usize>
Read data from the file at the given offset.
sourcefn write_at(&self, _offset: u64, _buf: &[u8]) -> VfsResult<usize>
fn write_at(&self, _offset: u64, _buf: &[u8]) -> VfsResult<usize>
Write data to the file at the given offset.
sourcefn parent(&self) -> Option<VfsNodeRef>
fn parent(&self) -> Option<VfsNodeRef>
Get the parent directory of this directory.
Return None
if the node is a file.
sourcefn lookup(self: Arc<Self>, _path: &str) -> VfsResult<VfsNodeRef>
fn lookup(self: Arc<Self>, _path: &str) -> VfsResult<VfsNodeRef>
Lookup the node with given path
in the directory.
Return the node if found.
sourcefn create(&self, _path: &str, _ty: VfsNodeType) -> VfsResult
fn create(&self, _path: &str, _ty: VfsNodeType) -> VfsResult
Create a new node with the given path
in the directory
Return Ok(())
if it already exists.
sourcefn remove(&self, _path: &str) -> VfsResult
fn remove(&self, _path: &str) -> VfsResult
Remove the node with the given path
in the directory.
sourcefn read_dir(
&self,
_start_idx: usize,
_dirents: &mut [VfsDirEntry]
) -> VfsResult<usize>
fn read_dir( &self, _start_idx: usize, _dirents: &mut [VfsDirEntry] ) -> VfsResult<usize>
Read directory entries into dirents
, starting from start_idx
.
sourcefn rename(&self, _src_path: &str, _dst_path: &str) -> VfsResult
fn rename(&self, _src_path: &str, _dst_path: &str) -> VfsResult
Renames or moves existing file or directory.
sourcefn as_any(&self) -> &dyn Any
fn as_any(&self) -> &dyn Any
Convert &self
to &dyn Any
that can use
Any::downcast_ref
.