pellepl / spiffs

Wear-leveled SPI flash file system for embedded devices
MIT License
1.52k stars 402 forks source link

O_TRUNC needs an option/callback to invalidate metadata #253

Open MMI opened 4 years ago

MMI commented 4 years ago

In my application, I have been using the meta support to add CRC to my files.

Since I receive the files in chunks, over a wireless link, I don't update the CRC until I am certain I have received all of the data... so naively, the CRC field is either -1 for a new file (erased flash) or something valid.

When a file is opened with O_TRUNC or otherwise truncated, it would be nice if I had a way to invalidate this metadata.