FAT

FatVolSync()

PROTOTYPE

#include <fsdriver.h>

int FatVolSync(FAT *fat);

DESCRIPTION

FatVolSync() flushes data previously written by FatVolWrSects() to a FAT volume’s backing store. fat is a handle previously returned by FatVolOpen().

FatVolSync() invokes the TargetFAT driver report() function, if nonzero, with the FS_SYNC request code. Blunk’s FTLs and smart media managers, such as TargeteMMC, TargetFTL-NDM, TargetFTL-NOR, and TargetSD, respond by writing all cached data to flash.

If successful, FatVolSync() returns 0. Otherwise, it sets errno and returns -1.

ERROR CODES

EFAULT fat equals NULL.
EINVAL fat is not a valid volume handle.
EROFS The volume is read-only.

EXAMPLE

      FAT *fat;

      ...

      /*---------------------------------------------------------------*/
      /* Flush data possibly stored in underlying FTL layer.           */
      /*---------------------------------------------------------------*/
      if (FatVolSync(fat))
        error("FatVolSync() failed");