Trait twizzler_runtime_api::RustFsRuntime
source · pub trait RustFsRuntime {
// Required methods
fn open(&self, path: &CStr) -> Result<RawFd, FsError>;
fn read(&self, fd: RawFd, buf: &mut [u8]) -> Result<usize, FsError>;
fn write(&self, fd: RawFd, buf: &[u8]) -> Result<usize, FsError>;
fn close(&self, fd: RawFd) -> Result<(), FsError>;
fn seek(&self, fd: RawFd, pos: SeekFrom) -> Result<usize, FsError>;
}
Expand description
Runtime that implements STD’s FS support. Currently being implemented.
Required Methods§
sourcefn open(&self, path: &CStr) -> Result<RawFd, FsError>
fn open(&self, path: &CStr) -> Result<RawFd, FsError>
Takes in a u128 integer as CStr and emits a File Descriptor that allows File-Like IO on a Twizzler Object. Note that the object must already exist to be opened.
sourcefn read(&self, fd: RawFd, buf: &mut [u8]) -> Result<usize, FsError>
fn read(&self, fd: RawFd, buf: &mut [u8]) -> Result<usize, FsError>
Reads bytes from the source twizzler Object into the specified buffer, returns how many bytes were read.
sourcefn write(&self, fd: RawFd, buf: &[u8]) -> Result<usize, FsError>
fn write(&self, fd: RawFd, buf: &[u8]) -> Result<usize, FsError>
Writes bytes from the source twizzler Object into the specified buffer, returns how many bytes were written.