change timing of PDDB mount

moving it a shy later into the boot makes the mount process faster
because it's not fighting for swap memory with everything else
trying to initialize at the time.
This commit is contained in:
bunnie 2025-11-25 01:08:47 +08:00
parent 091f4ffd7c
commit 41f750163f
2 changed files with 13 additions and 2 deletions

View file

@ -148,6 +148,7 @@ fn main() -> ! {
log::info!("Vault2 PID is {}", xous::process::id());
let xns = xous_names::XousNames::new().unwrap();
let tt = ticktimer_server::Ticktimer::new().unwrap();
// Register the server with xous
let sid = xns.register_name(SERVER_NAME_VAULT2, None).expect("can't register server");
@ -388,6 +389,11 @@ fn main() -> ! {
let modals = modals::Modals::new(&xns).unwrap();
vault_ui.apply_glyph_style();
// give the system a second to stabilize, then try to mount
tt.sleep_ms(1000).ok();
let pddb = pddb::Pddb::new();
pddb.try_mount();
// reload the database
xous::send_message(
actions_conn,

View file

@ -12,12 +12,12 @@ use crate::{CommonEnv, ShellCmdApi};
pub struct PddbCmd {
pddb: pddb::Pddb,
mounted: bool,
}
impl PddbCmd {
pub fn new() -> Self {
let pddb = pddb::Pddb::new();
log::info!("PDDB mount result: {:?}", pddb.try_mount());
PddbCmd { pddb }
PddbCmd { pddb, mounted: false }
}
}
@ -25,6 +25,11 @@ impl<'a> ShellCmdApi<'a> for PddbCmd {
cmd_api!(pddb);
fn process(&mut self, args: String, _env: &mut CommonEnv) -> Result<Option<String>, xous::Error> {
// lazy-eval this mount
if !self.mounted {
log::info!("PDDB mount result: {:?}", self.pddb.try_mount());
self.mounted = true;
}
let mut ret = String::new();
#[cfg(not(feature = "pddbtest"))]
let helpstring = "pddb [basislist] [basiscreate] [basisunlock] [basislock] [basisdelete] [default]\n[dictlist] [keylist] [write] [writeover] [query] [copy] [dictdelete] [keydelete] [churn] [flush] [sync]";