fix reporting error in directory listings

This commit is contained in:
bunnie 2021-11-26 03:36:36 +08:00
parent 468e372bfa
commit e02df18374
5 changed files with 31 additions and 5 deletions

View file

@ -340,8 +340,10 @@ impl BasisCache {
let mut dict_set = HashSet::<String>::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

View file

@ -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.

View file

@ -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");
/*

View file

@ -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();

View file

@ -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__":