Skip to main content

PipeScheme

Struct PipeScheme 

Source
pub struct PipeScheme { /* private fields */ }
Expand description

A scheme that manages kernel pipes.

Each pipe gets two file_ids: even = read end, odd = write end.

Implementations§

Source§

impl PipeScheme

Source

pub fn new() -> Self

Creates a new instance.

Source

pub fn create_pipe(&self) -> (u64, Arc<Pipe>)

Create a new pipe pair. Returns (read_file_id, write_file_id).

Trait Implementations§

Source§

impl Scheme for PipeScheme

Source§

fn open( &self, _path: &str, _flags: OpenFlags, ) -> Result<OpenResult, SyscallError>

Performs the open operation.

Source§

fn read( &self, file_id: u64, _offset: u64, buf: &mut [u8], ) -> Result<usize, SyscallError>

Performs the read operation.

Source§

fn write( &self, file_id: u64, _offset: u64, buf: &[u8], ) -> Result<usize, SyscallError>

Performs the write operation.

Source§

fn close(&self, file_id: u64) -> Result<(), SyscallError>

Performs the close operation.

Source§

fn stat(&self, file_id: u64) -> Result<FileStat, SyscallError>

Performs the stat operation.

Source§

fn readdir(&self, _file_id: u64) -> Result<Vec<DirEntry>, SyscallError>

Performs the readdir operation.

Source§

fn size(&self, file_id: u64) -> Result<u64, SyscallError>

Performs the size operation.

Source§

fn truncate(&self, file_id: u64, new_size: u64) -> Result<(), SyscallError>

Truncate/resize a file (if supported).
Source§

fn sync(&self, file_id: u64) -> Result<(), SyscallError>

Sync file to storage (if applicable).
Source§

fn create_file(&self, path: &str, mode: u32) -> Result<OpenResult, SyscallError>

Create a new regular file.
Source§

fn create_directory( &self, path: &str, mode: u32, ) -> Result<OpenResult, SyscallError>

Create a new directory.
Remove a file or directory.
Source§

fn rename(&self, old_path: &str, new_path: &str) -> Result<(), SyscallError>

Rename/move an entry within this scheme.
Source§

fn chmod(&self, path: &str, mode: u32) -> Result<(), SyscallError>

Change permission bits on a path.
Source§

fn fchmod(&self, file_id: u64, mode: u32) -> Result<(), SyscallError>

Change permission bits on an open file handle.
Create a hard link.
Create a symbolic link.
Read the target of a symbolic link.

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
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.