次の方法で共有


TexFAT Programming Considerations (Windows Embedded CE 6.0)

1/6/2010

The interfaces exposed by the transaction-safe extended FAT (TexFAT) file system are equivalent to those associated with the FAT file system. The following enhancements are provided by TexFAT to ensure transaction safety:

  • TexFAT-specific drivers
  • TexFAT atomic sector writes
  • FILE_FLAG_WRITE_THROUGH attribute
  • FAT volume operations
  • Operations from other components

TexFAT-specific Drivers

TexFAT is an extension of the FAT file system. TexFAT requires a hardware-specific driver designed for the type of media on which the volume resides. The driver abstracts the media storage and provides atomic block operations.

For flash storage, the block driver must provide a verification of atomicity on the block level to provide transaction-safety for data on a disk.

TexFAT Atomic Sector Writes

TexFAT requires the underlying block structure to support atomic sector writes. The flash driver and most CF card hardware provide atomic sector write operations. If the block driver is not atomic, TexFAT cannot guarantee transaction-safety.

Use the following settings for hard drives and other media with non-atomic sector writes:

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\HDProfile\FATFS]
   "TexFATMarkAlways"=dword:1
   "NonatomicSector"=dword:1
   "DisableAutoScan"=dword:1

Use the following settings for storage media with atomic sector writes:

[HKEY_LOCAL_MACHINE\System\StorageManager\Profiles\<Profile Name>\FATFS]
   "DisableAutoScan"=dword:1

FILE_FLAG_WRITE_THROUGH attribute

Most TexFAT operations are triggered by the FILE_FLAG_WRITE_THROUGH file attribute, as follows:

  • When the file attribute FILE_FLAG_WRITE_THROUGH is set to TRUE for any file, each WriteFile function call is committed to the disk in an individual transaction. This means that TexFAT has written data to both the volume and the FAT tables. If this attribute is not set, the data written by the WriteFile function is not committed until the CloseHandle or the FlushFileBuffers function is called.
  • When CreateFile creates a memory-mapped file, it automatically sets the FILE_FLAG_WRITE_THROUGH value to TRUE.
  • All databases and memory-mapped files must commit every WriteFile operation to the FAT atomically and set the FILE_FLAG_WRITE_THROUGH value to TRUE.**

Operations from Other Component

Other operations such as rename, createdir, and RemoveDirectory are all transaction-safe and committed when the CloseHandle, the FlushFileBuffers, the or WriteFile function is called.**

See Also

Concepts

Transaction-Safe Extended FAT File System