ProcInode

Struct ProcInode 

Source
pub struct ProcInode {
    metadata: SpinLock<InodeMetadata>,
    content: ProcInodeContent,
}

Fields§

§metadata: SpinLock<InodeMetadata>

元数据

§content: ProcInodeContent

内容

Implementations§

Source§

impl ProcInode

Source

pub fn new_static_file( _name: &str, content: Vec<u8>, mode: FileMode, ) -> Arc<Self>

创建静态文件 inode

Source

pub fn new_dynamic_file( _name: &str, generator: Arc<dyn ContentGenerator>, mode: FileMode, ) -> Arc<Self>

创建动态文件 inode

Source

pub fn new_directory(mode: FileMode) -> Arc<Self>

创建目录 inode

创建符号链接 inode

创建动态符号链接 inode

Source

pub fn add_child( &self, name: &str, child: Arc<ProcInode>, ) -> Result<(), FsError>

向目录添加子节点

Source

fn create_process_dir(&self, pid: u32) -> Option<Arc<ProcInode>>

为指定 PID 创建进程目录

Trait Implementations§

Source§

impl Inode for ProcInode

Source§

fn metadata(&self) -> Result<InodeMetadata, FsError>

获取文件元数据
Source§

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

从指定偏移量读取数据 Read more
Source§

fn write_at(&self, _offset: usize, _buf: &[u8]) -> Result<usize, FsError>

向指定偏移量写入数据
Source§

fn lookup(&self, name: &str) -> Result<Arc<dyn Inode>, FsError>

在目录中查找子项 Read more
Source§

fn create( &self, _name: &str, _mode: FileMode, ) -> Result<Arc<dyn Inode>, FsError>

在目录中创建文件
Source§

fn mkdir(&self, _name: &str, _mode: FileMode) -> Result<Arc<dyn Inode>, FsError>

在目录中创建子目录
创建符号链接
创建硬链接
删除普通文件/链接
Source§

fn rmdir(&self, _name: &str) -> Result<(), FsError>

删除目录
Source§

fn rename( &self, _old_name: &str, _new_parent: Arc<dyn Inode>, _new_name: &str, ) -> Result<(), FsError>

重命名/移动 (原子操作)
Source§

fn readdir(&self) -> Result<Vec<DirEntry>, FsError>

列出目录内容
Source§

fn truncate(&self, _size: usize) -> Result<(), FsError>

截断文件到指定大小
Source§

fn sync(&self) -> Result<(), FsError>

同步文件数据到存储设备
Source§

fn as_any(&self) -> &dyn Any

向下转型为 &dyn Any,用于支持 downcast
Source§

fn set_times( &self, _atime: Option<TimeSpec>, _mtime: Option<TimeSpec>, ) -> Result<(), FsError>

设置文件时间戳
读取符号链接的目标路径
Source§

fn mknod( &self, _name: &str, _mode: FileMode, _dev: u64, ) -> Result<Arc<dyn Inode>, FsError>

创建设备文件节点
Source§

fn chmod(&self, _mode: FileMode) -> Result<(), FsError>

修改文件权限模式 Read more
Source§

fn chown(&self, _uid: u32, _gid: u32) -> Result<(), FsError>

修改文件所有者和组 Read more
Source§

fn set_dentry(&self, _dentry: Weak<Dentry>)

设置 Dentry(可选方法)
Source§

fn get_dentry(&self) -> Option<Arc<Dentry>>

获取 Dentry(可选方法)

Auto Trait Implementations§

§

impl !Freeze for ProcInode

§

impl !RefUnwindSafe for ProcInode

§

impl Send for ProcInode

§

impl Sync for ProcInode

§

impl Unpin for ProcInode

§

impl !UnwindSafe for ProcInode

Blanket Implementations§

§

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

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

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

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

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

§

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

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

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

§

fn into(self) -> U

Calls U::from(self).

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

§

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

§

type Error = Infallible

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

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

Performs the conversion.
§

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

§

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

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

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

Performs the conversion.