Skip to main content

tree_walk_mut

Function tree_walk_mut 

Source
pub fn tree_walk_mut<R: Read + Write + Seek>(
    reader: &mut BlockReader<R>,
    root_logical: u64,
    csum_type: ChecksumType,
    visitor: &mut dyn FnMut(&mut Vec<u8>, &TreeBlock) -> bool,
) -> Result<()>
Expand description

Walk a tree (DFS), allowing the visitor to modify each block in place.

The visitor receives the raw block buffer and the parsed TreeBlock. If it returns true, the block is re-checksummed using csum_type and written back to disk. This is used by operations that need to patch tree block headers or items (e.g. fsid rewrite, repair).

ยงErrors

Returns an error if the root block cannot be read or any write fails.