pub struct BlockFsNode { /* private fields */ }Expand description
BlockFS node implementation
Implementations§
Source§impl BlockFsNode
impl BlockFsNode
pub fn new(inode_num: u32, fs: Arc<RwLock<BlockFsInner>>) -> Self
Trait Implementations§
Source§impl VfsNode for BlockFsNode
impl VfsNode for BlockFsNode
Source§fn readlink(&self) -> Result<String, KernelError>
fn readlink(&self) -> Result<String, KernelError>
Read the target of a symbolic link in BlockFS.
Delegates to BlockFsInner::read_symlink which checks whether
this inode has the symlink mode bit set (0xA000) and, if so, reads
the target path from the inode’s data blocks.
Returns FsError::NotASymlink if this node is not a symlink.
Source§fn node_type(&self) -> NodeType
fn node_type(&self) -> NodeType
Node type query (also serves as vtable slot padding for AArch64)
Source§fn read(&self, offset: usize, buffer: &mut [u8]) -> Result<usize, KernelError>
fn read(&self, offset: usize, buffer: &mut [u8]) -> Result<usize, KernelError>
Read data from the node
Source§fn write(&self, offset: usize, data: &[u8]) -> Result<usize, KernelError>
fn write(&self, offset: usize, data: &[u8]) -> Result<usize, KernelError>
Write data to the node
Source§fn metadata(&self) -> Result<Metadata, KernelError>
fn metadata(&self) -> Result<Metadata, KernelError>
Get metadata for the node
Source§fn readdir(&self) -> Result<Vec<DirEntry>, KernelError>
fn readdir(&self) -> Result<Vec<DirEntry>, KernelError>
List directory entries (if this is a directory)
Source§fn lookup(&self, name: &str) -> Result<Arc<dyn VfsNode>, KernelError>
fn lookup(&self, name: &str) -> Result<Arc<dyn VfsNode>, KernelError>
Look up a child node by name (if this is a directory)
Source§fn create(
&self,
name: &str,
permissions: Permissions,
) -> Result<Arc<dyn VfsNode>, KernelError>
fn create( &self, name: &str, permissions: Permissions, ) -> Result<Arc<dyn VfsNode>, KernelError>
Create a new file in this directory
Source§fn mkdir(
&self,
name: &str,
permissions: Permissions,
) -> Result<Arc<dyn VfsNode>, KernelError>
fn mkdir( &self, name: &str, permissions: Permissions, ) -> Result<Arc<dyn VfsNode>, KernelError>
Create a new directory in this directory
Source§fn unlink(&self, name: &str) -> Result<(), KernelError>
fn unlink(&self, name: &str) -> Result<(), KernelError>
Remove a file or empty directory
Source§fn truncate(&self, size: usize) -> Result<(), KernelError>
fn truncate(&self, size: usize) -> Result<(), KernelError>
Truncate the file to the specified size
Source§fn symlink(
&self,
name: &str,
target: &str,
) -> Result<Arc<dyn VfsNode>, KernelError>
fn symlink( &self, name: &str, target: &str, ) -> Result<Arc<dyn VfsNode>, KernelError>
Create a symbolic link in this directory. Read more
Source§fn chmod(&self, permissions: Permissions) -> Result<(), KernelError>
fn chmod(&self, permissions: Permissions) -> Result<(), KernelError>
Change permissions on this node
Source§fn link(&self, name: &str, target: Arc<dyn VfsNode>) -> Result<(), KernelError>
fn link(&self, name: &str, target: Arc<dyn VfsNode>) -> Result<(), KernelError>
Create a hard link to this node
Source§fn poll_readiness(&self) -> u16
fn poll_readiness(&self) -> u16
Poll readiness for I/O multiplexing (poll/epoll). Read more