mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-15 08:30:02 +00:00
track "attempted" mounts in PDDB
this is to allow a UX process to clear the "waiting for boot" indicator once an attempt has completed. right now, it responds *after* the mount process is done, so the "please waiting" text persists even doing a format. I think that is...appropriate?
This commit is contained in:
parent
93dcfb7435
commit
0646ec23ba
3 changed files with 34 additions and 0 deletions
|
|
@ -236,6 +236,9 @@ pub(crate) enum Opcode {
|
|||
/// Bulk read of a dictionary
|
||||
DictBulkRead = 52,
|
||||
|
||||
/// Mount was attempted
|
||||
MountAttempted = 53,
|
||||
|
||||
/// This key type could not be decoded
|
||||
InvalidOpcode = u32::MAX as _,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -164,6 +164,20 @@ impl Pddb {
|
|||
}
|
||||
}
|
||||
}
|
||||
pub fn mount_attempted_blocking(&self) {
|
||||
loop {
|
||||
let ret = send_message(self.conn, Message::new_blocking_scalar(
|
||||
Opcode::MountAttempted.to_usize().unwrap(), 0, 0, 0, 0)).expect("couldn't execute IsMounted query");
|
||||
match ret {
|
||||
xous::Result::Scalar2(code, _count) => {
|
||||
if code == 0 { // mounted successfully
|
||||
break;
|
||||
}
|
||||
},
|
||||
_ => panic!("Internal error"),
|
||||
}
|
||||
}
|
||||
}
|
||||
/// Attempts to mount the system basis. Returns `true` on success, `false` on failure.
|
||||
/// This call may cause a password request box to pop up, in the case that the boot PIN is not currently cached.
|
||||
///
|
||||
|
|
|
|||
|
|
@ -590,6 +590,7 @@ fn wrapped_main() -> ! {
|
|||
|
||||
// track processes that want a notification of a mount event
|
||||
let mut mount_notifications = Vec::<xous::MessageSender>::new();
|
||||
let mut attempt_notifications = Vec::<xous::MessageSender>::new();
|
||||
|
||||
// track heap usage
|
||||
let mut initial_heap: usize = 0;
|
||||
|
|
@ -649,6 +650,17 @@ fn wrapped_main() -> ! {
|
|||
mount_notifications.push(msg.sender); // defer response until later
|
||||
}
|
||||
}),
|
||||
Opcode::MountAttempted => xous::msg_blocking_scalar_unpack!(msg, _, _, _, _, {
|
||||
#[cfg(not(target_os = "xous"))] // hosted mode always passes
|
||||
xous::return_scalar2(msg.sender, 0, 0).expect("couldn't return scalar");
|
||||
|
||||
#[cfg(target_os = "xous")]
|
||||
if basis_cache.basis_count() > 0 { // if there's anything in the cache, we're mounted; by definition it was attempted
|
||||
xous::return_scalar2(msg.sender, 0, 0).expect("couldn't return scalar");
|
||||
} else {
|
||||
attempt_notifications.push(msg.sender); // defer response until later
|
||||
}
|
||||
}),
|
||||
// The return code from this is a scalar2 with the following meanings:
|
||||
// (code, count):
|
||||
// - code = 0 -> successful mount
|
||||
|
|
@ -717,6 +729,11 @@ fn wrapped_main() -> ! {
|
|||
profiling::do_query_work();
|
||||
}
|
||||
}
|
||||
// this is so that the UX can drop the initial "waiting for boot" message
|
||||
// the attempt is credited even if it was aborted or failed.
|
||||
for requester in attempt_notifications.drain(..) {
|
||||
xous::return_scalar2(requester, 0, 0).expect("couldn't return scalar");
|
||||
}
|
||||
}),
|
||||
Opcode::PeriodicScrub => {
|
||||
let current_heap = heap_usage();
|
||||
|
|
|
|||
Loading…
Reference in a new issue