affs-read
A no_std compatible Rust crate for reading Amiga Fast File System (AFFS) disk images.
Features
no_stdcompatible - Works in embedded and bare-metal environments- Zero heap allocations - Core functionality uses only stack memory
- OFS and FFS support - Handles both Original File System and Fast File System
- INTL and DIRCACHE modes - Full support for international character handling and directory caching
- Streaming file reading - Memory-efficient sequential file access
- Directory traversal - Iterate through directory contents with lazy loading
- Checksum validation - Ensures data integrity on all block reads
Installation
Add to your Cargo.toml:
[]
= "0.1"
Feature Flags
| Feature | Default | Description |
|---|---|---|
std |
Yes | Enables std::error::Error implementation |
alloc |
No | Enables features requiring heap allocation |
For no_std environments:
[]
= { = "0.1", = false }
Quick Start
use ;
// Implement BlockDevice for your storage medium
Reading Files
// Find and read a file
let entry = reader.find_path?;
let mut file = reader.read_file?;
// Read into buffer
let mut buffer = vec!;
file.read_all?;
// Or read in chunks
let mut chunk = ;
while !file.is_eof
Navigating Directories
// Find a subdirectory
let subdir = reader.find_entry?;
// List its contents
for entry in reader.read_dir?
// Or use path-based lookup
let deep_file = reader.find_path?;
Disk Sizes
// Standard DD floppy (880KB, 1760 blocks)
let reader = new?;
// HD floppy (1.76MB, 3520 blocks)
let reader = new_hd?;
// Custom size (e.g., hard disk partition)
let reader = with_size?;
Supported Formats
| Format | DOS Type | Description |
|---|---|---|
| OFS | DOS\0 | Original File System |
| FFS | DOS\1 | Fast File System |
| OFS+INTL | DOS\2 | OFS with international mode |
| FFS+INTL | DOS\3 | FFS with international mode |
| OFS+DC | DOS\4 | OFS with directory cache |
| FFS+DC | DOS\5 | FFS with directory cache |
Error Handling
All operations return Result<T, AffsError>:
use AffsError;
match reader.find_path
Safety
This crate:
- Uses
#![deny(unsafe_op_in_unsafe_fn)]for strict unsafe handling - Has no external runtime dependencies
- Validates checksums on all block reads
- Is fuzz-tested for robustness against malformed inputs
Minimum Supported Rust Version
Rust 2024 edition (1.85+)
License
Licensed under the MIT License. See LICENSE for details.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.