public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Dandan Bi <dandan.bi@intel.com>
To: edk2-devel@lists.01.org
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Subject: [patch 4/8] FatPkg\EnhancedFatDxe: Make the variable name follow rule
Date: Thu,  8 Dec 2016 18:54:23 +0800	[thread overview]
Message-ID: <1481194467-75920-5-git-send-email-dandan.bi@intel.com> (raw)
In-Reply-To: <1481194467-75920-1-git-send-email-dandan.bi@intel.com>

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
---
 FatPkg/EnhancedFatDxe/DirectoryManage.c | 16 ++++-----
 FatPkg/EnhancedFatDxe/DiskCache.c       | 50 +++++++++++++--------------
 FatPkg/EnhancedFatDxe/Fat.h             | 28 +++++++--------
 FatPkg/EnhancedFatDxe/FileSpace.c       | 60 ++++++++++++++++-----------------
 FatPkg/EnhancedFatDxe/Flush.c           |  6 ++--
 FatPkg/EnhancedFatDxe/Init.c            | 16 ++++-----
 FatPkg/EnhancedFatDxe/Misc.c            |  4 +--
 FatPkg/EnhancedFatDxe/ReadWrite.c       | 20 +++++------
 8 files changed, 100 insertions(+), 100 deletions(-)

diff --git a/FatPkg/EnhancedFatDxe/DirectoryManage.c b/FatPkg/EnhancedFatDxe/DirectoryManage.c
index 3328ae3..149119d 100644
--- a/FatPkg/EnhancedFatDxe/DirectoryManage.c
+++ b/FatPkg/EnhancedFatDxe/DirectoryManage.c
@@ -58,11 +58,11 @@ Returns:
   Position = EntryPos * sizeof (FAT_DIRECTORY_ENTRY);
   if (Position >= Parent->FileSize) {
     //
     // 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;
   }
 
@@ -104,11 +104,11 @@ Returns:
   EntryPos   = DirEnt->EntryPos;
   EntryCount = DirEnt->EntryCount;
   //
   // Write directory entry
   //
-  Status = FatAccessEntry (OFile, WRITE_DATA, EntryPos, &DirEnt->Entry);
+  Status = FatAccessEntry (OFile, WriteData, EntryPos, &DirEnt->Entry);
   if (EFI_ERROR (Status)) {
     return Status;
   }
 
   if (--EntryCount > 0) {
@@ -145,11 +145,11 @@ Returns:
       EntryPos--;
       if (DirEnt->Invalid) {
         LfnEntry.Ordinal = DELETE_ENTRY_MARK;
       }
 
-      Status = FatAccessEntry (OFile, WRITE_DATA, EntryPos, &LfnEntry);
+      Status = FatAccessEntry (OFile, WriteData, EntryPos, &LfnEntry);
       if (EFI_ERROR (Status)) {
         return Status;
       }
     }
   }
@@ -320,11 +320,11 @@ Returns:
       LfnBufferPointer = LfnBuffer;
       break;
     }
 
     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 ||
         LfnEntry.Checksum != LfnChecksum ||
         (LfnEntry.Ordinal & (~FAT_LFN_LAST)) != LfnOrdinal ||
@@ -440,11 +440,11 @@ Returns:
 
   for (;;) {
     //
     // 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;
     }
 
     if (((UINT8) Entry.FileName[0] != DELETE_ENTRY_MARK) && (Entry.Attributes & FAT_ATTRIBUTE_VOLUME_ID) == 0) {
@@ -460,11 +460,11 @@ Returns:
   if (Entry.FileName[0] != EMPTY_ENTRY_MARK) {
     //
     // 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;
     }
 
     //
     // This is a valid directory entry
@@ -855,11 +855,11 @@ Returns:
 
   EntryPos        = 0;
   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;
     }
 
     if (((UINT8) Entry->FileName[0] != DELETE_ENTRY_MARK) && (((Entry->Attributes) & (~FAT_ATTRIBUTE_ARCHIVE)) == FAT_ATTRIBUTE_VOLUME_ID)) {
@@ -1333,11 +1333,11 @@ Returns:
       // The newly created OFile is root
       //
       Volume                = VOLUME_FROM_ROOT_DIRENT (DirEnt);
       Volume->Root          = OFile;
       OFile->FileCluster    = Volume->RootCluster;
-      if (Volume->FatType  != FAT32) {
+      if (Volume->FatType  != Fat32) {
         OFile->IsFixedRootDir  = TRUE;
       }
     }
 
     OFile->FileCurrentCluster  = OFile->FileCluster;
diff --git a/FatPkg/EnhancedFatDxe/DiskCache.c b/FatPkg/EnhancedFatDxe/DiskCache.c
index ddf99ed..7f1fcf4 100644
--- a/FatPkg/EnhancedFatDxe/DiskCache.c
+++ b/FatPkg/EnhancedFatDxe/DiskCache.c
@@ -68,11 +68,11 @@ Returns:
   UINT8       PageAlignment;
   DISK_CACHE  *DiskCache;
   CACHE_TAG   *CacheTag;
   UINT8       *BaseAddress;
 
-  DiskCache     = &Volume->DiskCache[CACHE_DATA];
+  DiskCache     = &Volume->DiskCache[CacheData];
   BaseAddress   = DiskCache->CacheBase;
   GroupMask     = DiskCache->GroupMask;
   PageAlignment = DiskCache->PageAlignment;
   PageSize      = (UINTN)1 << PageAlignment;
 
@@ -83,11 +83,11 @@ Returns:
       //
       // When reading data form disk directly, if some dirty data
       // 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),
             BaseAddress + (GroupNo << PageAlignment),
             PageSize
@@ -148,21 +148,21 @@ Returns:
   GroupNo       = PageNo & DiskCache->GroupMask;
   PageAlignment = DiskCache->PageAlignment;
   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) {
       DEBUG ((EFI_D_INFO, "FatDiskIo: Cache Page OutBound occurred! \n"));
       RealSize = (UINTN) MaxSize;
     }
   }
 
   WriteCount = 1;
-  if (DataType == CACHE_FAT && IoMode == WRITE_DISK) {
+  if (DataType == CacheFat && IoMode == WriteDisk) {
     WriteCount = Volume->NumFats;
   }
 
   do {
     //
@@ -222,20 +222,20 @@ 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;
     }
   }
   //
   // 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;
 }
 
 STATIC
@@ -284,11 +284,11 @@ Returns:
   CacheTag  = &DiskCache->CacheTag[GroupNo];
   Status    = FatGetCachePage (Volume, CacheDataType, PageNo, CacheTag);
   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;
       Source            = Buffer;
     }
@@ -389,11 +389,11 @@ Returns:
   //
   if (AlignedPageCount > 0) {
     //
     // Accessing fat table cannot have alignment data
     //
-    ASSERT (CacheDataType == CACHE_DATA);
+    ASSERT (CacheDataType == CacheData);
 
     EntryPos    = Volume->RootPos + LShiftU64 (PageNo, PageAlignment);
     AlignedSize = AlignedPageCount << PageAlignment;
     Status      = FatDiskIo (Volume, IoMode, EntryPos, AlignedSize, Buffer, Task);
     if (EFI_ERROR (Status)) {
@@ -448,11 +448,11 @@ Returns:
   UINTN           GroupIndex;
   UINTN           GroupMask;
   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) {
       //
       // Data cache or fat cache is dirty, write the dirty data back
       //
@@ -461,11 +461,11 @@ Returns:
         CacheTag = &DiskCache->CacheTag[GroupIndex];
         if (CacheTag->RealSize > 0 && CacheTag->Dirty) {
           //
           // 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;
           }
         }
       }
@@ -509,36 +509,36 @@ Returns:
 
   DiskCache = Volume->DiskCache;
   //
   // 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
   //
   CacheBuffer = AllocateZeroPool (FatCacheSize + DataCacheSize);
   if (CacheBuffer == NULL) {
     return EFI_OUT_OF_RESOURCES;
   }
 
   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;
 }
diff --git a/FatPkg/EnhancedFatDxe/Fat.h b/FatPkg/EnhancedFatDxe/Fat.h
index b73135c..42aa647 100644
--- a/FatPkg/EnhancedFatDxe/Fat.h
+++ b/FatPkg/EnhancedFatDxe/Fat.h
@@ -126,32 +126,32 @@ 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)
 #define RAW_ACCESS(a)     ((IO_MODE)((a) & 0x1))
 #define CACHE_TYPE(a)     ((CACHE_DATA_TYPE)((a) >> 2))
@@ -382,11 +382,11 @@ typedef struct _FAT_VOLUME {
 
   //
   // Disk Cache for this volume
   //
   VOID                            *CacheBuffer;
-  DISK_CACHE                      DiskCache[CACHE_MAX_TYPE];
+  DISK_CACHE                      DiskCache[CacheMaxType];
 } FAT_VOLUME;
 
 //
 // Function Prototypes
 //
@@ -1098,11 +1098,11 @@ FatResetODirCursor (
   IN FAT_OFILE          *OFile
   );
 
 EFI_STATUS
 FatGetNextDirEnt (
-  IN  FAT_OFILE         *OFILE,
+  IN  FAT_OFILE         *OFile,
   OUT FAT_DIRENT        **PtrDirEnt
   );
 
 EFI_STATUS
 FatRemoveDirEnt (
diff --git a/FatPkg/EnhancedFatDxe/FileSpace.c b/FatPkg/EnhancedFatDxe/FileSpace.c
index ce7c067..db44a33 100644
--- a/FatPkg/EnhancedFatDxe/FileSpace.c
+++ b/FatPkg/EnhancedFatDxe/FileSpace.c
@@ -57,15 +57,15 @@ 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;
 
   default:
     Pos = FAT_POS_FAT32 (Index);
@@ -74,11 +74,11 @@ Returns:
   // Set the position and read the buffer
   //
   Volume->FatEntryPos = Volume->FatPos + Pos;
   Status = FatDiskIo (
              Volume,
-             READ_FAT,
+             ReadFat,
              Volume->FatEntryPos,
              Volume->FatEntrySize,
              &Volume->FatEntryBuffer,
              NULL
              );
@@ -111,38 +111,38 @@ Returns:
   The value of the FAT entry.
 
 --*/
 {
   VOID    *Pos;
-  UINT8   *E12;
-  UINT16  *E16;
-  UINT32  *E32;
+  UINT8   *En12;
+  UINT16  *En16;
+  UINT32  *En32;
   UINTN   Accum;
 
   Pos = FatLoadFatEntry (Volume, Index);
 
   if (Index > (Volume->MaxCluster + 1)) {
     return (UINTN) -1;
   }
 
   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);
   }
 
   return Accum;
 }
@@ -173,13 +173,13 @@ Returns:
   other                 - An error occurred when operation the FAT entries.
 
 --*/
 {
   VOID        *Pos;
-  UINT8       *E12;
-  UINT16      *E16;
-  UINT32      *E32;
+  UINT8       *En12;
+  UINT16      *En16;
+  UINT32      *En32;
   UINTN       Accum;
   EFI_STATUS  Status;
   UINTN       OriginalVal;
 
   if (Index < FAT_MIN_CLUSTER) {
@@ -204,49 +204,49 @@ 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)) {
       Accum = (Value << 4) | (Accum & 0xF);
     } else {
       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
   // The fat is the first fat, and other fat will be in sync
   // when the FAT cache flush back.
   //
   Status = FatDiskIo (
              Volume,
-             WRITE_FAT,
+             WriteFat,
              Volume->FatEntryPos,
              Volume->FatEntrySize,
              &Volume->FatEntryBuffer,
              NULL
              );
diff --git a/FatPkg/EnhancedFatDxe/Flush.c b/FatPkg/EnhancedFatDxe/Flush.c
index 2c960f3..172f202 100644
--- a/FatPkg/EnhancedFatDxe/Flush.c
+++ b/FatPkg/EnhancedFatDxe/Flush.c
@@ -460,21 +460,21 @@ Returns:
     //
     // Update the free hint info. Volume->FreeInfoPos != 0
     // 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;
       }
     }
     //
     // 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;
       }
     }
     //
diff --git a/FatPkg/EnhancedFatDxe/Init.c b/FatPkg/EnhancedFatDxe/Init.c
index 34a7250..d7cfa82 100644
--- a/FatPkg/EnhancedFatDxe/Init.c
+++ b/FatPkg/EnhancedFatDxe/Init.c
@@ -263,11 +263,11 @@ Returns:
   }
 
   SectorsPerFat = FatBs.FatBsb.SectorsPerFat;
   if (SectorsPerFat == 0) {
     SectorsPerFat = FatBs.FatBse.Fat32Bse.LargeSectorsPerFat;
-    FatType       = FAT32;
+    FatType       = Fat32;
   }
   //
   // Is boot sector a fat sector?
   // (Note that so far we only know if the sector is FAT32 or not, we don't
   // know if the sector is Fat16 or Fat12 until later when we can compute
@@ -303,11 +303,11 @@ Returns:
     return EFI_UNSUPPORTED;
   }
   //
   // Initialize fields the volume information for this FatType
   //
-  if (FatType != FAT32) {
+  if (FatType != Fat32) {
     if (FatBs.FatBsb.RootEntries == 0) {
       return EFI_UNSUPPORTED;
     }
     //
     // Unpack fat12, fat16 info
@@ -348,16 +348,16 @@ Returns:
   Volume->ClusterSize       = (UINTN)1 << (Volume->ClusterAlignment);
 
   //
   // 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
     //
     Volume->FatEntrySize = sizeof (UINT16);
     DirtyMask            = FAT16_DIRTY_MASK;
@@ -374,25 +374,25 @@ Returns:
   //
   // Get the DirtyValue and NotDirtyValue
   // 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;
     }
 
     Volume->DirtyValue = Volume->NotDirtyValue & DirtyMask;
   }
   //
   // 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 &&
           Volume->FatInfoSector.FreeInfo.ClusterCount <= Volume->MaxCluster
           ) {
diff --git a/FatPkg/EnhancedFatDxe/Misc.c b/FatPkg/EnhancedFatDxe/Misc.c
index 6ad688c..48c99f9 100644
--- a/FatPkg/EnhancedFatDxe/Misc.c
+++ b/FatPkg/EnhancedFatDxe/Misc.c
@@ -394,11 +394,11 @@ Returns:
       if (Task == NULL) {
         //
         // 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 {
         //
         // Non-blocking access
         //
@@ -406,11 +406,11 @@ Returns:
         if (Subtask == NULL) {
           Status        = EFI_OUT_OF_RESOURCES;
         } 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;
           Status = gBS->CreateEvent (
                           EVT_NOTIFY_SIGNAL,
diff --git a/FatPkg/EnhancedFatDxe/ReadWrite.c b/FatPkg/EnhancedFatDxe/ReadWrite.c
index 9afb6bf..81676cd 100644
--- a/FatPkg/EnhancedFatDxe/ReadWrite.c
+++ b/FatPkg/EnhancedFatDxe/ReadWrite.c
@@ -251,19 +251,19 @@ Returns:
   Task   = NULL;
 
   //
   // Write to a directory is unsupported
   //
-  if ((OFile->ODir != NULL) && (IoMode == WRITE_DATA)) {
+  if ((OFile->ODir != NULL) && (IoMode == WriteData)) {
     return EFI_UNSUPPORTED;
   }
 
   if (OFile->Error == EFI_NOT_FOUND) {
     return EFI_DEVICE_ERROR;
   }
 
-  if (IoMode == READ_DATA) {
+  if (IoMode == ReadData) {
     //
     // If position is at EOF, then return device error
     //
     if (IFile->Position > OFile->FileSize) {
       return EFI_DEVICE_ERROR;
@@ -303,11 +303,11 @@ Returns:
   if (!EFI_ERROR (Status)) {
     if (OFile->ODir != NULL) {
       //
       // Read a directory is supported
       //
-      ASSERT (IoMode == READ_DATA);
+      ASSERT (IoMode == ReadData);
       Status = FatIFileReadDir (IFile, BufferSize, Buffer);
       OFile = NULL;
     } else {
       //
       // Access a file
@@ -315,11 +315,11 @@ Returns:
       EndPosition = IFile->Position + *BufferSize;
       if (EndPosition > OFile->FileSize) {
         //
         // The position goes beyond the end of file
         //
-        if (IoMode == READ_DATA) {
+        if (IoMode == ReadData) {
           //
           // Adjust the actual size read
           //
           *BufferSize -= (UINTN) EndPosition - OFile->FileSize;
         } else {
@@ -399,11 +399,11 @@ Returns:
   EFI_VOLUME_CORRUPTED  - The file type of open file is error.
   other                 - An error occurred when operation the disk.
 
 --*/
 {
-  return FatIFileAccess (FHand, READ_DATA, BufferSize, Buffer, NULL);
+  return FatIFileAccess (FHand, ReadData, BufferSize, Buffer, NULL);
 }
 
 EFI_STATUS
 EFIAPI
 FatReadEx (
@@ -428,11 +428,11 @@ Returns:
   EFI_VOLUME_CORRUPTED  - The file type of open file is error.
   other                 - An error occurred when operation the disk.
 
 --*/
 {
-  return FatIFileAccess (FHand, READ_DATA, &Token->BufferSize, Token->Buffer, Token);
+  return FatIFileAccess (FHand, ReadData, &Token->BufferSize, Token->Buffer, Token);
 }
 
 EFI_STATUS
 EFIAPI
 FatWrite (
@@ -462,11 +462,11 @@ Returns:
                         - The writing file size is larger than 4GB.
   other                 - An error occurred when operation the disk.
 
 --*/
 {
-  return FatIFileAccess (FHand, WRITE_DATA, BufferSize, Buffer, NULL);
+  return FatIFileAccess (FHand, WriteData, BufferSize, Buffer, NULL);
 }
 
 EFI_STATUS
 EFIAPI
 FatWriteEx (
@@ -491,11 +491,11 @@ Returns:
   EFI_VOLUME_CORRUPTED  - The file type of open file is error.
   other                 - An error occurred when operation the disk.
 
 --*/
 {
-  return FatIFileAccess (FHand, WRITE_DATA, &Token->BufferSize, Token->Buffer, Token);
+  return FatIFileAccess (FHand, WriteData, &Token->BufferSize, Token->Buffer, Token);
 }
 
 EFI_STATUS
 FatAccessOFile (
   IN     FAT_OFILE      *OFile,
@@ -561,11 +561,11 @@ Returns:
     // Data was successfully accessed
     //
     Position   += Len;
     UserBuffer += Len;
     BufferSize -= Len;
-    if (IoMode == WRITE_DATA) {
+    if (IoMode == WriteData) {
       OFile->Dirty    = TRUE;
       OFile->Archive  = TRUE;
     }
     //
     // Make sure no outbound occurred
@@ -662,11 +662,11 @@ 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;
     }
 
     WritePos += WriteSize;
-- 
1.9.5.msysgit.1



  parent reply	other threads:[~2016-12-08 10:54 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-12-08 10:54 [patch 0/8] FatPkg: Fix coding style issues Dandan Bi
2016-12-08 10:54 ` [patch 1/8] FatPkg\EnhancedFatDxe: Avoid Non-Boolean type uses as Boolean Dandan Bi
2016-12-09  1:14   ` Ni, Ruiyu
2016-12-08 10:54 ` [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration Dandan Bi
2016-12-08 17:27   ` Kurt Kennett
2016-12-08 23:11     ` Andrew Fish
2016-12-20 23:26       ` Brian J. Johnson
2016-12-08 23:47     ` Yao, Jiewen
2016-12-09  0:26       ` Kurt Kennett
2016-12-09  0:36         ` Andrew Fish
2016-12-09  0:40           ` Yao, Jiewen
2016-12-09 16:32             ` Kurt Kennett
2016-12-09  0:40           ` Kurt Kennett
2016-12-09  0:57   ` Ni, Ruiyu
2016-12-09  1:18     ` Bi, Dandan
2016-12-08 10:54 ` [patch 3/8] FatPkg\EnhancedFatDxe: Make function prototype align with definition Dandan Bi
2016-12-09  1:13   ` Ni, Ruiyu
2016-12-08 10:54 ` Dandan Bi [this message]
2016-12-09  1:12   ` [patch 4/8] FatPkg\EnhancedFatDxe: Make the variable name follow rule Ni, Ruiyu
2016-12-08 10:54 ` [patch 5/8] FatPkg\EnhancedFatDxe: Use typedef for complex type Dandan Bi
2016-12-09  1:11   ` Ni, Ruiyu
2016-12-08 10:54 ` [patch 6/8] FatPkg\EnhancedFatDxe: Make the comments align with EDKII coding style Dandan Bi
2016-12-09  1:10   ` Ni, Ruiyu
2016-12-08 10:54 ` [patch 7/8] FatPkg\EnhancedFatDxe: Add comments for functions Dandan Bi
2016-12-09  1:10   ` Ni, Ruiyu
2016-12-08 10:54 ` [patch 8/8] FatPkg: Fix format issues in dec/inf/dsc files Dandan Bi
2016-12-09  1:09   ` Ni, Ruiyu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1481194467-75920-5-git-send-email-dandan.bi@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox