-
-
Notifications
You must be signed in to change notification settings - Fork 29
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_ok(). 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
1 parent
960e57d
commit 16af6af
Showing
2 changed files
with
23 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters