Tiny File System
Tiny File System provides a file system over any device for which an IBlockDriver can be written. The file system its self is a Log Structured File System which is ideally suited to flash memory devices especially small scale devices which do not have hardware support to wear leveling.
The file system comes with a MemoryBlockDriver which can be used for testing of the interfaces. This driver is based off of non-persistent memory so is not suited for production use.
The file system exposes two classes, one is the TinyFileSystem class and the other is the TinyFileStream. TinyFileSystem provides the necessary functions to Format a device, mount an existing file system from a device, create, open, delete, copy and rename files and more.
The TinyFileStream exposes files created/opened from the file system as a stream. Most stream functionality works as expected. The one exception is that SetLength does not currently allow you to grow the file, this is not a design limitation of the file system, in fact it is quite easy to implement on the current design and will be done eventually.
In addition to the above, the code contains a direct port of the BufferedStream found in the Mono project. The buffered stream is not required for the functionality of the file system, but is useful to optimize writes to the file system. TinyFileStream writes every change directly to the file system which is efficient if you are writing blocks of data at a time, but creates a lot of log entries on the files system which need to be garbage collected. In these scenarios, a BufferedStream can wrap the TinyFileStream to buffer these small writes and write them out in larger chunks.
For the most part the file system functionality is pretty much feature complete, except for the ability to expand the file length without actually writing data to the file. The key thing that is still required is a significant amount of testing especially in the scenarios where multiple handles are opened to the same file.
Then of course the primary goal, writing the IBlockDriver implementation for the upcoming Flash memory module from GHI. Unfortunately I have not got the module yet, so this will need to wait until such time as I have the module. In the meantime I want to get this out there so that it can be reviewed by the broader community.
My biggest concern is that of performance, not knowing how the module will perform esp. with some of the decisions I have made with the file system. I have opted to attempt to focus on File System integrity, but there might be a performance cost that is not acceptable so once I have the device and can do real benchmarking I will not make changes in this area unless it will further the goal of FS integrity.