GasInfinity/nzfat
A very generic and configurable FAT12/16/32 implementation with VFAT support.
A very generic and configurable FAT12/16/32 implementation library with VFAT support written in zig. Almost all the features are configurable, from long filename support (and the max number of characters it supports) to the maximum supported FAT type (12/16/32).
The library is not mature enough for production usage.
Almost everything revolves around the type nzfat.FatFileSystem
and the function nzfat.format.make()
.
Please see a basic example or messy testing code that uses all its features
Searching for 1 free entry in a directory (a.k.a: Short filename only)
Searching for a free cluster linearly
Deletion of files and directories
Short filename alternatives for functions when using a VFAT FatFilesystem
Searching for N free clusters for file and directory creation
Allocate new directory entries if no entries found and not in root (FAT12/16 only)
Allocate clusters for files
Creation of files and directories with short names
API to modify dates and times and attributes in entries
API for reading and writing file contents
Searching for N free entries in a directory and creation of directory entries with LFN entries if needed.
Finish cross-section long filename directory creation
Support Windows NT extra reserved short filename case flags
Create fat formatted media
API for renaming files without copying
API for moving files without copying
Utility to write files given a buffer (a.k.a: writeAllBytes)
Proper FAT unmounting
Finish FAT32 formatting
Proper FAT mirroring and active FAT handling
Optimize the filesystem by properly using FSInfo32 or caching the last free sector/free sector count (When do we calculate it in FAT12/16/(32 when there's no fsinfo or an invalid one)?)
Utility to check and 'fix' fat filesystem
Comptime utility function to create directories and files given a comptime known path (Really useful!)
Comptime utility function to search for directories and files given a comptime known path (Really useful!)
Reorganize/rename things
Rewrite codepage name handling
Rewrite UTF-16 name handling
Think about how to handle errors while writing (e.g: currently an error while allocating clusters will leave the FAT table with dangling clusters...)
Behaviour tests
Implement some sort of I/O cache? Or leave it to the BlockDevice implementation?
Some sort of cache strategy for FAT entries if requested.
API Freeze