-
Notifications
You must be signed in to change notification settings - Fork 65
Description
The current implementation makes it impossible to recover from a CorruptedFileSystem error by formatting filesystem, unless the storage argument of Filesystem::new() implements Clone or similar.
let fs = match FileSystem::new(storage, FsOptions::new()) {
Ok(fs) => fs,
Err(fatfs::Error::CorruptedFileSystem) => {
// `storage` moved, so it is impossible to call `fatfs::format_volume` here.
todo!()
}
Err(_) => todo!(),
};It is also impossible to fix it by implementing Read, Write & friends for &mut storage due to the current IntoStorage that will consume by self...
Another related issue is that storage is not returned in unmount, resulting in it being lost forever in e.g. an embedded system where storage directly correlates to a peripheral.
I have played around with one possible solution, that would be able to fix all of the above issues, but i am not sure if it is a direction you want to go? MathiasKoch@6ed236a
If so, i would love to finish it up and make a PR.
Currently it is missing the return of storage on unmounts, an Into implementation for StdIoWrapper and fixing the examples & tests.