Crate affs_read

Crate affs_read 

Source
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_std compatible 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.
AffsReader
Main AFFS filesystem reader.
AffsReaderVar
Variable block size AFFS reader.
AmigaDate
Amiga date representation.
BootBlock
Parsed boot block.
DirEntry
Directory entry information.
DirIter
Iterator over directory entries.
EntryBlock
Parsed entry block (file header or directory).
FileExtBlock
Parsed file extension block.
FileReader
Streaming file reader.
FsFlags
Filesystem flags.
OfsDataBlock
Parsed OFS data block header.
RootBlock
Parsed root block.
VarDirEntry
Directory entry for variable block size filesystem.
VarDirIter
Directory iterator for variable block size filesystem.

Enums§

AffsError
Error type for AFFS operations.
EntryType
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§

BlockDevice
Block device trait for reading blocks from storage.
SectorDevice
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.