Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When mounting a filesystem, often code like this is used: if !Filesystem::is_mountable(alloc, storage) { Filesystem::format(storage).ok(); } Filesystem::mount(alloc, storage) This mounts the filesystem twice because Filesystem::is_mountable is equivalent to Filesystem::mount(...).is_err(). Depending on the storage implementation, mounting the filesystem can have significant cost. But directly calling Filesystem::mount and re-mounting in the error case is prohibited by the borrow checker. This patch adds a try_mount method that accepts a callable that is called on mount error. Afterwards, mounting is re-tried.
- Loading branch information