Skip to main content

physical_offset_for

Function physical_offset_for 

Source
pub fn physical_offset_for(raw_id: u64, feature_flags: u32) -> u64
Expand description

Phase 4 (issue #9): byte offset of page raw_id’s on-disk slot for a file with the given feature_flags.

Page 0 is always at offset 0 (4096 bytes, plaintext). Pages 1..N stride by physical_page_stride starting at byte 4096.

Total function: arithmetic uses u64, and a realistic file is orders of magnitude below u64::MAX / stride. Returns u64::MAX only on a contrived overflow input — the pager’s alloc_fresh checks the resulting file length against a real set_len call which surfaces an EINVAL-style I/O error well below this saturation point.