mirror of
https://github.com/saymrwulf/xous-core.git
synced 2026-11-18 08:52:45 +00:00
verify that unmount callbacks are working
This commit is contained in:
parent
52d56f39f1
commit
d49c35dc0c
2 changed files with 24 additions and 2 deletions
|
|
@ -405,6 +405,7 @@ pub(crate) enum PasswordState {
|
||||||
Uninit,
|
Uninit,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
struct TokenRecord {
|
struct TokenRecord {
|
||||||
pub dict: String,
|
pub dict: String,
|
||||||
pub key: String,
|
pub key: String,
|
||||||
|
|
@ -1410,6 +1411,7 @@ fn notify_of_disconnect(pddb_os: &mut PddbOs, token_dict: &HashMap::<ApiToken, T
|
||||||
// 1. search to see if any of the active tokens are are in our token_dict
|
// 1. search to see if any of the active tokens are are in our token_dict
|
||||||
// 2. notify them of the disconnect, if there is a callback set.
|
// 2. notify them of the disconnect, if there is a callback set.
|
||||||
for (api_key, entry) in token_dict.iter() {
|
for (api_key, entry) in token_dict.iter() {
|
||||||
|
log::debug!("disconnect notify searching {:?}", entry);
|
||||||
if let Some(cb) = entry.conn {
|
if let Some(cb) = entry.conn {
|
||||||
match basis_cache.key_attributes(pddb_os, &entry.dict, &entry.key, entry.basis.as_deref()) {
|
match basis_cache.key_attributes(pddb_os, &entry.dict, &entry.key, entry.basis.as_deref()) {
|
||||||
Ok(_) => {
|
Ok(_) => {
|
||||||
|
|
|
||||||
|
|
@ -226,9 +226,15 @@ impl<'a> ShellCmdApi<'a> for PddbCmd {
|
||||||
"zerolength",
|
"zerolength",
|
||||||
None, true, true,
|
None, true, true,
|
||||||
Some(8),
|
Some(8),
|
||||||
None::<fn()>
|
None::<fn()>,
|
||||||
).expect("couldn't build empty key");
|
).expect("couldn't build empty key");
|
||||||
self.pddb.sync().unwrap();
|
self.pddb.sync().unwrap();
|
||||||
|
if let Some(name) = bname {
|
||||||
|
match self.pddb.lock_basis(name) {
|
||||||
|
Ok(_) => log::info!("basis {} lock successful", name),
|
||||||
|
Err(e) => log::info!("basis {} could not be unmounted: {:?}", name, e),
|
||||||
|
}
|
||||||
|
}
|
||||||
self.pddb.dbg_remount().unwrap();
|
self.pddb.dbg_remount().unwrap();
|
||||||
if let Some(name) = bname {
|
if let Some(name) = bname {
|
||||||
match self.pddb.unlock_basis(name, None) {
|
match self.pddb.unlock_basis(name, None) {
|
||||||
|
|
@ -255,7 +261,9 @@ impl<'a> ShellCmdApi<'a> for PddbCmd {
|
||||||
"seekwrite",
|
"seekwrite",
|
||||||
None, true, true,
|
None, true, true,
|
||||||
Some(64),
|
Some(64),
|
||||||
None::<fn()>
|
Some(|| {
|
||||||
|
log::info!("test:seekwrite key was unmounted");
|
||||||
|
})
|
||||||
).expect("couldn't build empty key");
|
).expect("couldn't build empty key");
|
||||||
// 1, 1, 1, 1
|
// 1, 1, 1, 1
|
||||||
log::info!("wrote {} bytes at offset 0",
|
log::info!("wrote {} bytes at offset 0",
|
||||||
|
|
@ -268,6 +276,18 @@ impl<'a> ShellCmdApi<'a> for PddbCmd {
|
||||||
log::info!("wrote {} bytes at offset 2",
|
log::info!("wrote {} bytes at offset 2",
|
||||||
seekwrite.write(&[2, 2, 2, 2]).unwrap()
|
seekwrite.write(&[2, 2, 2, 2]).unwrap()
|
||||||
);
|
);
|
||||||
|
if let Some(name) = bname {
|
||||||
|
match self.pddb.lock_basis(name) {
|
||||||
|
Ok(_) => log::info!("basis {} lock successful", name),
|
||||||
|
Err(e) => log::info!("basis {} could not be unmounted: {:?}", name, e),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if let Some(name) = bname {
|
||||||
|
match self.pddb.unlock_basis(name, None) {
|
||||||
|
Ok(_) => log::info!("basis {} unlocked successfully", name),
|
||||||
|
Err(e) => log::info!("basis {} could not be unlocked: {:?}", name, e),
|
||||||
|
}
|
||||||
|
}
|
||||||
// 1, 1, 2, 2, 2, 2, 0, 0, 3, 3
|
// 1, 1, 2, 2, 2, 2, 0, 0, 3, 3
|
||||||
log::info!("seek to {}",
|
log::info!("seek to {}",
|
||||||
seekwrite.seek(SeekFrom::Start(8)).unwrap()
|
seekwrite.seek(SeekFrom::Start(8)).unwrap()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue