Trait rcore_fs::vfs::INode[][src]

pub trait INode: Any + Sync + Send {
    fn read_at(&self, offset: usize, buf: &mut [u8]) -> Result<usize>;
fn write_at(&self, offset: usize, buf: &[u8]) -> Result<usize>;
fn poll(&self) -> Result<PollStatus>;
fn as_any_ref(&self) -> &dyn Any; fn async_poll<'a>(
        &'a self
    ) -> Pin<Box<dyn Future<Output = Result<PollStatus>> + Send + Sync + 'a>> { ... }
fn metadata(&self) -> Result<Metadata> { ... }
fn set_metadata(&self, _metadata: &Metadata) -> Result<()> { ... }
fn sync_all(&self) -> Result<()> { ... }
fn sync_data(&self) -> Result<()> { ... }
fn resize(&self, _len: usize) -> Result<()> { ... }
fn create(
        &self,
        name: &str,
        type_: FileType,
        mode: u32
    ) -> Result<Arc<dyn INode>> { ... }
fn create2(
        &self,
        name: &str,
        type_: FileType,
        mode: u32,
        _data: usize
    ) -> Result<Arc<dyn INode>> { ... }
fn link(&self, _name: &str, _other: &Arc<dyn INode>) -> Result<()> { ... }
fn unlink(&self, _name: &str) -> Result<()> { ... }
fn move_(
        &self,
        _old_name: &str,
        _target: &Arc<dyn INode>,
        _new_name: &str
    ) -> Result<()> { ... }
fn find(&self, _name: &str) -> Result<Arc<dyn INode>> { ... }
fn get_entry(&self, _id: usize) -> Result<String> { ... }
fn get_entry_with_metadata(&self, id: usize) -> Result<(Metadata, String)> { ... }
fn io_control(&self, _cmd: u32, _data: usize) -> Result<usize> { ... }
fn mmap(&self, _area: MMapArea) -> Result<()> { ... }
fn fs(&self) -> Arc<dyn FileSystem> { ... } }

Abstract file system object such as file or directory.

Required methods

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

Read bytes at offset into buf, return the number of bytes read.

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

Write bytes at offset from buf, return the number of bytes written.

fn poll(&self) -> Result<PollStatus>[src]

Poll the events, return a bitmap of events.

fn as_any_ref(&self) -> &dyn Any[src]

This is used to implement dynamics cast. Simply return self in the implement of the function.

Loading content...

Provided methods

fn async_poll<'a>(
    &'a self
) -> Pin<Box<dyn Future<Output = Result<PollStatus>> + Send + Sync + 'a>>
[src]

Poll the events, return a bitmap of events, async version.

fn metadata(&self) -> Result<Metadata>[src]

Get metadata of the INode

fn set_metadata(&self, _metadata: &Metadata) -> Result<()>[src]

Set metadata of the INode

fn sync_all(&self) -> Result<()>[src]

Sync all data and metadata

fn sync_data(&self) -> Result<()>[src]

Sync data (not include metadata)

fn resize(&self, _len: usize) -> Result<()>[src]

Resize the file

fn create(
    &self,
    name: &str,
    type_: FileType,
    mode: u32
) -> Result<Arc<dyn INode>>
[src]

Create a new INode in the directory

fn create2(
    &self,
    name: &str,
    type_: FileType,
    mode: u32,
    _data: usize
) -> Result<Arc<dyn INode>>
[src]

Create a new INode in the directory, with a data field for usages like device file.

Create a hard link name to other

Delete a hard link name

fn move_(
    &self,
    _old_name: &str,
    _target: &Arc<dyn INode>,
    _new_name: &str
) -> Result<()>
[src]

Move INode self/old_name to target/new_name. If target equals self, do rename.

fn find(&self, _name: &str) -> Result<Arc<dyn INode>>[src]

Find the INode name in the directory

fn get_entry(&self, _id: usize) -> Result<String>[src]

Get the name of directory entry

fn get_entry_with_metadata(&self, id: usize) -> Result<(Metadata, String)>[src]

Get the name of directory entry with metadata

fn io_control(&self, _cmd: u32, _data: usize) -> Result<usize>[src]

Control device

fn mmap(&self, _area: MMapArea) -> Result<()>[src]

Map files or devices into memory

fn fs(&self) -> Arc<dyn FileSystem>[src]

Get the file system of the INode

Loading content...

Implementations

impl dyn INode[src]

pub fn downcast_ref<T: INode>(&self) -> Option<&T>[src]

Downcast the INode to specific struct

pub fn list(&self) -> Result<Vec<String>>[src]

Get all directory entries as a Vec

pub fn lookup(&self, path: &str) -> Result<Arc<dyn INode>>[src]

Lookup path from current INode, and do not follow symlinks

pub fn lookup_follow(
    &self,
    path: &str,
    follow_times: usize
) -> Result<Arc<dyn INode>>
[src]

Lookup path from current INode, and follow symlinks at most follow_times times

Implementors

Loading content...