rust-fatfs icon indicating copy to clipboard operation
rust-fatfs copied to clipboard

Allow clearing FAT dirty flag.

Open reitermarkus opened this issue 2 years ago • 5 comments

When the FAT dirty flag is set (which happens after ejecting an SD card without unmounting first on macOS), creating directories does not work as expected afterwards: When remounting the SD card after creating directories, these directories will be files instead.

If the dirty flag is cleared before creating the directories, mounting the SD card again under macOS works as expected, i.e. the directories are accessible as normal.

I have added a set_fat_dirty_flag method to clear the flag, but I am not sure when clearing this flag should be done.

When the dirty flag is set, this should result in an error when creating the FileSystem (or when trying to write to it). Alternatively, the flag should ideally be cleared automatically when mounting after the filesystem has been checked somehow.

Closes https://github.com/rafalh/rust-fatfs/issues/64.

reitermarkus avatar May 26 '22 04:05 reitermarkus

@rafalh, I have moved the check and added an option to ignore/clear the flag when mounting the file system.

reitermarkus avatar Jun 11 '22 09:06 reitermarkus

@rafalh, can you review this again? Thanks.

reitermarkus avatar Jun 13 '22 12:06 reitermarkus

@rafalh, ping.

reitermarkus avatar Aug 22 '22 19:08 reitermarkus

@rafalh, could you have another look here? Thanks.

reitermarkus avatar Oct 06 '22 02:10 reitermarkus

@rafalh, can you take a look here? You should review my other PRs first so I can rebase this one for easier review.

reitermarkus avatar Dec 21 '23 19:12 reitermarkus