FatPkg/EnhancedFatDxe: Make the variable name follow rule

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
This commit is contained in:
Dandan Bi 2016-12-08 13:18:08 +08:00 committed by Ruiyu Ni
parent 5d7cee9d3c
commit c1680e885d
8 changed files with 100 additions and 100 deletions

View File

@ -60,7 +60,7 @@ Returns:
// //
// End of directory // End of directory
// //
ASSERT (IoMode == READ_DATA); ASSERT (IoMode == ReadData);
((FAT_DIRECTORY_ENTRY *) Entry)->FileName[0] = EMPTY_ENTRY_MARK; ((FAT_DIRECTORY_ENTRY *) Entry)->FileName[0] = EMPTY_ENTRY_MARK;
((FAT_DIRECTORY_ENTRY *) Entry)->Attributes = 0; ((FAT_DIRECTORY_ENTRY *) Entry)->Attributes = 0;
return EFI_SUCCESS; return EFI_SUCCESS;
@ -106,7 +106,7 @@ Returns:
// //
// Write directory entry // Write directory entry
// //
Status = FatAccessEntry (OFile, WRITE_DATA, EntryPos, &DirEnt->Entry); Status = FatAccessEntry (OFile, WriteData, EntryPos, &DirEnt->Entry);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -147,7 +147,7 @@ Returns:
LfnEntry.Ordinal = DELETE_ENTRY_MARK; LfnEntry.Ordinal = DELETE_ENTRY_MARK;
} }
Status = FatAccessEntry (OFile, WRITE_DATA, EntryPos, &LfnEntry); Status = FatAccessEntry (OFile, WriteData, EntryPos, &LfnEntry);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -322,7 +322,7 @@ Returns:
} }
EntryPos--; EntryPos--;
Status = FatAccessEntry (Parent, READ_DATA, EntryPos, &LfnEntry); Status = FatAccessEntry (Parent, ReadData, EntryPos, &LfnEntry);
if (EFI_ERROR (Status) || if (EFI_ERROR (Status) ||
LfnEntry.Attributes != FAT_ATTRIBUTE_LFN || LfnEntry.Attributes != FAT_ATTRIBUTE_LFN ||
LfnEntry.MustBeZero != 0 || LfnEntry.MustBeZero != 0 ||
@ -442,7 +442,7 @@ Returns:
// //
// Read the next directory entry until we find a valid directory entry (excluding lfn entry) // Read the next directory entry until we find a valid directory entry (excluding lfn entry)
// //
Status = FatAccessEntry (OFile, READ_DATA, ODir->CurrentEndPos, &Entry); Status = FatAccessEntry (OFile, ReadData, ODir->CurrentEndPos, &Entry);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -462,7 +462,7 @@ Returns:
// Although FAT spec states this field is always 0 for FAT12 & FAT16, some applications // Although FAT spec states this field is always 0 for FAT12 & FAT16, some applications
// might use it for some special usage, it is safer to zero it in memory for FAT12 & FAT16. // might use it for some special usage, it is safer to zero it in memory for FAT12 & FAT16.
// //
if (OFile->Volume->FatType != FAT32) { if (OFile->Volume->FatType != Fat32) {
Entry.FileClusterHigh = 0; Entry.FileClusterHigh = 0;
} }
@ -857,7 +857,7 @@ Returns:
Entry = &DirEnt->Entry; Entry = &DirEnt->Entry;
DirEnt->Invalid = TRUE; DirEnt->Invalid = TRUE;
do { do {
Status = FatAccessEntry (Root, READ_DATA, EntryPos, Entry); Status = FatAccessEntry (Root, ReadData, EntryPos, Entry);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -1335,7 +1335,7 @@ Returns:
Volume = VOLUME_FROM_ROOT_DIRENT (DirEnt); Volume = VOLUME_FROM_ROOT_DIRENT (DirEnt);
Volume->Root = OFile; Volume->Root = OFile;
OFile->FileCluster = Volume->RootCluster; OFile->FileCluster = Volume->RootCluster;
if (Volume->FatType != FAT32) { if (Volume->FatType != Fat32) {
OFile->IsFixedRootDir = TRUE; OFile->IsFixedRootDir = TRUE;
} }
} }

View File

@ -70,7 +70,7 @@ Returns:
CACHE_TAG *CacheTag; CACHE_TAG *CacheTag;
UINT8 *BaseAddress; UINT8 *BaseAddress;
DiskCache = &Volume->DiskCache[CACHE_DATA]; DiskCache = &Volume->DiskCache[CacheData];
BaseAddress = DiskCache->CacheBase; BaseAddress = DiskCache->CacheBase;
GroupMask = DiskCache->GroupMask; GroupMask = DiskCache->GroupMask;
PageAlignment = DiskCache->PageAlignment; PageAlignment = DiskCache->PageAlignment;
@ -85,7 +85,7 @@ Returns:
// in cache is in this rang, this data in the Buffer need to // in cache is in this rang, this data in the Buffer need to
// be updated with the cache's dirty data. // be updated with the cache's dirty data.
// //
if (IoMode == READ_DISK) { if (IoMode == ReadDisk) {
if (CacheTag->Dirty) { if (CacheTag->Dirty) {
CopyMem ( CopyMem (
Buffer + ((PageNo - StartPageNo) << PageAlignment), Buffer + ((PageNo - StartPageNo) << PageAlignment),
@ -150,7 +150,7 @@ Returns:
PageAddress = DiskCache->CacheBase + (GroupNo << PageAlignment); PageAddress = DiskCache->CacheBase + (GroupNo << PageAlignment);
EntryPos = DiskCache->BaseAddress + LShiftU64 (PageNo, PageAlignment); EntryPos = DiskCache->BaseAddress + LShiftU64 (PageNo, PageAlignment);
RealSize = CacheTag->RealSize; RealSize = CacheTag->RealSize;
if (IoMode == READ_DISK) { if (IoMode == ReadDisk) {
RealSize = (UINTN)1 << PageAlignment; RealSize = (UINTN)1 << PageAlignment;
MaxSize = DiskCache->LimitAddress - EntryPos; MaxSize = DiskCache->LimitAddress - EntryPos;
if (MaxSize < RealSize) { if (MaxSize < RealSize) {
@ -160,7 +160,7 @@ Returns:
} }
WriteCount = 1; WriteCount = 1;
if (DataType == CACHE_FAT && IoMode == WRITE_DISK) { if (DataType == CacheFat && IoMode == WriteDisk) {
WriteCount = Volume->NumFats; WriteCount = Volume->NumFats;
} }
@ -224,7 +224,7 @@ Returns:
// Write dirty cache page back to disk // Write dirty cache page back to disk
// //
if (CacheTag->RealSize > 0 && CacheTag->Dirty) { if (CacheTag->RealSize > 0 && CacheTag->Dirty) {
Status = FatExchangeCachePage (Volume, CacheDataType, WRITE_DISK, CacheTag, NULL); Status = FatExchangeCachePage (Volume, CacheDataType, WriteDisk, CacheTag, NULL);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -233,7 +233,7 @@ Returns:
// Load new data from disk; // Load new data from disk;
// //
CacheTag->PageNo = PageNo; CacheTag->PageNo = PageNo;
Status = FatExchangeCachePage (Volume, CacheDataType, READ_DISK, CacheTag, NULL); Status = FatExchangeCachePage (Volume, CacheDataType, ReadDisk, CacheTag, NULL);
return Status; return Status;
} }
@ -286,7 +286,7 @@ Returns:
if (!EFI_ERROR (Status)) { if (!EFI_ERROR (Status)) {
Source = DiskCache->CacheBase + (GroupNo << DiskCache->PageAlignment) + Offset; Source = DiskCache->CacheBase + (GroupNo << DiskCache->PageAlignment) + Offset;
Destination = Buffer; Destination = Buffer;
if (IoMode != READ_DISK) { if (IoMode != ReadDisk) {
CacheTag->Dirty = TRUE; CacheTag->Dirty = TRUE;
DiskCache->Dirty = TRUE; DiskCache->Dirty = TRUE;
Destination = Source; Destination = Source;
@ -391,7 +391,7 @@ Returns:
// //
// Accessing fat table cannot have alignment data // Accessing fat table cannot have alignment data
// //
ASSERT (CacheDataType == CACHE_DATA); ASSERT (CacheDataType == CacheData);
EntryPos = Volume->RootPos + LShiftU64 (PageNo, PageAlignment); EntryPos = Volume->RootPos + LShiftU64 (PageNo, PageAlignment);
AlignedSize = AlignedPageCount << PageAlignment; AlignedSize = AlignedPageCount << PageAlignment;
@ -450,7 +450,7 @@ Returns:
DISK_CACHE *DiskCache; DISK_CACHE *DiskCache;
CACHE_TAG *CacheTag; CACHE_TAG *CacheTag;
for (CacheDataType = (CACHE_DATA_TYPE) 0; CacheDataType < CACHE_MAX_TYPE; CacheDataType++) { for (CacheDataType = (CACHE_DATA_TYPE) 0; CacheDataType < CacheMaxType; CacheDataType++) {
DiskCache = &Volume->DiskCache[CacheDataType]; DiskCache = &Volume->DiskCache[CacheDataType];
if (DiskCache->Dirty) { if (DiskCache->Dirty) {
// //
@ -463,7 +463,7 @@ Returns:
// //
// Write back all Dirty Data Cache Page to disk // Write back all Dirty Data Cache Page to disk
// //
Status = FatExchangeCachePage (Volume, CacheDataType, WRITE_DISK, CacheTag, Task); Status = FatExchangeCachePage (Volume, CacheDataType, WriteDisk, CacheTag, Task);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -511,24 +511,24 @@ Returns:
// //
// Configure the parameters of disk cache // Configure the parameters of disk cache
// //
if (Volume->FatType == FAT12) { if (Volume->FatType == Fat12) {
FatCacheGroupCount = FAT_FATCACHE_GROUP_MIN_COUNT; FatCacheGroupCount = FAT_FATCACHE_GROUP_MIN_COUNT;
DiskCache[CACHE_FAT].PageAlignment = FAT_FATCACHE_PAGE_MIN_ALIGNMENT; DiskCache[CacheFat].PageAlignment = FAT_FATCACHE_PAGE_MIN_ALIGNMENT;
DiskCache[CACHE_DATA].PageAlignment = FAT_DATACACHE_PAGE_MIN_ALIGNMENT; DiskCache[CacheData].PageAlignment = FAT_DATACACHE_PAGE_MIN_ALIGNMENT;
} else { } else {
FatCacheGroupCount = FAT_FATCACHE_GROUP_MAX_COUNT; FatCacheGroupCount = FAT_FATCACHE_GROUP_MAX_COUNT;
DiskCache[CACHE_FAT].PageAlignment = FAT_FATCACHE_PAGE_MAX_ALIGNMENT; DiskCache[CacheFat].PageAlignment = FAT_FATCACHE_PAGE_MAX_ALIGNMENT;
DiskCache[CACHE_DATA].PageAlignment = FAT_DATACACHE_PAGE_MAX_ALIGNMENT; DiskCache[CacheData].PageAlignment = FAT_DATACACHE_PAGE_MAX_ALIGNMENT;
} }
DiskCache[CACHE_DATA].GroupMask = FAT_DATACACHE_GROUP_COUNT - 1; DiskCache[CacheData].GroupMask = FAT_DATACACHE_GROUP_COUNT - 1;
DiskCache[CACHE_DATA].BaseAddress = Volume->RootPos; DiskCache[CacheData].BaseAddress = Volume->RootPos;
DiskCache[CACHE_DATA].LimitAddress = Volume->VolumeSize; DiskCache[CacheData].LimitAddress = Volume->VolumeSize;
DiskCache[CACHE_FAT].GroupMask = FatCacheGroupCount - 1; DiskCache[CacheFat].GroupMask = FatCacheGroupCount - 1;
DiskCache[CACHE_FAT].BaseAddress = Volume->FatPos; DiskCache[CacheFat].BaseAddress = Volume->FatPos;
DiskCache[CACHE_FAT].LimitAddress = Volume->FatPos + Volume->FatSize; DiskCache[CacheFat].LimitAddress = Volume->FatPos + Volume->FatSize;
FatCacheSize = FatCacheGroupCount << DiskCache[CACHE_FAT].PageAlignment; FatCacheSize = FatCacheGroupCount << DiskCache[CacheFat].PageAlignment;
DataCacheSize = FAT_DATACACHE_GROUP_COUNT << DiskCache[CACHE_DATA].PageAlignment; DataCacheSize = FAT_DATACACHE_GROUP_COUNT << DiskCache[CacheData].PageAlignment;
// //
// Allocate the Fat Cache buffer // Allocate the Fat Cache buffer
// //
@ -538,7 +538,7 @@ Returns:
} }
Volume->CacheBuffer = CacheBuffer; Volume->CacheBuffer = CacheBuffer;
DiskCache[CACHE_FAT].CacheBase = CacheBuffer; DiskCache[CacheFat].CacheBase = CacheBuffer;
DiskCache[CACHE_DATA].CacheBase = CacheBuffer + FatCacheSize; DiskCache[CacheData].CacheBase = CacheBuffer + FatCacheSize;
return EFI_SUCCESS; return EFI_SUCCESS;
} }

View File

@ -128,28 +128,28 @@ typedef CHAR8 LC_ISO_639_2;
// The fat types we support // The fat types we support
// //
typedef enum { typedef enum {
FAT12, Fat12,
FAT16, Fat16,
FAT32, Fat32,
FatUndefined FatUndefined
} FAT_VOLUME_TYPE; } FAT_VOLUME_TYPE;
typedef enum { typedef enum {
CACHE_FAT, CacheFat,
CACHE_DATA, CacheData,
CACHE_MAX_TYPE CacheMaxType
} CACHE_DATA_TYPE; } CACHE_DATA_TYPE;
// //
// Used in FatDiskIo // Used in FatDiskIo
// //
typedef enum { typedef enum {
READ_DISK = 0, // raw disk read ReadDisk = 0, // raw disk read
WRITE_DISK = 1, // raw disk write WriteDisk = 1, // raw disk write
READ_FAT = 2, // read fat cache ReadFat = 2, // read fat cache
WRITE_FAT = 3, // write fat cache WriteFat = 3, // write fat cache
READ_DATA = 6, // read data cache ReadData = 6, // read data cache
WRITE_DATA = 7 // write data cache WriteData = 7 // write data cache
} IO_MODE; } IO_MODE;
#define CACHE_ENABLED(a) ((a) >= 2) #define CACHE_ENABLED(a) ((a) >= 2)
@ -384,7 +384,7 @@ typedef struct _FAT_VOLUME {
// Disk Cache for this volume // Disk Cache for this volume
// //
VOID *CacheBuffer; VOID *CacheBuffer;
DISK_CACHE DiskCache[CACHE_MAX_TYPE]; DISK_CACHE DiskCache[CacheMaxType];
} FAT_VOLUME; } FAT_VOLUME;
// //
@ -1100,7 +1100,7 @@ FatResetODirCursor (
EFI_STATUS EFI_STATUS
FatGetNextDirEnt ( FatGetNextDirEnt (
IN FAT_OFILE *OFILE, IN FAT_OFILE *OFile,
OUT FAT_DIRENT **PtrDirEnt OUT FAT_DIRENT **PtrDirEnt
); );

View File

@ -59,11 +59,11 @@ Returns:
// Compute buffer position needed // Compute buffer position needed
// //
switch (Volume->FatType) { switch (Volume->FatType) {
case FAT12: case Fat12:
Pos = FAT_POS_FAT12 (Index); Pos = FAT_POS_FAT12 (Index);
break; break;
case FAT16: case Fat16:
Pos = FAT_POS_FAT16 (Index); Pos = FAT_POS_FAT16 (Index);
break; break;
@ -76,7 +76,7 @@ Returns:
Volume->FatEntryPos = Volume->FatPos + Pos; Volume->FatEntryPos = Volume->FatPos + Pos;
Status = FatDiskIo ( Status = FatDiskIo (
Volume, Volume,
READ_FAT, ReadFat,
Volume->FatEntryPos, Volume->FatEntryPos,
Volume->FatEntrySize, Volume->FatEntrySize,
&Volume->FatEntryBuffer, &Volume->FatEntryBuffer,
@ -113,9 +113,9 @@ Returns:
--*/ --*/
{ {
VOID *Pos; VOID *Pos;
UINT8 *E12; UINT8 *En12;
UINT16 *E16; UINT16 *En16;
UINT32 *E32; UINT32 *En32;
UINTN Accum; UINTN Accum;
Pos = FatLoadFatEntry (Volume, Index); Pos = FatLoadFatEntry (Volume, Index);
@ -125,22 +125,22 @@ Returns:
} }
switch (Volume->FatType) { switch (Volume->FatType) {
case FAT12: case Fat12:
E12 = Pos; En12 = Pos;
Accum = E12[0] | (E12[1] << 8); Accum = En12[0] | (En12[1] << 8);
Accum = FAT_ODD_CLUSTER_FAT12 (Index) ? (Accum >> 4) : (Accum & FAT_CLUSTER_MASK_FAT12); Accum = FAT_ODD_CLUSTER_FAT12 (Index) ? (Accum >> 4) : (Accum & FAT_CLUSTER_MASK_FAT12);
Accum = Accum | ((Accum >= FAT_CLUSTER_SPECIAL_FAT12) ? FAT_CLUSTER_SPECIAL_EXT : 0); Accum = Accum | ((Accum >= FAT_CLUSTER_SPECIAL_FAT12) ? FAT_CLUSTER_SPECIAL_EXT : 0);
break; break;
case FAT16: case Fat16:
E16 = Pos; En16 = Pos;
Accum = *E16; Accum = *En16;
Accum = Accum | ((Accum >= FAT_CLUSTER_SPECIAL_FAT16) ? FAT_CLUSTER_SPECIAL_EXT : 0); Accum = Accum | ((Accum >= FAT_CLUSTER_SPECIAL_FAT16) ? FAT_CLUSTER_SPECIAL_EXT : 0);
break; break;
default: default:
E32 = Pos; En32 = Pos;
Accum = *E32 & FAT_CLUSTER_MASK_FAT32; Accum = *En32 & FAT_CLUSTER_MASK_FAT32;
Accum = Accum | ((Accum >= FAT_CLUSTER_SPECIAL_FAT32) ? FAT_CLUSTER_SPECIAL_EXT : 0); Accum = Accum | ((Accum >= FAT_CLUSTER_SPECIAL_FAT32) ? FAT_CLUSTER_SPECIAL_EXT : 0);
} }
@ -175,9 +175,9 @@ Returns:
--*/ --*/
{ {
VOID *Pos; VOID *Pos;
UINT8 *E12; UINT8 *En12;
UINT16 *E16; UINT16 *En16;
UINT32 *E32; UINT32 *En32;
UINTN Accum; UINTN Accum;
EFI_STATUS Status; EFI_STATUS Status;
UINTN OriginalVal; UINTN OriginalVal;
@ -206,9 +206,9 @@ Returns:
// Update the value // Update the value
// //
switch (Volume->FatType) { switch (Volume->FatType) {
case FAT12: case Fat12:
E12 = Pos; En12 = Pos;
Accum = E12[0] | (E12[1] << 8); Accum = En12[0] | (En12[1] << 8);
Value = Value & FAT_CLUSTER_MASK_FAT12; Value = Value & FAT_CLUSTER_MASK_FAT12;
if (FAT_ODD_CLUSTER_FAT12 (Index)) { if (FAT_ODD_CLUSTER_FAT12 (Index)) {
@ -217,25 +217,25 @@ Returns:
Accum = Value | (Accum & FAT_CLUSTER_UNMASK_FAT12); Accum = Value | (Accum & FAT_CLUSTER_UNMASK_FAT12);
} }
E12[0] = (UINT8) (Accum & 0xFF); En12[0] = (UINT8) (Accum & 0xFF);
E12[1] = (UINT8) (Accum >> 8); En12[1] = (UINT8) (Accum >> 8);
break; break;
case FAT16: case Fat16:
E16 = Pos; En16 = Pos;
*E16 = (UINT16) Value; *En16 = (UINT16) Value;
break; break;
default: default:
E32 = Pos; En32 = Pos;
*E32 = (*E32 & FAT_CLUSTER_UNMASK_FAT32) | (UINT32) (Value & FAT_CLUSTER_MASK_FAT32); *En32 = (*En32 & FAT_CLUSTER_UNMASK_FAT32) | (UINT32) (Value & FAT_CLUSTER_MASK_FAT32);
} }
// //
// If the volume's dirty bit is not set, set it now // If the volume's dirty bit is not set, set it now
// //
if (!Volume->FatDirty && Volume->FatType != FAT12) { if (!Volume->FatDirty && Volume->FatType != Fat12) {
Volume->FatDirty = TRUE; Volume->FatDirty = TRUE;
FatAccessVolumeDirty (Volume, WRITE_FAT, &Volume->DirtyValue); FatAccessVolumeDirty (Volume, WriteFat, &Volume->DirtyValue);
} }
// //
// Write the updated fat entry value to the volume // Write the updated fat entry value to the volume
@ -244,7 +244,7 @@ Returns:
// //
Status = FatDiskIo ( Status = FatDiskIo (
Volume, Volume,
WRITE_FAT, WriteFat,
Volume->FatEntryPos, Volume->FatEntryPos,
Volume->FatEntrySize, Volume->FatEntrySize,
&Volume->FatEntryBuffer, &Volume->FatEntryBuffer,

View File

@ -462,7 +462,7 @@ Returns:
// indicates this a FAT32 volume // indicates this a FAT32 volume
// //
if (Volume->FreeInfoValid && Volume->FatDirty && Volume->FreeInfoPos) { if (Volume->FreeInfoValid && Volume->FatDirty && Volume->FreeInfoPos) {
Status = FatDiskIo (Volume, WRITE_DISK, Volume->FreeInfoPos, sizeof (FAT_INFO_SECTOR), &Volume->FatInfoSector, Task); Status = FatDiskIo (Volume, WriteDisk, Volume->FreeInfoPos, sizeof (FAT_INFO_SECTOR), &Volume->FatInfoSector, Task);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -470,9 +470,9 @@ Returns:
// //
// Update that the volume is not dirty // Update that the volume is not dirty
// //
if (Volume->FatDirty && Volume->FatType != FAT12) { if (Volume->FatDirty && Volume->FatType != Fat12) {
Volume->FatDirty = FALSE; Volume->FatDirty = FALSE;
Status = FatAccessVolumeDirty (Volume, WRITE_FAT, &Volume->NotDirtyValue); Status = FatAccessVolumeDirty (Volume, WriteFat, &Volume->NotDirtyValue);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }

View File

@ -265,7 +265,7 @@ Returns:
SectorsPerFat = FatBs.FatBsb.SectorsPerFat; SectorsPerFat = FatBs.FatBsb.SectorsPerFat;
if (SectorsPerFat == 0) { if (SectorsPerFat == 0) {
SectorsPerFat = FatBs.FatBse.Fat32Bse.LargeSectorsPerFat; SectorsPerFat = FatBs.FatBse.Fat32Bse.LargeSectorsPerFat;
FatType = FAT32; FatType = Fat32;
} }
// //
// Is boot sector a fat sector? // Is boot sector a fat sector?
@ -305,7 +305,7 @@ Returns:
// //
// Initialize fields the volume information for this FatType // Initialize fields the volume information for this FatType
// //
if (FatType != FAT32) { if (FatType != Fat32) {
if (FatBs.FatBsb.RootEntries == 0) { if (FatBs.FatBsb.RootEntries == 0) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
@ -350,12 +350,12 @@ Returns:
// //
// If this is not a fat32, determine if it's a fat16 or fat12 // If this is not a fat32, determine if it's a fat16 or fat12
// //
if (FatType != FAT32) { if (FatType != Fat32) {
if (Volume->MaxCluster >= FAT_MAX_FAT16_CLUSTER) { if (Volume->MaxCluster >= FAT_MAX_FAT16_CLUSTER) {
return EFI_VOLUME_CORRUPTED; return EFI_VOLUME_CORRUPTED;
} }
FatType = Volume->MaxCluster < FAT_MAX_FAT12_CLUSTER ? FAT12 : FAT16; FatType = Volume->MaxCluster < FAT_MAX_FAT12_CLUSTER ? Fat12 : Fat16;
// //
// fat12 & fat16 fat-entries are 2 bytes // fat12 & fat16 fat-entries are 2 bytes
// //
@ -376,8 +376,8 @@ Returns:
// We should keep the initial value as the NotDirtyValue // We should keep the initial value as the NotDirtyValue
// in case the volume is dirty already // in case the volume is dirty already
// //
if (FatType != FAT12) { if (FatType != Fat12) {
Status = FatAccessVolumeDirty (Volume, READ_DISK, &Volume->NotDirtyValue); Status = FatAccessVolumeDirty (Volume, ReadDisk, &Volume->NotDirtyValue);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
@ -387,10 +387,10 @@ Returns:
// //
// If present, read the fat hint info // If present, read the fat hint info
// //
if (FatType == FAT32) { if (FatType == Fat32) {
Volume->FreeInfoPos = FatBs.FatBse.Fat32Bse.FsInfoSector * BlockSize; Volume->FreeInfoPos = FatBs.FatBse.Fat32Bse.FsInfoSector * BlockSize;
if (FatBs.FatBse.Fat32Bse.FsInfoSector != 0) { if (FatBs.FatBse.Fat32Bse.FsInfoSector != 0) {
FatDiskIo (Volume, READ_DISK, Volume->FreeInfoPos, sizeof (FAT_INFO_SECTOR), &Volume->FatInfoSector, NULL); FatDiskIo (Volume, ReadDisk, Volume->FreeInfoPos, sizeof (FAT_INFO_SECTOR), &Volume->FatInfoSector, NULL);
if (Volume->FatInfoSector.Signature == FAT_INFO_SIGNATURE && if (Volume->FatInfoSector.Signature == FAT_INFO_SIGNATURE &&
Volume->FatInfoSector.InfoBeginSignature == FAT_INFO_BEGIN_SIGNATURE && Volume->FatInfoSector.InfoBeginSignature == FAT_INFO_BEGIN_SIGNATURE &&
Volume->FatInfoSector.InfoEndSignature == FAT_INFO_END_SIGNATURE && Volume->FatInfoSector.InfoEndSignature == FAT_INFO_END_SIGNATURE &&

View File

@ -397,7 +397,7 @@ Returns:
// Blocking access // Blocking access
// //
DiskIo = Volume->DiskIo; DiskIo = Volume->DiskIo;
IoFunction = (IoMode == READ_DISK) ? DiskIo->ReadDisk : DiskIo->WriteDisk; IoFunction = (IoMode == ReadDisk) ? DiskIo->ReadDisk : DiskIo->WriteDisk;
Status = IoFunction (DiskIo, Volume->MediaId, Offset, BufferSize, Buffer); Status = IoFunction (DiskIo, Volume->MediaId, Offset, BufferSize, Buffer);
} else { } else {
// //
@ -409,7 +409,7 @@ Returns:
} else { } else {
Subtask->Signature = FAT_SUBTASK_SIGNATURE; Subtask->Signature = FAT_SUBTASK_SIGNATURE;
Subtask->Task = Task; Subtask->Task = Task;
Subtask->Write = (BOOLEAN) (IoMode == WRITE_DISK); Subtask->Write = (BOOLEAN) (IoMode == WriteDisk);
Subtask->Offset = Offset; Subtask->Offset = Offset;
Subtask->Buffer = Buffer; Subtask->Buffer = Buffer;
Subtask->BufferSize = BufferSize; Subtask->BufferSize = BufferSize;

View File

@ -253,7 +253,7 @@ Returns:
// //
// Write to a directory is unsupported // Write to a directory is unsupported
// //
if ((OFile->ODir != NULL) && (IoMode == WRITE_DATA)) { if ((OFile->ODir != NULL) && (IoMode == WriteData)) {
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
@ -261,7 +261,7 @@ Returns:
return EFI_DEVICE_ERROR; return EFI_DEVICE_ERROR;
} }
if (IoMode == READ_DATA) { if (IoMode == ReadData) {
// //
// If position is at EOF, then return device error // If position is at EOF, then return device error
// //
@ -305,7 +305,7 @@ Returns:
// //
// Read a directory is supported // Read a directory is supported
// //
ASSERT (IoMode == READ_DATA); ASSERT (IoMode == ReadData);
Status = FatIFileReadDir (IFile, BufferSize, Buffer); Status = FatIFileReadDir (IFile, BufferSize, Buffer);
OFile = NULL; OFile = NULL;
} else { } else {
@ -317,7 +317,7 @@ Returns:
// //
// The position goes beyond the end of file // The position goes beyond the end of file
// //
if (IoMode == READ_DATA) { if (IoMode == ReadData) {
// //
// Adjust the actual size read // Adjust the actual size read
// //
@ -401,7 +401,7 @@ Returns:
--*/ --*/
{ {
return FatIFileAccess (FHand, READ_DATA, BufferSize, Buffer, NULL); return FatIFileAccess (FHand, ReadData, BufferSize, Buffer, NULL);
} }
EFI_STATUS EFI_STATUS
@ -430,7 +430,7 @@ Returns:
--*/ --*/
{ {
return FatIFileAccess (FHand, READ_DATA, &Token->BufferSize, Token->Buffer, Token); return FatIFileAccess (FHand, ReadData, &Token->BufferSize, Token->Buffer, Token);
} }
EFI_STATUS EFI_STATUS
@ -464,7 +464,7 @@ Returns:
--*/ --*/
{ {
return FatIFileAccess (FHand, WRITE_DATA, BufferSize, Buffer, NULL); return FatIFileAccess (FHand, WriteData, BufferSize, Buffer, NULL);
} }
EFI_STATUS EFI_STATUS
@ -493,7 +493,7 @@ Returns:
--*/ --*/
{ {
return FatIFileAccess (FHand, WRITE_DATA, &Token->BufferSize, Token->Buffer, Token); return FatIFileAccess (FHand, WriteData, &Token->BufferSize, Token->Buffer, Token);
} }
EFI_STATUS EFI_STATUS
@ -563,7 +563,7 @@ Returns:
Position += Len; Position += Len;
UserBuffer += Len; UserBuffer += Len;
BufferSize -= Len; BufferSize -= Len;
if (IoMode == WRITE_DATA) { if (IoMode == WriteData) {
OFile->Dirty = TRUE; OFile->Dirty = TRUE;
OFile->Archive = TRUE; OFile->Archive = TRUE;
} }
@ -664,7 +664,7 @@ Returns:
do { do {
WriteSize = AppendedSize > BufferSize ? BufferSize : (UINTN) AppendedSize; WriteSize = AppendedSize > BufferSize ? BufferSize : (UINTN) AppendedSize;
AppendedSize -= WriteSize; AppendedSize -= WriteSize;
Status = FatAccessOFile (OFile, WRITE_DATA, WritePos, &WriteSize, ZeroBuffer, NULL); Status = FatAccessOFile (OFile, WriteData, WritePos, &WriteSize, ZeroBuffer, NULL);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
break; break;
} }