[Yellowstone] Read init file from disk.
This commit is contained in:
parent
b880c11ac7
commit
8d3f77e648
|
@ -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]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) };
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
extern crate alloc;
|
||||
|
||||
use alloc::vec::Vec;
|
||||
use mammoth::{
|
||||
cap::Capability,
|
||||
define_entry, elf,
|
||||
|
@ -58,6 +59,20 @@ extern "C" fn main() -> z_err_t {
|
|||
context.wait_victoria_falls().unwrap();
|
||||
mammoth::debug!("VFS Registered");
|
||||
|
||||
let file = victoriafalls::file::File::open("/init.txt").unwrap();
|
||||
|
||||
let init_files: Vec<_> = core::str::from_utf8(file.slice())
|
||||
.unwrap()
|
||||
.trim()
|
||||
.split('\n')
|
||||
.collect();
|
||||
|
||||
mammoth::debug!("Init files: {:?}", init_files);
|
||||
|
||||
for bin_name in init_files {
|
||||
let path = "/bin/" + bin_name;
|
||||
}
|
||||
|
||||
server_thread.join().expect("Failed to join thread");
|
||||
0
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
use alloc::rc::Rc;
|
||||
use alloc::{collections::BTreeMap, string::String};
|
||||
use mammoth::{cap::Capability, mem::MemoryRegion, zion::ZError};
|
||||
use victoriafalls::VFSClient;
|
||||
use yellowstone_yunq::{
|
||||
AhciInfo, DenaliInfo, Endpoint, FramebufferInfo, GetEndpointRequest, RegisterEndpointRequest,
|
||||
XhciInfo, YellowstoneServerHandler,
|
||||
|
@ -51,14 +52,17 @@ impl YellowstoneServerHandler for YellowstoneServerImpl {
|
|||
let signal_denali = req.endpoint_name == "denali";
|
||||
let signal_vfs = req.endpoint_name == "victoriafalls";
|
||||
|
||||
let raw_cap = req.endpoint_capability;
|
||||
|
||||
self.service_map
|
||||
.insert(req.endpoint_name, Capability::take(req.endpoint_capability));
|
||||
|
||||
if signal_denali {
|
||||
self.context.denali_semaphore.signal()?
|
||||
self.context.denali_semaphore.signal()?;
|
||||
}
|
||||
if signal_vfs {
|
||||
self.context.victoria_falls_semaphore.signal()?
|
||||
self.context.victoria_falls_semaphore.signal()?;
|
||||
victoriafalls::set_client(VFSClient::new(Capability::take_copy(raw_cap).unwrap()));
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue