Update history:
Mini Fat Fuse Project
You are to write a file system using FUSE. The file system will be a simplified version of FAT.
The class/projX folder has the FUSE "hello world filesystem" example, that should work with make; make test.
Here it is:
dd if=/dev/zero of=mydisk.dmg bs=1024 count=1024Open this file and lseek to byte positions, and read and write from this file as you would the disk. Almost. On a disk you can only read and write entire clusters. No need to stand on formalities, for this project you can read or write whatever lengths are convenient.
Example: To update a FAT entry, just write the 32 bit entry. No need to read into a buffer the entire contents of the 1024 byte cluster containing the entry, updating the entry in the buffer, and then writing back all 1024 bytes. In the "real world", this does happen. Disk drives read or write in blocks.
A friend in need:
hexdump -C mydisk.dmgSee man hexdump.
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 * * 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 start: * * 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 * * 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. * */