FileNodeOps

Trait FileNodeOps 

Source
pub trait FileNodeOps: NodeOps + Pollable {
    // Required methods
    fn read_at(&self, buf: &mut [u8], offset: u64) -> VfsResult<usize>;
    fn write_at(&self, buf: &[u8], offset: u64) -> VfsResult<usize>;
    fn append(&self, buf: &[u8]) -> VfsResult<(usize, u64)>;
    fn set_len(&self, len: u64) -> VfsResult<()>;
    fn set_symlink(&self, target: &str) -> VfsResult<()>;

    // Provided method
    fn ioctl(&self, _cmd: u32, _arg: usize) -> VfsResult<usize> { ... }
}

Required Methods§

Source

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

Reads a number of bytes starting from a given offset.

Source

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

Writes a number of bytes starting from a given offset.

Source

fn append(&self, buf: &[u8]) -> VfsResult<(usize, u64)>

Appends data to the file.

Returns (written, offset) where written is the number of bytes written and offset is the new file size.

Source

fn set_len(&self, len: u64) -> VfsResult<()>

Sets the size of the file.

Sets the file’s symlink target.

Provided Methods§

Source

fn ioctl(&self, _cmd: u32, _arg: usize) -> VfsResult<usize>

Manipulates the underlying device parameters of special files.

Implementors§