How to sync a dos file system externally

Cliff Geschke cliff.geschke at
Tue Oct 2 18:56:36 UTC 2018

I have implemented a dos file system (msdos_*) on a flash device.


Because it is possible for the user to power down the system unexpectedly, I
want to sync the file system to the flash device after a 3 second idle time.
How do I externally force a sync on msdos from another thread?


A related problem is that I use FTP (ftpd.c) to externally read/write files on
the msdos formatted flash.  I have the idle timeout set to 3 minutes for the FTP
connection.  After 3 minutes, ftpd issues a chdir("/") which eventually calls
msdos_free_node_info() that calls fat_file_close() and may try to write out data
to the flash.  This is a problem because if the power is turned off at that time
the flash is corrupted.


So whatever method I use to sync msdos needs to update and write out the fat so
that the subsequent msdos_free_node_info() does nothing.


Thanks for any advice.




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the users mailing list