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§

source

fn open(&self) -> VfsResult

Do something when the node is opened.

source

fn release(&self) -> VfsResult

Do something when the node is closed.

source

fn get_attr(&self) -> VfsResult<VfsNodeAttr>

Get the attributes of the node.

source

fn read_at(&self, _offset: u64, _buf: &mut [u8]) -> VfsResult<usize>

Read data from the file at the given offset.

source

fn write_at(&self, _offset: u64, _buf: &[u8]) -> VfsResult<usize>

Write data to the file at the given offset.

source

fn fsync(&self) -> VfsResult

Flush the file, synchronize the data to disk.

source

fn truncate(&self, _size: u64) -> VfsResult

Truncate the file to the given size.

source

fn parent(&self) -> Option<VfsNodeRef>

Get the parent directory of this directory.

Return None if the node is a file.

source

fn lookup(self: Arc<Self>, _path: &str) -> VfsResult<VfsNodeRef>

Lookup the node with given path in the directory.

Return the node if found.

source

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.

source

fn remove(&self, _path: &str) -> VfsResult

Remove the node with the given path in the directory.

source

fn read_dir( &self, _start_idx: usize, _dirents: &mut [VfsDirEntry] ) -> VfsResult<usize>

Read directory entries into dirents, starting from start_idx.

source

fn rename(&self, _src_path: &str, _dst_path: &str) -> VfsResult

Renames or moves existing file or directory.

source

fn as_any(&self) -> &dyn Any

Convert &self to &dyn Any that can use Any::downcast_ref.

Implementors§