pub enum Block {
D13([usize; 2]),
DO([usize; 2]),
PO(usize),
CPM((usize, u8, u16)),
FAT((u64, u8)),
D64([usize; 2]),
}Expand description
Encapsulates the disk address and addressing mode used by a file system.
Disk addresses generally involve some transformation between logical (file system) and physical (disk fields) addresses.
Disk images are responsible for serving blocks in response to a file system request, see the ‘img’ docstring for more.
The Block implementation includes a simple mapping from blocks to sectors; disk images can use this or not as appropriate.
Variants§
D13([usize; 2])
value is [track,sector]
DO([usize; 2])
value is [track,sector]
PO(usize)
value is block number
CPM((usize, u8, u16))
value is (absolute block number, BSH, OFF); see cpm::types
FAT((u64, u8))
value is (first logical sector,num sectors)
D64([usize; 2])
value is [track,sector]
Implementations§
Source§impl Block
impl Block
Sourcepub fn get_lsecs(&self, secs_per_track: usize) -> Vec<[usize; 2]>
pub fn get_lsecs(&self, secs_per_track: usize) -> Vec<[usize; 2]>
Get a track-sector list for this block.
At this level we can only assume a simple monotonically increasing relationship between blocks and sectors.
Any further skewing must be handled by the caller. CP/M and FAT offsets are accounted for.
For CP/M be sure to use 128 byte logical sectors when computing secs_per_track.