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
//
ASSERT (IoMode == READ_DATA);
ASSERT (IoMode == ReadData);
((FAT_DIRECTORY_ENTRY *) Entry)->FileName[0] = EMPTY_ENTRY_MARK;
((FAT_DIRECTORY_ENTRY *) Entry)->Attributes = 0;
return EFI_SUCCESS;
@ -106,7 +106,7 @@ Returns:
//
// Write directory entry
//
Status = FatAccessEntry (OFile, WRITE_DATA, EntryPos, &DirEnt->Entry);
Status = FatAccessEntry (OFile, WriteData, EntryPos, &DirEnt->Entry);
if (EFI_ERROR (Status)) {
return Status;
}
@ -147,7 +147,7 @@ Returns:
LfnEntry.Ordinal = DELETE_ENTRY_MARK;
}
Status = FatAccessEntry (OFile, WRITE_DATA, EntryPos, &LfnEntry);
Status = FatAccessEntry (OFile, WriteData, EntryPos, &LfnEntry);
if (EFI_ERROR (Status)) {
return Status;
}
@ -322,7 +322,7 @@ Returns:
}
EntryPos--;
Status = FatAccessEntry (Parent, READ_DATA, EntryPos, &LfnEntry);
Status = FatAccessEntry (Parent, ReadData, EntryPos, &LfnEntry);
if (EFI_ERROR (Status) ||
LfnEntry.Attributes != FAT_ATTRIBUTE_LFN ||
LfnEntry.MustBeZero != 0 ||
@ -442,7 +442,7 @@ Returns:
//
// 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)) {
return Status;
}
@ -462,7 +462,7 @@ Returns:
// 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.
//
if (OFile->Volume->FatType != FAT32) {
if (OFile->Volume->FatType != Fat32) {
Entry.FileClusterHigh = 0;
}
@ -857,7 +857,7 @@ Returns:
Entry = &DirEnt->Entry;
DirEnt->Invalid = TRUE;
do {
Status = FatAccessEntry (Root, READ_DATA, EntryPos, Entry);
Status = FatAccessEntry (Root, ReadData, EntryPos, Entry);
if (EFI_ERROR (Status)) {
return Status;
}
@ -1335,7 +1335,7 @@ Returns:
Volume = VOLUME_FROM_ROOT_DIRENT (DirEnt);
Volume->Root = OFile;
OFile->FileCluster = Volume->RootCluster;
if (Volume->FatType != FAT32) {
if (Volume->FatType != Fat32) {
OFile->IsFixedRootDir = TRUE;
}
}

View File

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

View File

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

View File

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

View File

@ -462,7 +462,7 @@ Returns:
// indicates this a FAT32 volume
//
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)) {
return Status;
}
@ -470,9 +470,9 @@ Returns:
//
// Update that the volume is not dirty
//
if (Volume->FatDirty && Volume->FatType != FAT12) {
if (Volume->FatDirty && Volume->FatType != Fat12) {
Volume->FatDirty = FALSE;
Status = FatAccessVolumeDirty (Volume, WRITE_FAT, &Volume->NotDirtyValue);
Status = FatAccessVolumeDirty (Volume, WriteFat, &Volume->NotDirtyValue);
if (EFI_ERROR (Status)) {
return Status;
}

View File

@ -265,7 +265,7 @@ Returns:
SectorsPerFat = FatBs.FatBsb.SectorsPerFat;
if (SectorsPerFat == 0) {
SectorsPerFat = FatBs.FatBse.Fat32Bse.LargeSectorsPerFat;
FatType = FAT32;
FatType = Fat32;
}
//
// Is boot sector a fat sector?
@ -305,7 +305,7 @@ Returns:
//
// Initialize fields the volume information for this FatType
//
if (FatType != FAT32) {
if (FatType != Fat32) {
if (FatBs.FatBsb.RootEntries == 0) {
return EFI_UNSUPPORTED;
}
@ -350,12 +350,12 @@ Returns:
//
// 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) {
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
//
@ -376,8 +376,8 @@ Returns:
// We should keep the initial value as the NotDirtyValue
// in case the volume is dirty already
//
if (FatType != FAT12) {
Status = FatAccessVolumeDirty (Volume, READ_DISK, &Volume->NotDirtyValue);
if (FatType != Fat12) {
Status = FatAccessVolumeDirty (Volume, ReadDisk, &Volume->NotDirtyValue);
if (EFI_ERROR (Status)) {
return Status;
}
@ -387,10 +387,10 @@ Returns:
//
// If present, read the fat hint info
//
if (FatType == FAT32) {
if (FatType == Fat32) {
Volume->FreeInfoPos = FatBs.FatBse.Fat32Bse.FsInfoSector * BlockSize;
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 &&
Volume->FatInfoSector.InfoBeginSignature == FAT_INFO_BEGIN_SIGNATURE &&
Volume->FatInfoSector.InfoEndSignature == FAT_INFO_END_SIGNATURE &&

View File

@ -397,7 +397,7 @@ Returns:
// Blocking access
//
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);
} else {
//
@ -409,7 +409,7 @@ Returns:
} else {
Subtask->Signature = FAT_SUBTASK_SIGNATURE;
Subtask->Task = Task;
Subtask->Write = (BOOLEAN) (IoMode == WRITE_DISK);
Subtask->Write = (BOOLEAN) (IoMode == WriteDisk);
Subtask->Offset = Offset;
Subtask->Buffer = Buffer;
Subtask->BufferSize = BufferSize;

View File

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