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
impl IpcScheme
fn remember_open_flags(&self, file_id: u64, flags: FileFlags)
fn take_open_flags(&self, file_id: u64)
fn open_flags_for(&self, file_id: u64) -> FileFlags
Sourcefn build_open_msg(
path: &str,
flags: OpenFlags,
) -> Result<IpcMessage, SyscallError>
fn build_open_msg( path: &str, flags: OpenFlags, ) -> Result<IpcMessage, SyscallError>
Build an IPC message for open operation.
Sourcefn build_read_msg(file_id: u64, offset: u64, count: u32) -> IpcMessage
fn build_read_msg(file_id: u64, offset: u64, count: u32) -> IpcMessage
Build an IPC message for read operation.
Sourcefn build_write_msg(
file_id: u64,
offset: u64,
data: &[u8],
) -> (IpcMessage, usize)
fn build_write_msg( file_id: u64, offset: u64, data: &[u8], ) -> (IpcMessage, usize)
Build an IPC message for write operation.
Returns the message and the number of bytes actually packed.
Sourcefn build_close_msg(file_id: u64) -> IpcMessage
fn build_close_msg(file_id: u64) -> IpcMessage
Build an IPC message for close operation.
Sourcefn build_readdir_msg(file_id: u64, cursor: u16) -> IpcMessage
fn build_readdir_msg(file_id: u64, cursor: u16) -> IpcMessage
Performs the build readdir msg operation.
Sourcefn parse_status(reply: &IpcMessage) -> Result<(), SyscallError>
fn parse_status(reply: &IpcMessage) -> Result<(), SyscallError>
Parses status.
Source§impl IpcScheme
impl IpcScheme
Sourcefn call(&self, msg: IpcMessage) -> Result<IpcMessage, SyscallError>
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
impl IpcScheme
Sourcefn handle_create_op(
&self,
opcode: u32,
path: &str,
mode: u32,
) -> Result<OpenResult, SyscallError>
fn handle_create_op( &self, opcode: u32, path: &str, mode: u32, ) -> Result<OpenResult, SyscallError>
Handles create op.
Trait Implementations§
Source§impl Scheme for IpcScheme
impl Scheme for IpcScheme
Source§fn open(&self, path: &str, flags: OpenFlags) -> Result<OpenResult, SyscallError>
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>
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>
fn write( &self, file_id: u64, offset: u64, buf: &[u8], ) -> Result<usize, SyscallError>
Performs the write operation.
Source§fn create_file(&self, path: &str, mode: u32) -> Result<OpenResult, SyscallError>
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>
fn create_directory( &self, path: &str, mode: u32, ) -> Result<OpenResult, SyscallError>
Creates directory.
Source§fn readdir(&self, file_id: u64) -> Result<Vec<DirEntry>, SyscallError>
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>
fn async_read( &self, file_id: u64, offset: u64, user_buf_vaddr: u64, len: usize, _ring_id: u64, _user_data: u64, ) -> Result<AsyncSubmitResult, SyscallError>
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>
fn async_write( &self, file_id: u64, offset: u64, user_buf_vaddr: u64, len: usize, _ring_id: u64, _user_data: u64, ) -> Result<AsyncSubmitResult, SyscallError>
Source§fn truncate(&self, file_id: u64, new_size: u64) -> Result<(), SyscallError>
fn truncate(&self, file_id: u64, new_size: u64) -> Result<(), SyscallError>
Source§fn truncate_by_path(
&self,
_path: &str,
_new_size: u64,
) -> Result<(), SyscallError>
fn truncate_by_path( &self, _path: &str, _new_size: u64, ) -> Result<(), SyscallError>
Source§fn sync(&self, file_id: u64) -> Result<(), SyscallError>
fn sync(&self, file_id: u64) -> Result<(), SyscallError>
Source§fn rename(&self, old_path: &str, new_path: &str) -> Result<(), SyscallError>
fn rename(&self, old_path: &str, new_path: &str) -> Result<(), SyscallError>
Source§fn chmod(&self, path: &str, mode: u32) -> Result<(), SyscallError>
fn chmod(&self, path: &str, mode: u32) -> Result<(), SyscallError>
Source§fn fchmod(&self, file_id: u64, mode: u32) -> Result<(), SyscallError>
fn fchmod(&self, file_id: u64, mode: u32) -> Result<(), SyscallError>
Source§fn link(&self, old_path: &str, new_path: &str) -> Result<(), SyscallError>
fn link(&self, old_path: &str, new_path: &str) -> Result<(), SyscallError>
Auto Trait Implementations§
impl !Freeze for IpcScheme
impl !RefUnwindSafe for IpcScheme
impl Send for IpcScheme
impl Sync for IpcScheme
impl Unpin for IpcScheme
impl UnsafeUnpin for IpcScheme
impl UnwindSafe for IpcScheme
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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