diff --git a/services/pddb/src/api.rs b/services/pddb/src/api.rs index 40d87b5c4..758c1a650 100644 --- a/services/pddb/src/api.rs +++ b/services/pddb/src/api.rs @@ -13,6 +13,11 @@ use std::num::NonZeroU32; // note this name cannot be changed because it is baked into `libstd` pub(crate) const SERVER_NAME_PDDB: &str = "_Plausibly Deniable Database_"; pub(crate) const SERVER_NAME_PDDB_POLLER: &str = "_PDDB Mount Poller_"; +/// This is the registered name for a dedicated private API channel to the PDDB for doing the time reset +/// Even though nobody but the PDDB should connect to this, we have to share it publicly so the PDDB can +/// depend upon this constant. +pub const TIME_SERVER_PDDB: &'static str = "_dedicated pddb timeserver connection_"; + #[allow(dead_code)] pub(crate) const BASIS_NAME_LEN: usize = 64; // don't want this too long anyways, because it's not recorded anywhere - users have to type it in. #[allow(dead_code)] @@ -28,8 +33,8 @@ pub(crate) const PDDB_VERSION: u32 = 0x00_00_01_01; #[allow(dead_code)] // PDDB_A_LEN may be shorter than xous::PDDB_LEN, to speed up testing. #[allow(dead_code)] -//pub(crate) const PDDB_A_LEN: usize = xous::PDDB_LEN as usize; -pub(crate) const PDDB_A_LEN: usize = 4 * 1024 * 1024; +pub(crate) const PDDB_A_LEN: usize = xous::PDDB_LEN as usize; +// pub(crate) const PDDB_A_LEN: usize = 4 * 1024 * 1024; /// range for the starting point of a journal number, picked from a random seed /// the goal is to reduce info leakage about the age of structures relative to each other diff --git a/services/pddb/src/backend/dictionary.rs b/services/pddb/src/backend/dictionary.rs index 596fc1034..b4875f39a 100644 --- a/services/pddb/src/backend/dictionary.rs +++ b/services/pddb/src/backend/dictionary.rs @@ -130,7 +130,7 @@ impl DictCacheEntry { if index_cache.data.is_none() || index_cache.tag.is_none() { // somehow we hit a page where nothing was allocated (perhaps it was previously deleted?), or less likely, the data was corrupted. Note the isuse, skip past it. - if (errcnt < 16) || (errcnt % 8192 == 0) { + if (errcnt < 4) || (errcnt % 8192 == 0) { log::warn!("Dictionary fill: encountered unallocated page at {} in the dictionary map. {}/{}", try_entry, key_count, self.key_count); } errcnt += 1; @@ -217,6 +217,7 @@ impl DictCacheEntry { let mut try_entry = 1; let mut key_count = 0; let mut index_cache = PlaintextCache { data: None, tag: None }; + let mut warn_count = 0; while try_entry < KEY_MAXCOUNT && key_count < self.key_count && try_entry <= self.last_disk_key_index as usize { // cache our decryption data -- there's about 32 entries per page, and the scan is largely linear/sequential, so this should // be a substantial savings in effort. @@ -229,7 +230,10 @@ impl DictCacheEntry { // this case "should not happen" in practice, because the last_disk_key_index would either be correctly set as // short by a dict_add(), or a mount() operation would have limited the extent of the search. // if we are hitting this, that means the last_disk_key_index operator was not managed correctly. - log::warn!("expensive search op"); + if warn_count < 4 || (warn_count % 8192 == 0) { + log::warn!("expensive search op"); + } + warn_count += 1; try_entry += DK_PER_VPAGE; } else { let cache = index_cache.data.as_ref().expect("Cache should be full, it was already checked..."); diff --git a/services/pddb/src/lib.rs b/services/pddb/src/lib.rs index 77a03c78e..389b6b0df 100644 --- a/services/pddb/src/lib.rs +++ b/services/pddb/src/lib.rs @@ -36,6 +36,7 @@ impl PddbMountPoller { PddbMountPoller { conn } } pub fn is_mounted_nonblocking(&self) -> bool { + log::info!("mount poll"); match send_message(self.conn, Message::new_blocking_scalar(PollOp::Poll.to_usize().unwrap(), 0, 0, 0, 0) ).expect("couldn't poll mount poller") {