ros666::fs::inode

Struct OSInode

Source
pub struct OSInode {
    readable: bool,
    writable: bool,
    inode: Mutex<InodeData>,
}
Expand description

OS Inode

文件层级的 Inode 结构,对 内存 Inode MemInode 的文件读写访问的封装

一个 文件 (OS Inode) 可以被多个进程共享,因此需要实现 Send 和 Sync trait

Fields§

§readable: bool§writable: bool§inode: Mutex<InodeData>

Implementations§

Source§

impl OSInode

Source

pub fn new(readable: bool, writable: bool, inode: Arc<MemInode>) -> Self

创建一个新的 OS Inode

Source

pub fn read_all(&self) -> Vec<u8>

读取文件的所有内容

Trait Implementations§

Source§

impl File for OSInode

Source§

fn read(&self, buf: UserBuffer) -> usize

从文件中读取数据到用户空间 Read more
Source§

fn write(&self, buf: UserBuffer) -> usize

将用户空间的数据写入文件 Read more
Source§

fn readable(&self) -> bool

根据打开文件的模式判断是否可读
Source§

fn writable(&self) -> bool

根据打开文件的模式判断是否可写

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.