Closed thejpster closed 11 months ago
- Writing to a file no longer flushes file metadata to the Directory Entry. Instead closing a file now flushes file metadata to the Directory Entry.
But this means I have always to close the file. Currently I store a RawFile object (as filehandler) and execute only the write. In this case the file gets created but stays always empty (Currently I don't close the file for testing, but in real scenario this can also happen, so the data is lost?)
Usecase:
The problem is when I have to close it, the RawFile "handler" is invalid in my understanding. Is that correct?
Reason why I don't like to close:
If closing/re-opening is a performance bottleneck, you could propose a PR containing a flush
API, which just looks at the dirty
flag and if required, writes to disk and then clears it.
I thought about the same. I will have a look into it tomorrow and will create a pullrequest. Thanks for the project!
@thejpster
Since DOS 7.1 the two most-significant bits of this cluster entry may hold two optional bitflags representing the current volume status on FAT16 and FAT32, but not on FAT12 volumes. These bitflags are not supported by all operating systems, but operating systems supporting this feature would set these bits on shutdown and clear the most significant bit on startup: If bit 15 (on FAT16) or bit 27 (on FAT32)[41] is not set when mounting the volume, the volume was not properly unmounted before shutdown or ejection and thus is in an unknown and possibly "dirty" state.[27] On FAT32 volumes, the FS Information Sector may hold outdated data and thus should not be used. The operating system would then typically run SCANDISK or CHKDSK on the next startup[nb 9][41] (but not on insertion of removable media) to ensure and possibly reestablish the volume's integrity. Source: https://en.wikipedia.org/wiki/Design_of_the_FAT_file_system
Could this help? So the computer gets the indication that the filesystem was not properly closed and it should rescan?
There is always a trade off between performance and reliability with FAT.
I like the idea of being able to mark disks as dirty if they have open writable files, and non-dirty when the last writable file has been closed. I just wouldn't want to see read-only access (99% of my use case) mark the FS as dirty.
There is always a trade off between performance and reliability with FAT.
I like the idea of being able to mark disks as dirty if they have open writable files, and non-dirty when the last writable file has been closed. I just wouldn't want to see read-only access (99% of my use case) mark the FS as dirty.
Haha then we have opposite usecases 😄 i have most of the time writing. Neverthless, I will check this flag out. I don't think during read the dirty flag will be set
Changed
SdCard::get_card_type
will now perform card initialisation (#87 and #90).Cluster
toClusterId
and stopped you adding two togetherAdded
append_file
,create_file
,delete_file
,list_dir
,shell
tests/directories.rs
,tests/read_file.rs
Removed
Controller
alias forVolumeManager
removed.VolumeManager::open_dir_entry
removed, as it was unsafe to the user to randomly pick a starting cluster.create_test
,test_mount
,write_test
,delete_test