[Yellowstone] Read init file from disk.

This commit is contained in:
Drew Galbraith 2024-08-18 11:57:00 -07:00
parent b880c11ac7
commit 8d3f77e648
4 changed files with 28 additions and 3 deletions

View file

@ -4,6 +4,7 @@ use mammoth::{cap::Capability, zion::ZError};
pub struct File {
memory: mammoth::mem::MemoryRegion,
len: usize,
}
impl File {
@ -15,10 +16,11 @@ impl File {
Ok(Self {
memory: mammoth::mem::MemoryRegion::from_cap(Capability::take(resp.memory))?,
len: resp.size as usize,
})
}
pub fn slice(&self) -> &[u8] {
self.memory.slice()
&self.memory.slice()[..self.len]
}
}

View file

@ -23,3 +23,7 @@ fn get_client() -> &'static mut VFSClient {
VFS_CLIENT.as_mut().unwrap()
}
}
pub fn set_client(client: VFSClient) {
unsafe { VFS_CLIENT = Some(client) };
}