APFS: lê o mapa de espaço livre do spaceman
Percorre o spaceman, os chunk-info blocks e os bitmaps para entregar à varredura profunda só os blocos não alocados. Contêineres com CAB voltam a varrer o volume inteiro, com aviso. Conferido com a imagem de referência do dfvfs. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
a75cc6aeba
commit
c1c4f442d7
3 files changed
+137
-4
No files matched your search
@@ -2,8 +2,8 @@
|
||||
|
||||
mod common;
|
||||
use common::*;
|
||||
use guara_core::fs::apfs::{fletcher64, live_paths};
|
||||
use guara_core::source::FileSource;
|
||||
use guara_core::fs::apfs::{fletcher64, free_extents, live_paths};
|
||||
use guara_core::source::{FileSource, Source};
|
||||
use guara_core::*;
|
||||
use std::path::PathBuf;
|
||||
|
||||
@@ -26,6 +26,17 @@ fn reads_the_live_tree_of_the_reference_image() {
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn free_space_map_matches_the_spaceman() {
|
||||
let Some(p) = img() else { return };
|
||||
let src = FileSource::open(&p).unwrap();
|
||||
let free = free_extents(&src, 0).expect("mapa de espaço livre");
|
||||
let bytes: u64 = free.iter().map(|e| e.len).sum();
|
||||
assert_eq!(bytes, 904 * 4096);
|
||||
assert_eq!(free.first().unwrap().offset, 110 * 4096);
|
||||
assert!(free.iter().all(|e| e.end() <= src.size()));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn checksum_matches_real_blocks() {
|
||||
let Some(p) = img() else { return };
|
||||
|
||||
Reference in new issue
Block a user