diff --git a/services/pddb/src/backend/basis.rs b/services/pddb/src/backend/basis.rs index 3f47c76d2..f97caafa4 100644 --- a/services/pddb/src/backend/basis.rs +++ b/services/pddb/src/backend/basis.rs @@ -340,8 +340,10 @@ impl BasisCache { let mut dict_set = HashSet::::new(); for basis in self.cache.iter_mut() { basis.populate_caches(hw); - for key in basis.dicts.keys() { - dict_set.insert(String::from(key)); + for (key, dcache) in basis.dicts.iter() { + if dcache.flags.valid() { + dict_set.insert(String::from(key)); + } } } dict_set diff --git a/services/pddb/src/backend/dictionary.rs b/services/pddb/src/backend/dictionary.rs index dbf493d66..132234565 100644 --- a/services/pddb/src/backend/dictionary.rs +++ b/services/pddb/src/backend/dictionary.rs @@ -193,8 +193,10 @@ impl DictCacheEntry { if self.keys.len() < self.key_count as usize { self.fill(hw, v2p_map, cipher); } - for key in self.keys.keys() { - merge_list.insert(key.to_string()); + for (key, kcache) in self.keys.iter() { + if kcache.flags.valid() { + merge_list.insert(key.to_string()); + } } } /// Simply ensures we have the description of a key in cache. Only tries to load small key data. diff --git a/services/pddb/src/main.rs b/services/pddb/src/main.rs index 88c1d5072..323608098 100644 --- a/services/pddb/src/main.rs +++ b/services/pddb/src/main.rs @@ -440,6 +440,14 @@ fn xmain() -> ! { log::info!("Doing delete pattern test"); delete_pattern(&mut pddb_os, &mut basis_cache, None, None, None, None); pddb_os.dbg_dump(Some("patterne".to_string())); + + log::info!("Doing remount disk test"); + let mut basis_cache = BasisCache::new(); + if let Some(sys_basis) = pddb_os.pddb_mount() { + basis_cache.basis_add(sys_basis); + list_all(&mut pddb_os, &mut basis_cache); + pddb_os.dbg_dump(Some("remounte".to_string())); + } } log::info!("CI done"); /* diff --git a/services/pddb/src/tests.rs b/services/pddb/src/tests.rs index d2af3f5eb..3677bdd5b 100644 --- a/services/pddb/src/tests.rs +++ b/services/pddb/src/tests.rs @@ -224,11 +224,23 @@ pub(crate) fn delete_pattern(hw: &mut PddbOs, basis_cache: &mut BasisCache, } } } + for dict in basis_cache.dict_list(hw).iter() { + let da = basis_cache.dict_attributes(hw, dict, None).unwrap(); + log::info!("{:?}", da); + } log::info!("doing all-basis sync"); basis_cache.sync(hw, None).unwrap(); log::info!("all-basis sync done"); + list_all(hw, basis_cache); + for dict in basis_cache.dict_list(hw).iter() { + let da = basis_cache.dict_attributes(hw, dict, None).unwrap(); + log::info!("{:?}", da); + } +} + +pub(crate) fn list_all(hw: &mut PddbOs, basis_cache: &mut BasisCache) { // now list all the attributes of the basis for dict in basis_cache.dict_list(hw).iter() { let da = basis_cache.dict_attributes(hw, &dict, None).unwrap(); diff --git a/tools/pddbdbg.py b/tools/pddbdbg.py index 71a03b38f..a9171ccb1 100755 --- a/tools/pddbdbg.py +++ b/tools/pddbdbg.py @@ -668,6 +668,7 @@ class SpaceUpdate: def decode_fscb(img, keys, FSCB_LEN_PAGES=2): global SYSTEM_BASIS fscb = None + fscb_count = 0 if SYSTEM_BASIS in keys: key = keys[SYSTEM_BASIS] pages = [img[i:i+4096] for i in range(0, len(img), 4096)] @@ -711,7 +712,8 @@ def decode_fscb(img, keys, FSCB_LEN_PAGES=2): break else: fscb.try_replace(SpaceUpdate(cipher.decrypt(entry))) - + fscb_count += 1 + print("Total FSCB entries found: {}".format(fscb_count)) return fscb if __name__ == "__main__":