natevw / fatfs

Standalone FAT16/FAT32 filesystem implementation in JavaScript
47 stars 13 forks source link

Zero-length files shouldn't reserve a cluster #11

Open natevw opened 10 years ago

natevw commented 10 years ago

Right now due somewhat to the chain architecture, zero-length files always have at least their first cluster allocated. This is somewhat harmless, but is a bit wasteful and does go against the FAT spec which says the first cluster of a zero-length file should be set to "0".

natevw commented 10 years ago

I'm not sure this is urgent, but one way to tackle would be to move all the FAT allocations to the chain, and have the higher-level stuff simply read its .firstCluster property when updating the entry for the usual file size/mtime stuff.