Expand description
§affs-read
A no_std compatible crate for reading Amiga Fast File System (AFFS) disk images.
This crate provides zero-allocation reading of ADF (Amiga Disk File) images, supporting both OFS (Original File System) and FFS (Fast File System) variants.
§Features
no_stdcompatible by default- Zero heap allocations in core functionality
- Support for OFS and FFS filesystems
- Support for INTL and DIRCACHE modes
- Streaming file reading
- Directory traversal
- Extensively fuzz-tested for safety and correctness
See PERFORMANCE.md for detailed benchmarks and optimization documentation.
§Example
ⓘ
use affs_read::{AffsReader, BlockDevice};
// Implement BlockDevice for your storage
struct MyDevice { /* ... */ }
impl BlockDevice for MyDevice {
fn read_block(&self, block: u32, buf: &mut [u8; 512]) -> Result<(), ()> {
// Read block from storage
Ok(())
}
}
let device = MyDevice { /* ... */ };
let reader = AffsReader::new(&device)?;
// List root directory
for entry in reader.read_dir(reader.root_block())? {
println!("{}", entry.name());
}Structs§
- Access
- Access permissions.
- Affs
Reader - Main AFFS filesystem reader.
- Affs
Reader Var - Variable block size AFFS reader.
- Amiga
Date - Amiga date representation.
- Boot
Block - Parsed boot block.
- DirEntry
- Directory entry information.
- DirIter
- Iterator over directory entries.
- Entry
Block - Parsed entry block (file header or directory).
- File
ExtBlock - Parsed file extension block.
- File
Reader - Streaming file reader.
- FsFlags
- Filesystem flags.
- OfsData
Block - Parsed OFS data block header.
- Root
Block - Parsed root block.
- VarDir
Entry - Directory entry for variable block size filesystem.
- VarDir
Iter - Directory iterator for variable block size filesystem.
Enums§
- Affs
Error - Error type for AFFS operations.
- Entry
Type - Entry type in the filesystem.
- FsType
- Filesystem type.
Constants§
- ACC_
ARCHIVE - Archived.
- ACC_
DELETE - Delete protected.
- ACC_
EXECUTE - Execute protected.
- ACC_
HOLD - Hidden.
- ACC_
PURE - Pure (re-entrant).
- ACC_
READ - Read protected.
- ACC_
SCRIPT - Script.
- ACC_
WRITE - Write protected.
- AMIGA_
EPOCH_ OFFSET - Amiga epoch: January 1, 1978 00:00:00 UTC. Offset from Unix epoch (January 1, 1970) in seconds. 8 years = 2922 days (including leap years 1972, 1976).
- BLOCK_
SIZE - Logical block size in bytes.
- BLOCK_
SIZES - Supported block sizes for probing.
- BM_
MAP_ SIZE - Bitmap map entries.
- BM_
PAGES_ EXT_ SIZE - Bitmap pages in extension block.
- BM_
PAGES_ ROOT_ SIZE - Bitmap pages in root block.
- BM_
VALID - Valid bitmap flag value.
- BOOT_
BLOCK_ SIZE - Boot block size (2 blocks).
- CYLINDERS
- Number of cylinders (tracks).
- DOSFS_
DIRCACHE - Directory cache mode.
- DOSFS_
FFS - Fast File System.
- DOSFS_
INTL - International mode (case-insensitive for international characters).
- DOSFS_
OFS - Original File System.
- FFS_
DATA_ SIZE - FFS data block payload size (full block).
- FILE_
LOCATION - File header structure offset from end of block.
- FLOPPY_
DD_ SECTORS - Standard floppy disk sector count (DD: 880KB).
- FLOPPY_
HD_ SECTORS - Standard floppy disk sector count (HD: 1.76MB).
- HASH_
TABLE_ SIZE - Hash table size (entries per directory).
- HEADS
- Number of heads.
- MAX_
BLOCK_ SIZE - Maximum block size supported (8192 bytes = 16 sectors).
- MAX_
BOOT_ BLOCK - Maximum boot block location to probe (sector 0 and 1).
- MAX_
COMMENT_ LEN - Maximum comment length.
- MAX_
DATABLK - Maximum data block pointers per file header or extension block.
- MAX_
LOG_ BLOCK_ SIZE - Maximum log2 block size (512 << 4 = 8192 bytes).
- MAX_
NAME_ LEN - Maximum filename length.
- MAX_
SYMLINK_ LEN - Maximum symlink target length.
- OFS_
DATA_ SIZE - OFS data block payload size.
- SECTORS_
PER_ TRACK_ DD - Sectors per track (DD).
- SECTORS_
PER_ TRACK_ HD - Sectors per track (HD).
- ST_DIR
- Directory secondary type.
- ST_FILE
- File secondary type.
- ST_LDIR
- Hard link to directory secondary type.
- ST_
LFILE - Hard link to file secondary type.
- ST_
LSOFT - Soft link secondary type.
- ST_ROOT
- Root block secondary type.
- SYMLINK_
OFFSET - Symlink target offset in block (same as hash table offset).
- T_DATA
- Data block type (OFS only).
- T_DIRC
- Directory cache block type.
- T_
HEADER - Header block type.
- T_LIST
- List/extension block type.
Traits§
- Block
Device - Block device trait for reading blocks from storage.
- Sector
Device - Sector device trait for reading 512-byte sectors.
Functions§
- bitmap_
sum - Calculate bitmap block checksum.
- boot_
sum - Calculate the boot block checksum.
- hash_
name - Compute hash value for a name.
- intl_
to_ upper - Convert character to uppercase with international support.
- max_
utf8_ len - Calculate maximum UTF-8 length for a Latin1 string.
- names_
equal - Compare two names for equality (case-insensitive).
- normal_
sum - Calculate the normal checksum for a block.
- normal_
sum_ slice - Calculate the normal checksum for a variable-size block.
- read_
symlink_ target - Read symlink target from a block buffer.
- read_
symlink_ target_ with_ block_ size - Read symlink target with variable block size support.
- read_
u16_ be - Read a big-endian u16 from a buffer.