diff --git a/src/main.rs b/src/main.rs index 92f2b41..cb3fe8e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -86,7 +86,6 @@ fn main() { syslog_client .send_text_message("init", "Started the devfs") .unwrap(); - syslog_msg_ipc::get_syslog_msg(); let vfs_client = vfs_rpc::Client::new(vfs_pid); vfs_client .mount(Path::new("/dummy"), "devfs", Path::new("/dev")) @@ -111,17 +110,12 @@ fn main() { syslog_client .send_text_message("init", "Started the initrd pseudodevice driver") .unwrap(); - loop { - let msg = syslog_msg_ipc::get_syslog_msg(); - if msg.from == "devfs" { - if let Some(binary) = msg.binary { - if binary.kind == 1 - && std::str::from_utf8(binary.data.as_slice()).unwrap() == "initrd" - { - break; - } - } - } + while !msg_handler + .registered_devices + .iter() + .any(|x| x == "initrd") + { + msg_handler.process_messages(); } vfs_client .mount(Path::new("/dev/initrd"), "tarfs", Path::new("/")) @@ -178,6 +172,6 @@ fn run_initrd_proc(initrd: &TarArchiveRef, path: &str) -> u64 { let (space, entry) = Loader::load(proc); let path_arg = CString::new(path).unwrap(); let pid = new_process(entry as _, space, &[path_arg.as_bytes_with_nul()]).unwrap(); - syscalls::wake_new(pid); + syscalls::wake_new(pid).unwrap(); pid }