pub fn read_file(
partition: &[u8],
sb: &Superblock,
ino: u64,
) -> Result<Vec<u8>, UfsError>Expand description
Assemble the full byte content of the file inode ino, walking its block map
(direct di_db[0..12], then single/double/triple indirect via di_ib[0..3])
up to di_size. A hole (a 0 pointer, at any level of the tree) reads as
zeros; the last block is sized to the remaining di_size (fragment tail).
The assembled buffer is exactly di_size bytes.
§Errors
UfsError::ImpossibleGeometryifdi_sizeexceeds the partition length (an allocation bomb — the file cannot possibly be that large), or iffs_bsize/fs_fsizeare non-positive so block addressing is undefined.- Propagates
UfsErrorfrom locating/decodingino.