OSDN Git Service

(none)
[hos/hos-v4a.git] / aplfw / volume / fat / fatvol_flushfat.c
1
2 #include <string.h>
3 #include "fatvol_local.h"
4
5
6 /** FATのフラッシュ */
7 void FatVol_FlushFat(C_FATVOL *self)
8 {
9         unsigned long i;
10         
11         /* FAT先頭へ移動 */
12         File_Seek(self->hBlockFile, self->uiFatStartSector * self->uiBytesPerSector, FILE_SEEK_SET);
13         
14         for ( i = 0; i < self->uiFatNum; i++ )
15         {
16                 int j;
17                 
18                 for ( j = 0; j < self->uiSectorPerFat; j++ )
19                 {
20                         if ( self->pubFatDirty[j] )
21                         {
22                                 File_Write(self->hBlockFile, &self->pubFatBuf[j * self->uiBytesPerSector], self->uiBytesPerSector);
23                         }
24                         else
25                         {
26                                 File_Seek(self->hBlockFile, self->uiBytesPerSector, FILE_SEEK_CUR);
27                         }
28                 }
29         }
30
31         /* 更新フラグクリア */
32         memset(self->pubFatDirty, 0, self->uiSectorPerFat);
33 }
34
35
36 /* end of file */