Skip to main content

IpcScheme

Struct IpcScheme 

Source
pub struct IpcScheme {
    port_id: PortId,
    open_file_flags: SpinLock<BTreeMap<u64, FileFlags>>,
}
Expand description

IPC-based scheme: forwards operations to a userspace server via IPC.

Fields§

§port_id: PortId§open_file_flags: SpinLock<BTreeMap<u64, FileFlags>>

Implementations§

Source§

impl IpcScheme

Source

pub fn new(port_id: PortId) -> Self

Creates a new instance.

Source

fn remember_open_flags(&self, file_id: u64, flags: FileFlags)

Source

fn take_open_flags(&self, file_id: u64)

Source

fn open_flags_for(&self, file_id: u64) -> FileFlags

Source

fn build_open_msg( path: &str, flags: OpenFlags, ) -> Result<IpcMessage, SyscallError>

Build an IPC message for open operation.

Source

fn build_read_msg(file_id: u64, offset: u64, count: u32) -> IpcMessage

Build an IPC message for read operation.

Source

fn build_write_msg( file_id: u64, offset: u64, data: &[u8], ) -> Result<(IpcMessage, usize), SyscallError>

Build an IPC message for write operation.

Returns the message and the number of bytes actually packed, or MessageSize if data exceeds the inline capacity (the caller’s chunking logic guarantees this never happens; we refuse rather than truncate or emit an empty write).

Source

fn build_close_msg(file_id: u64) -> IpcMessage

Build an IPC message for close operation.

Source

fn build_readdir_msg(file_id: u64, cursor: u16) -> IpcMessage

Performs the build readdir msg operation.

Source

fn parse_status(reply: &IpcMessage) -> Result<(), SyscallError>

Parses status.

Source§

impl IpcScheme

Source

fn call(&self, msg: IpcMessage) -> Result<IpcMessage, SyscallError>

Perform a synchronous IPC call: send msg to the server port and block the current task until the server calls ipc_reply. This mirrors sys_ipc_call exactly so that sys_ipc_reply can correctly route the reply back to us via reply::deliver_reply.

Source§

impl IpcScheme

Source

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

Handles create op.

Trait Implementations§

Source§

impl Scheme for IpcScheme

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 create_file(&self, path: &str, mode: u32) -> Result<OpenResult, SyscallError>

Creates file.

Source§

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

Creates directory.

Performs the unlink operation.

Source§

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

Performs the readdir operation.

Source§

fn async_read( &self, file_id: u64, offset: u64, user_buf_vaddr: u64, len: usize, _ring_id: u64, _user_data: u64, ) -> Result<AsyncSubmitResult, SyscallError>

Submit a read against a userspace buffer for async I/O. Read more
Source§

fn async_write( &self, file_id: u64, offset: u64, user_buf_vaddr: u64, len: usize, _ring_id: u64, _user_data: u64, ) -> Result<AsyncSubmitResult, SyscallError>

Submit a write sourced from a userspace buffer for async I/O. Read more
Source§

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

Get file size (if supported).
Source§

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

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

fn truncate_by_path( &self, _path: &str, _new_size: u64, ) -> Result<(), SyscallError>

Truncate a file by path (avoids open/close round-trip). Read more
Source§

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

Sync file to storage (if applicable).
Source§

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

Get metadata for an open file.
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
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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.