Corruption happens if:
* files are created in non-root directory
* directory size becomes greater or equal to cluster size
Creating last directory entry in the directory cluster corrupts the
cluster directly preceding the directory cluster.
For 512 bytes long cluster creating 8th directory entry (counted from 1)
will cause first corruption.
Directory entry that causes the corruption will not be updated correctly.
Fixes#42
Previous code removed source file before returning an error.
It also caused a clusters leak. Now it returns error before doing any
modifications on the partition.
BufStream is universal and can be used with any filesystem so its place is
in different crate. Also moved Partition struct from examples to
fscommon::StreamSlice struct (please note constructor arguments has changed).
This change allows for moving an object ownership to FileSystem object
instead of borrowing it. It makes usage of library easier in some cases.
Unfortunately it is a breaking change.
Dir methods do not change Dir object itself. They usually clone inner
stream so no change really happens self struct. Underlying partition is
modified but it does not have to affect API. For example see
std::fs::File::set_len. This change greatly simplifies rename API usage.