CodePudding user response:
In embedded system based on WinCE, usually NandFlash + FAT file system is the most common way of data storage, in some applications, the need to frequent the same large file write operations, such as writing log file, modify the system configuration files, and so on, to the large file operation, not only involves the changes of the contents of the documents, because the NandFlash block/sector structure at the same time, also involves the FAT table changes, these changes may lead to large-scale NandFlash block erasure and data move, when the CPU load is relatively heavy, FAT file system within some defect is likely to be exposed, the stable operation of endangering equipment,In order to circumvent the risk of the FAT file system, we designed for such applications to write a new file to read and write API function, a new API functions only in the name of the function is much more "Em" two letters, the function parameters are in complete accord with standard of API, the application is very easy to replace,
New API function, to the large volume of the original file mapping as a directory + directory package enclosed several Size of NandFlash sector Size quantum file, due to the Size of the quantum file is always a sector, so in FAT as separate items in the table, there is no list, after the system into stable operation, the number of quantum file moment there would be no big change, or no change (profile, or log files to the cap on the application Settings), so the new API FAT table of FAT file system, directory will minimize the load, thereby significantly avoid critical areas of FAT file system is destroyed by the possibility of random power outages and other accidents,