Skip to main content

Filesystem

Trait Filesystem 

Source
pub trait Filesystem {
    // Provided methods
    fn open(&mut self, _ino: INode, _flags: u32) -> FSResult<OpenFile> { ... }
    fn open_dir(&mut self, _ino: INode, _flags: u32) -> FSResult<OpenDir> { ... }
    fn lookup(&mut self, _parent: INode, _name: &OsStr) -> FSResult<Lookup> { ... }
    fn getattr(&mut self, _inode: INode) -> FSResult<FileAttributes> { ... }
    fn setattr(
        &mut self,
        _inode: INode,
        _attr: SetFileAttributes,
    ) -> FSResult<FileAttributes> { ... }
    fn setxattr(
        &mut self,
        _ino: INode,
        _attr_name: &OsStr,
        _attr_value: &[u8],
        _flags: SetXAttrFlags,
    ) -> FSResult<()> { ... }
    fn getxattr(
        &mut self,
        _ino: INode,
        _attr_name: &OsStr,
        _max_len: u32,
    ) -> FSResult<XAttrRef<'_>> { ... }
    fn listxattrs(
        &mut self,
        _ino: INode,
        _max_len: u32,
    ) -> FSResult<(OsString, u32)> { ... }
    fn readdir(&mut self, _dir: INode, _offset: u64) -> FSResult<Vec<DirEntry>> { ... }
    fn read(&mut self, _ino: INode, _offset: u64, _size: u32) -> FSResult<&[u8]> { ... }
    fn write<T: BufRead>(
        &mut self,
        _ino: INode,
        _offset: u64,
        _size: u32,
        _buf: T,
    ) -> FSResult<u32> { ... }
}

Provided Methods§

Source

fn open(&mut self, _ino: INode, _flags: u32) -> FSResult<OpenFile>

Source

fn open_dir(&mut self, _ino: INode, _flags: u32) -> FSResult<OpenDir>

Source

fn lookup(&mut self, _parent: INode, _name: &OsStr) -> FSResult<Lookup>

Source

fn getattr(&mut self, _inode: INode) -> FSResult<FileAttributes>

Source

fn setattr( &mut self, _inode: INode, _attr: SetFileAttributes, ) -> FSResult<FileAttributes>

Source

fn setxattr( &mut self, _ino: INode, _attr_name: &OsStr, _attr_value: &[u8], _flags: SetXAttrFlags, ) -> FSResult<()>

Source

fn getxattr( &mut self, _ino: INode, _attr_name: &OsStr, _max_len: u32, ) -> FSResult<XAttrRef<'_>>

When max_len == 0, this is functionally requesting only the length of the requested attribute.

Source

fn listxattrs( &mut self, _ino: INode, _max_len: u32, ) -> FSResult<(OsString, u32)>

When max_len is 0, the return value should be an empty string and the length of all the attributes with an additional nul byte.

When max_len is greater than 0, this function should return an OsString composed of all the xattr names seperated by a nul (\0) byte. If the length of that string is greater than max_len, however, the method should error and return FSError::BufferWouldOverflow.

Source

fn readdir(&mut self, _dir: INode, _offset: u64) -> FSResult<Vec<DirEntry>>

Reads a directory.

§Warning

This method must include the “.” and “..” directories, as well as properly accounting for offset. If not, some operations may get stuck in an infinite loop while trying to read a directory.

Source

fn read(&mut self, _ino: INode, _offset: u64, _size: u32) -> FSResult<&[u8]>

Source

fn write<T: BufRead>( &mut self, _ino: INode, _offset: u64, _size: u32, _buf: T, ) -> FSResult<u32>

Returns the amount of bytes written

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§