Update history:
Hints
/* * mini_fat_fuse * a really simple fat file system using fuse * assume: * 1- 1024 byte clusters * 2- cluster 0 is superblock and can be all zeros * 3- clusters 1-4 is the fat table of 1024 entries * 4- cluster 5 is the first cluster of the root directory * 5- root directory has no . or .. entries * 6- we do not support subdirectories * 7- fat table entry is simple: cluster 5 is the 5-th * entry of the fat table * 8- there are a total of 1024 clusters, of which the * first 5 are metadata. The total disk size if 1019Ki * 9- the file system can be initialized to zero using: * dd if=/dev/zero of=mini_fat.dmg bs=1024 count=1024 * A- files are one block long; don't use FAT table, just * a next free cluster index in superblock; don't reclaim * blocks on unlink * * Implementation: * 1- Implement the directory functions: readdir, getattr, open, create * 2- Implement unlink * 3- Implement write (use hexdump -C against fat.dmg file to debug) * 4- Implement read * 5- Further functions: truncate and utimens * * How to continue: * I would next implement multiple cluster files, modifying * fat_read and fat_write, and introducing use of the FAT table. * Truncate reimplementation can do all handing of adding and removing * clusters to the cluster chain, so write can assume the file has * enough clusters. * * I would leave multiple cluster directories and subdirectories * for a third level of implementation. Even if you wrote it, how * in a reasonable time frame would you test it? */