public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [patch 0/8] FatPkg: Fix coding style issues
@ 2016-12-08 10:54 Dandan Bi
  2016-12-08 10:54 ` [patch 1/8] FatPkg\EnhancedFatDxe: Avoid Non-Boolean type uses as Boolean Dandan Bi
                   ` (7 more replies)
  0 siblings, 8 replies; 27+ messages in thread
From: Dandan Bi @ 2016-12-08 10:54 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ruiyu Ni

The patch series make the coding style of FatPkg align with EDKII rules.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>

Dandan Bi (8):
  FatPkg\EnhancedFatDxe: Avoid Non-Boolean type uses as Boolean
  FatPkg\EnhancedFatDxe: Initialize variable after declaration
  FatPkg\EnhancedFatDxe: Make function prototype align with definition
  FatPkg\EnhancedFatDxe: Make the variable name follow rule
  FatPkg\EnhancedFatDxe: Use typedef for complex type
  FatPkg\EnhancedFatDxe: Make the comments align with EDKII coding style
  FatPkg\EnhancedFatDxe: Add comments for functions
  FatPkg: Fix format issues in dec/inf/dsc files

 FatPkg/EnhancedFatDxe/ComponentName.c    |   10 +-
 FatPkg/EnhancedFatDxe/Data.c             |   16 +-
 FatPkg/EnhancedFatDxe/Debug.c            |   34 +-
 FatPkg/EnhancedFatDxe/Delete.c           |   35 +-
 FatPkg/EnhancedFatDxe/DirectoryCache.c   |  120 +--
 FatPkg/EnhancedFatDxe/DirectoryManage.c  |  742 +++++++-----------
 FatPkg/EnhancedFatDxe/DiskCache.c        |  307 +++-----
 FatPkg/EnhancedFatDxe/Fat.c              |  227 +++---
 FatPkg/EnhancedFatDxe/Fat.h              | 1262 +++++++++++++++++++++++-------
 FatPkg/EnhancedFatDxe/Fat.inf            |    2 +-
 FatPkg/EnhancedFatDxe/FatFileSystem.h    |   25 +-
 FatPkg/EnhancedFatDxe/FileName.c         |  276 +++----
 FatPkg/EnhancedFatDxe/FileSpace.c        |  394 ++++------
 FatPkg/EnhancedFatDxe/Flush.c            |  252 +++---
 FatPkg/EnhancedFatDxe/Hash.c             |  158 ++--
 FatPkg/EnhancedFatDxe/Info.c             |  358 ++++-----
 FatPkg/EnhancedFatDxe/Init.c             |  111 +--
 FatPkg/EnhancedFatDxe/Misc.c             |  420 ++++------
 FatPkg/EnhancedFatDxe/Open.c             |  172 ++--
 FatPkg/EnhancedFatDxe/OpenVolume.c       |   40 +-
 FatPkg/EnhancedFatDxe/ReadWrite.c        |  404 ++++------
 FatPkg/EnhancedFatDxe/UnicodeCollation.c |    6 +-
 FatPkg/FatPei/FatPei.inf                 |    6 +-
 FatPkg/FatPkg.dec                        |    1 -
 FatPkg/FatPkg.dsc                        |    3 +-
 25 files changed, 2612 insertions(+), 2769 deletions(-)

-- 
1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 27+ messages in thread

* [patch 1/8] FatPkg\EnhancedFatDxe: Avoid Non-Boolean type uses as Boolean
  2016-12-08 10:54 [patch 0/8] FatPkg: Fix coding style issues Dandan Bi
@ 2016-12-08 10:54 ` 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
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 27+ messages in thread
From: Dandan Bi @ 2016-12-08 10:54 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ruiyu Ni

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/FileName.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/FatPkg/EnhancedFatDxe/FileName.c b/FatPkg/EnhancedFatDxe/FileName.c
index 5df4036..f393aa6 100644
--- a/FatPkg/EnhancedFatDxe/FileName.c
+++ b/FatPkg/EnhancedFatDxe/FileName.c
@@ -57,11 +57,11 @@ Returns:
   UINTN   ExtendNameLen;
 
   PossibleShortName = TRUE;
   SeparateDot       = NULL;
   SetMem (File8Dot3Name, FAT_NAME_LEN, ' ');
-  for (TempName = FileName; *TempName; TempName++) {
+  for (TempName = FileName; *TempName != '\0'; TempName++) {
     if (*TempName == L'.') {
       SeparateDot = TempName;
     }
   }
 
@@ -451,11 +451,11 @@ Returns:
 {
   UINTN ShortNameLen;
   UINT8 Sum;
   Sum = 0;
   for (ShortNameLen = FAT_NAME_LEN; ShortNameLen != 0; ShortNameLen--) {
-    Sum = (UINT8)(((Sum & 1) ? 0x80 : 0) + (Sum >> 1) + *ShortNameString++);
+    Sum = (UINT8)((((Sum & 1) != 0) ? 0x80 : 0) + (Sum >> 1) + *ShortNameString++);
   }
 
   return Sum;
 }
 
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration
  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-08 10:54 ` Dandan Bi
  2016-12-08 17:27   ` Kurt Kennett
  2016-12-09  0:57   ` Ni, Ruiyu
  2016-12-08 10:54 ` [patch 3/8] FatPkg\EnhancedFatDxe: Make function prototype align with definition Dandan Bi
                   ` (5 subsequent siblings)
  7 siblings, 2 replies; 27+ messages in thread
From: Dandan Bi @ 2016-12-08 10:54 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ruiyu Ni

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/Misc.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/FatPkg/EnhancedFatDxe/Misc.c b/FatPkg/EnhancedFatDxe/Misc.c
index f91759c..6ad688c 100644
--- a/FatPkg/EnhancedFatDxe/Misc.c
+++ b/FatPkg/EnhancedFatDxe/Misc.c
@@ -696,15 +696,27 @@ Returns:
   TRUE                  - The time is valid.
   FALSE                 - The time is not valid.
 
 --*/
 {
-  static UINT8  MonthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+  STATIC UINT8  MonthDays[12];
   UINTN         Day;
   BOOLEAN       ValidTime;
 
   ValidTime = TRUE;
+  MonthDays[0] = 31;
+  MonthDays[1] = 28;
+  MonthDays[2] = 31;
+  MonthDays[3] = 30;
+  MonthDays[4] = 31;
+  MonthDays[5] = 30;
+  MonthDays[6] = 31;
+  MonthDays[7] = 31;
+  MonthDays[8] = 30;
+  MonthDays[9] = 31;
+  MonthDays[10] = 30;
+  MonthDays[11] = 31;
 
   //
   // Check the fields for range problems
   // Fat can only support from 1980
   //
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [patch 3/8] FatPkg\EnhancedFatDxe: Make function prototype align with definition
  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-08 10:54 ` [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration Dandan Bi
@ 2016-12-08 10:54 ` Dandan Bi
  2016-12-09  1:13   ` Ni, Ruiyu
  2016-12-08 10:54 ` [patch 4/8] FatPkg\EnhancedFatDxe: Make the variable name follow rule Dandan Bi
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 27+ messages in thread
From: Dandan Bi @ 2016-12-08 10:54 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ruiyu Ni

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/Info.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/FatPkg/EnhancedFatDxe/Info.c b/FatPkg/EnhancedFatDxe/Info.c
index 858b3f4..aa1b0f2 100644
--- a/FatPkg/EnhancedFatDxe/Info.c
+++ b/FatPkg/EnhancedFatDxe/Info.c
@@ -32,12 +32,12 @@ FatGetVolumeInfo (
   );
 
 EFI_STATUS
 FatSetVolumeInfo (
   IN FAT_VOLUME       *Volume,
-  IN OUT UINTN        BufferSize,
-  OUT VOID            *Buffer
+  IN UINTN            BufferSize,
+  IN VOID            *Buffer
   );
 
 EFI_STATUS
 FatSetOrGetInfo (
   IN BOOLEAN              IsSet,
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [patch 4/8] FatPkg\EnhancedFatDxe: Make the variable name follow rule
  2016-12-08 10:54 [patch 0/8] FatPkg: Fix coding style issues Dandan Bi
                   ` (2 preceding siblings ...)
  2016-12-08 10:54 ` [patch 3/8] FatPkg\EnhancedFatDxe: Make function prototype align with definition Dandan Bi
@ 2016-12-08 10:54 ` Dandan Bi
  2016-12-09  1:12   ` Ni, Ruiyu
  2016-12-08 10:54 ` [patch 5/8] FatPkg\EnhancedFatDxe: Use typedef for complex type Dandan Bi
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 27+ messages in thread
From: Dandan Bi @ 2016-12-08 10:54 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ruiyu Ni

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



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [patch 5/8] FatPkg\EnhancedFatDxe: Use typedef for complex type
  2016-12-08 10:54 [patch 0/8] FatPkg: Fix coding style issues Dandan Bi
                   ` (3 preceding siblings ...)
  2016-12-08 10:54 ` [patch 4/8] FatPkg\EnhancedFatDxe: Make the variable name follow rule Dandan Bi
@ 2016-12-08 10:54 ` 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
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 27+ messages in thread
From: Dandan Bi @ 2016-12-08 10:54 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ruiyu Ni

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/Fat.h           | 36 ++++++++++++++++++++---------------
 FatPkg/EnhancedFatDxe/FatFileSystem.h | 10 ++++++----
 2 files changed, 27 insertions(+), 19 deletions(-)

diff --git a/FatPkg/EnhancedFatDxe/Fat.h b/FatPkg/EnhancedFatDxe/Fat.h
index 42aa647..f49acee 100644
--- a/FatPkg/EnhancedFatDxe/Fat.h
+++ b/FatPkg/EnhancedFatDxe/Fat.h
@@ -182,42 +182,48 @@ typedef struct {
 #define HASH_TABLE_MASK  (HASH_TABLE_SIZE - 1)
 
 //
 // The directory entry for opened directory
 //
-typedef struct _FAT_DIRENT {
+
+typedef struct _FAT_DIRENT FAT_DIRENT;
+typedef struct _FAT_ODIR FAT_ODIR;
+typedef struct _FAT_OFILE FAT_OFILE;
+typedef struct _FAT_VOLUME FAT_VOLUME;
+
+struct _FAT_DIRENT {
   UINTN               Signature;
   UINT16              EntryPos;               // The position of this directory entry in the parent directory file
   UINT8               EntryCount;             // The count of the directory entry in the parent directory file
   BOOLEAN             Invalid;                // Indicate whether this directory entry is valid
   CHAR16              *FileString;            // The unicode long file name for this directory entry
-  struct _FAT_OFILE   *OFile;                 // The OFile of the corresponding directory entry
-  struct _FAT_DIRENT  *ShortNameForwardLink;  // Hash successor link for short filename
-  struct _FAT_DIRENT  *LongNameForwardLink;   // Hash successor link for long filename
+  FAT_OFILE           *OFile;                 // The OFile of the corresponding directory entry
+  FAT_DIRENT          *ShortNameForwardLink;  // Hash successor link for short filename
+  FAT_DIRENT          *LongNameForwardLink;   // Hash successor link for long filename
   LIST_ENTRY          Link;                   // Connection of every directory entry
   FAT_DIRECTORY_ENTRY Entry;                  // The physical directory entry stored in disk
-} FAT_DIRENT;
+};
 
-typedef struct _FAT_ODIR {
+struct _FAT_ODIR {
   UINTN               Signature;
   UINT32              CurrentEndPos;          // Current end position of the directory
   UINT32              CurrentPos;             // Current position of the directory
   LIST_ENTRY          *CurrentCursor;         // Current directory entry pointer
   LIST_ENTRY          ChildList;              // List of all directory entries
   BOOLEAN             EndOfDir;               // Indicate whether we have reached the end of the directory
   LIST_ENTRY          DirCacheLink;           // Linked in Volume->DirCacheList when discarded
   UINTN               DirCacheTag;            // The identification of the directory when in directory cache
   FAT_DIRENT          *LongNameHashTable[HASH_TABLE_SIZE];
   FAT_DIRENT          *ShortNameHashTable[HASH_TABLE_SIZE];
-} FAT_ODIR;
+};
 
 typedef struct {
   UINTN               Signature;
   EFI_FILE_PROTOCOL   Handle;
   UINT64              Position;
   BOOLEAN             ReadOnly;
-  struct _FAT_OFILE   *OFile;
+  FAT_OFILE          *OFile;
   LIST_ENTRY          Tasks;                  // List of all FAT_TASKs
   LIST_ENTRY          Link;                   // Link to other IFiles
 } FAT_IFILE;
 
 typedef struct {
@@ -240,13 +246,13 @@ typedef struct {
 } FAT_SUBTASK;
 
 //
 // FAT_OFILE - Each opened file
 //
-typedef struct _FAT_OFILE {
+struct _FAT_OFILE {
   UINTN               Signature;
-  struct _FAT_VOLUME  *Volume;
+  FAT_VOLUME          *Volume;
   //
   // A permanant error code to return to all accesses to
   // this opened file
   //
   EFI_STATUS          Error;
@@ -282,11 +288,11 @@ typedef struct _FAT_OFILE {
   UINT64              PosDisk;  // on the disk
   UINTN               PosRem;   // remaining in this disk run
   //
   // The opened parent, full path length and currently opened child files
   //
-  struct _FAT_OFILE   *Parent;
+  FAT_OFILE           *Parent;
   UINTN               FullPathLen;
   LIST_ENTRY          ChildHead;
   LIST_ENTRY          ChildLink;
 
   //
@@ -301,13 +307,13 @@ typedef struct _FAT_OFILE {
 
   //
   // Link in Volume's reference list
   //
   LIST_ENTRY          CheckLink;
-} FAT_OFILE;
+};
 
-typedef struct _FAT_VOLUME {
+struct _FAT_VOLUME {
   UINTN                           Signature;
 
   EFI_HANDLE                      Handle;
   BOOLEAN                         Valid;
   BOOLEAN                         DiskError;
@@ -364,11 +370,11 @@ typedef struct _FAT_VOLUME {
   FAT_DIRENT                      RootDirEnt;
   //
   // File Name of root OFile, it is empty string
   //
   CHAR16                          RootFileString[1];
-  struct _FAT_OFILE               *Root;
+  FAT_OFILE                       *Root;
 
   //
   // New OFiles are added to this list so they
   // can be cleaned up if they aren't referenced.
   //
@@ -383,11 +389,11 @@ typedef struct _FAT_VOLUME {
   //
   // Disk Cache for this volume
   //
   VOID                            *CacheBuffer;
   DISK_CACHE                      DiskCache[CacheMaxType];
-} FAT_VOLUME;
+};
 
 //
 // Function Prototypes
 //
 EFI_STATUS
diff --git a/FatPkg/EnhancedFatDxe/FatFileSystem.h b/FatPkg/EnhancedFatDxe/FatFileSystem.h
index bcef258..3f89a34 100644
--- a/FatPkg/EnhancedFatDxe/FatFileSystem.h
+++ b/FatPkg/EnhancedFatDxe/FatFileSystem.h
@@ -144,16 +144,18 @@ typedef struct {
   CHAR8   Id[4];
   CHAR8   FatLabel[11];
   CHAR8   SystemId[8];
 } FAT32_BOOT_SECTOR_EXT;
 
-typedef struct {
-  FAT_BOOT_SECTOR_BASIC   FatBsb;
-  union {
+typedef union {
     FAT_BOOT_SECTOR_EXT   FatBse;
     FAT32_BOOT_SECTOR_EXT Fat32Bse;
-  } FatBse;
+  } FAT_BSE;
+
+typedef struct {
+  FAT_BOOT_SECTOR_BASIC   FatBsb;
+  FAT_BSE  FatBse;
 } FAT_BOOT_SECTOR;
 
 //
 // FAT Info Structure
 //
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [patch 6/8] FatPkg\EnhancedFatDxe: Make the comments align with EDKII coding style
  2016-12-08 10:54 [patch 0/8] FatPkg: Fix coding style issues Dandan Bi
                   ` (4 preceding siblings ...)
  2016-12-08 10:54 ` [patch 5/8] FatPkg\EnhancedFatDxe: Use typedef for complex type Dandan Bi
@ 2016-12-08 10:54 ` 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-08 10:54 ` [patch 8/8] FatPkg: Fix format issues in dec/inf/dsc files Dandan Bi
  7 siblings, 1 reply; 27+ messages in thread
From: Dandan Bi @ 2016-12-08 10:54 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ruiyu Ni

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/ComponentName.c    |  10 +-
 FatPkg/EnhancedFatDxe/Data.c             |  16 +-
 FatPkg/EnhancedFatDxe/Debug.c            |  34 +-
 FatPkg/EnhancedFatDxe/Delete.c           |  35 +-
 FatPkg/EnhancedFatDxe/DirectoryCache.c   | 120 ++---
 FatPkg/EnhancedFatDxe/DirectoryManage.c  | 726 ++++++++++++-------------------
 FatPkg/EnhancedFatDxe/DiskCache.c        | 257 +++++------
 FatPkg/EnhancedFatDxe/Fat.c              | 169 +++----
 FatPkg/EnhancedFatDxe/Fat.h              | 394 +++++++----------
 FatPkg/EnhancedFatDxe/FatFileSystem.h    |  15 +-
 FatPkg/EnhancedFatDxe/FileName.c         | 272 +++++-------
 FatPkg/EnhancedFatDxe/FileSpace.c        | 334 ++++++--------
 FatPkg/EnhancedFatDxe/Flush.c            | 246 ++++-------
 FatPkg/EnhancedFatDxe/Hash.c             | 158 +++----
 FatPkg/EnhancedFatDxe/Info.c             | 320 ++++++--------
 FatPkg/EnhancedFatDxe/Init.c             |  95 ++--
 FatPkg/EnhancedFatDxe/Misc.c             | 402 ++++++-----------
 FatPkg/EnhancedFatDxe/Open.c             | 172 +++-----
 FatPkg/EnhancedFatDxe/OpenVolume.c       |  40 +-
 FatPkg/EnhancedFatDxe/ReadWrite.c        | 392 +++++++----------
 FatPkg/EnhancedFatDxe/UnicodeCollation.c |   6 +-
 21 files changed, 1565 insertions(+), 2648 deletions(-)

diff --git a/FatPkg/EnhancedFatDxe/ComponentName.c b/FatPkg/EnhancedFatDxe/ComponentName.c
index af3f9e6..ce1c975 100644
--- a/FatPkg/EnhancedFatDxe/ComponentName.c
+++ b/FatPkg/EnhancedFatDxe/ComponentName.c
@@ -1,6 +1,6 @@
-/*++
+/** @file
 
 Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
@@ -8,17 +8,11 @@ http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 
-Module Name:
-
-  ComponentName.c
-
-Abstract:
-
---*/
+**/
 
 #include "Fat.h"
 
 //
 // EFI Component Name Functions
diff --git a/FatPkg/EnhancedFatDxe/Data.c b/FatPkg/EnhancedFatDxe/Data.c
index b20cc45..56a265e 100644
--- a/FatPkg/EnhancedFatDxe/Data.c
+++ b/FatPkg/EnhancedFatDxe/Data.c
@@ -1,28 +1,18 @@
-/*++
+/** @file
+  Global data in the FAT Filesystem driver.
 
 Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
-
-Module Name:
-
-  Data.c
-
-Abstract:
-
-  Global data in the FAT Filesystem driver
-
-Revision History
-
---*/
+**/
 
 #include "Fat.h"
 
 //
 // Globals
diff --git a/FatPkg/EnhancedFatDxe/Debug.c b/FatPkg/EnhancedFatDxe/Debug.c
index 7c0dc20..ad23786 100644
--- a/FatPkg/EnhancedFatDxe/Debug.c
+++ b/FatPkg/EnhancedFatDxe/Debug.c
@@ -1,50 +1,32 @@
-/*++
+/** @file
+  Debug functions for fat driver
 
 Copyright (c) 2005, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
+**/
 
-Module Name:
-
-  debug.c
-
-Abstract:
-
-  Debug functions for fat driver
+#include "Fat.h"
 
-Revision History
+/**
 
---*/
+  Dump all the FAT Entry of the FAT table in the volume.
 
-#include "Fat.h"
+  @param  Volume - The volume whose FAT info will be dumped
 
+**/
 VOID
 FatDumpFatTable (
   IN FAT_VOLUME   *Volume
   )
-/*++
-
-Routine Description:
-
-  Dump all the FAT Entry of the FAT table in the volume
-
-Arguments:
-
-  Volume - The volume whose FAT info will be dumped
-
-Returns:
-
-  None
-
---*/
 {
   UINTN   EntryValue;
   UINTN   MaxIndex;
   UINTN   Index;
   CHAR16  *Pointer;
diff --git a/FatPkg/EnhancedFatDxe/Delete.c b/FatPkg/EnhancedFatDxe/Delete.c
index e5103a8..9837565 100644
--- a/FatPkg/EnhancedFatDxe/Delete.c
+++ b/FatPkg/EnhancedFatDxe/Delete.c
@@ -1,6 +1,7 @@
-/*++
+/** @file
+  Function that deletes a file.
 
 Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
@@ -8,45 +9,29 @@ http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 
-Module Name:
+**/
 
-  delete.c
-
-Abstract:
+#include "Fat.h"
 
-  Function that deletes a file
+/**
 
-Revision History
+  Deletes the file & Closes the file handle.
 
---*/
+  @param  FHand                    - Handle to the file to delete.
 
-#include "Fat.h"
+  @retval EFI_SUCCESS              - Delete the file successfully.
+  @retval EFI_WARN_DELETE_FAILURE  - Fail to delete the file.
 
+**/
 EFI_STATUS
 EFIAPI
 FatDelete (
   IN EFI_FILE_PROTOCOL  *FHand
   )
-/*++
-
-Routine Description:
-
-  Deletes the file & Closes the file handle.
-
-Arguments:
-
-  FHand                    - Handle to the file to delete.
-
-Returns:
-
-  EFI_SUCCESS              - Delete the file successfully.
-  EFI_WARN_DELETE_FAILURE  - Fail to delete the file.
-
---*/
 {
   FAT_IFILE   *IFile;
   FAT_OFILE   *OFile;
   FAT_DIRENT  *DirEnt;
   EFI_STATUS  Status;
diff --git a/FatPkg/EnhancedFatDxe/DirectoryCache.c b/FatPkg/EnhancedFatDxe/DirectoryCache.c
index 568b291..30de86a 100644
--- a/FatPkg/EnhancedFatDxe/DirectoryCache.c
+++ b/FatPkg/EnhancedFatDxe/DirectoryCache.c
@@ -1,6 +1,7 @@
-/*++
+/** @file
+  Functions for directory cache operation.
 
 Copyright (c) 2005, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
@@ -8,44 +9,26 @@ http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 
-Module Name:
+**/
 
-  DirectoryCache.c
-
-Abstract:
-
-  Functions for directory cache operation
+#include "Fat.h"
 
-Revision History
+/**
 
---*/
+  Free the directory structure and release the memory.
 
-#include "Fat.h"
+  @param  ODir                  - The directory to be freed.
 
+**/
 STATIC
 VOID
 FatFreeODir (
   IN FAT_ODIR    *ODir
   )
-/*++
-
-Routine Description:
-
-  Free the directory structure and release the memory.
-
-Arguments:
-
-  ODir                  - The directory to be freed.
-
-Returns:
-
-  None.
-
---*/
 {
   FAT_DIRENT  *DirEnt;
 
   //
   // Release Directory Entry Nodes
@@ -61,30 +44,22 @@ Returns:
   }
 
   FreePool (ODir);
 }
 
+/**
+
+  Allocate the directory structure.
+
+  @param  OFile                   - The corresponding OFile.
+
+**/
 STATIC
 FAT_ODIR *
 FatAllocateODir (
   IN FAT_OFILE   *OFile
   )
-/*++
-
-Routine Description:
-
-  Allocate the directory structure.
-
-Arguments:
-
-  OFile                   - The corresponding OFile.
-
-Returns:
-
-  None.
-
---*/
 {
   FAT_ODIR  *ODir;
 
   ODir = AllocateZeroPool (sizeof (FAT_ODIR));
   if (ODir != NULL) {
@@ -97,30 +72,22 @@ Returns:
   }
 
   return ODir;
 }
 
-VOID
-FatDiscardODir (
-  IN FAT_OFILE    *OFile
-  )
-/*++
-
-Routine Description:
+/**
 
   Discard the directory structure when an OFile will be freed.
   Volume will cache this directory if the OFile does not represent a deleted file.
 
-Arguments:
+  @param  OFile                 - The OFile whose directory structure is to be discarded.
 
-  OFile                 - The OFile whose directory structure is to be discarded.
-
-Returns:
-
-  None.
-
---*/
+**/
+VOID
+FatDiscardODir (
+  IN FAT_OFILE    *OFile
+  )
 {
   FAT_ODIR    *ODir;
   FAT_VOLUME  *Volume;
 
   Volume  = OFile->Volume;
@@ -152,31 +119,24 @@ Returns:
   if (ODir != NULL) {
     FatFreeODir (ODir);
   }
 }
 
-VOID
-FatRequestODir (
-  IN FAT_OFILE    *OFile
-  )
-/*++
+/**
 
-Routine Description:
 
   Request the directory structure when an OFile is newly generated.
   If the directory structure is cached by volume, then just return this directory;
   Otherwise, allocate a new one for OFile.
 
-Arguments:
-
-  OFile                 - The OFile which requests directory structure.
+  @param  OFile                 - The OFile which requests directory structure.
 
-Returns:
-
-  None.
-
---*/
+**/
+VOID
+FatRequestODir (
+  IN FAT_OFILE    *OFile
+  )
 {
   UINTN           DirCacheTag;
   FAT_VOLUME      *Volume;
   FAT_ODIR        *ODir;
   FAT_ODIR        *CurrentODir;
@@ -206,29 +166,21 @@ Returns:
   }
 
   OFile->ODir = ODir;
 }
 
-VOID
-FatCleanupODirCache (
-  IN FAT_VOLUME         *Volume
-  )
-/*++
-
-Routine Description:
+/**
 
   Clean up all the cached directory structures when the volume is going to be abandoned.
 
-Arguments:
+  @param  Volume                - FAT file system volume.
 
-  Volume                - FAT file system volume.
-
-Returns:
-
-  None.
-
---*/
+**/
+VOID
+FatCleanupODirCache (
+  IN FAT_VOLUME         *Volume
+  )
 {
   FAT_ODIR  *ODir;
   while (Volume->DirCacheCount > 0) {
     ODir = ODIR_FROM_DIRCACHELINK (Volume->DirCacheList.BackLink);
     RemoveEntryList (&ODir->DirCacheLink);
diff --git a/FatPkg/EnhancedFatDxe/DirectoryManage.c b/FatPkg/EnhancedFatDxe/DirectoryManage.c
index 149119d..fe6fcc9 100644
--- a/FatPkg/EnhancedFatDxe/DirectoryManage.c
+++ b/FatPkg/EnhancedFatDxe/DirectoryManage.c
@@ -1,58 +1,42 @@
-/*++
+/** @file
+  Functions for performing directory entry io.
 
 Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
+**/
 
-Module Name:
-
-  DirectoryManage.c
-
-Abstract:
+#include "Fat.h"
 
-  Functions for performing directory entry io
+/**
 
-Revision History
+  Get a directory entry from disk for the Ofile.
 
---*/
+  @param  Parent                - The parent of the OFile which need to update.
+  @param  IoMode                - Indicate whether to read directory entry or write directroy entry.
+  @param  EntryPos              - The position of the directory entry to be accessed.
+  @param  Entry                 - The directory entry read or written.
 
-#include "Fat.h"
+  @retval EFI_SUCCESS           - Access the directory entry sucessfully.
+  @return other                 - An error occurred when reading the directory entry.
 
+**/
 STATIC
 EFI_STATUS
 FatAccessEntry (
   IN     FAT_OFILE            *Parent,
   IN     IO_MODE              IoMode,
   IN     UINTN                EntryPos,
   IN OUT VOID                 *Entry
   )
-/*++
-
-Routine Description:
-
-  Get a directory entry from disk for the Ofile.
-
-Arguments:
-
-  Parent                - The parent of the OFile which need to update.
-  IoMode                - Indicate whether to read directory entry or write directroy entry.
-  EntryPos              - The position of the directory entry to be accessed.
-  Entry                 - The directory entry read or written.
-
-Returns:
-
-  EFI_SUCCESS           - Access the directory entry sucessfully.
-  other                 - An error occurred when reading the directory entry.
-
---*/
 {
   UINTN Position;
   UINTN BufferSize;
 
   Position = EntryPos * sizeof (FAT_DIRECTORY_ENTRY);
@@ -68,32 +52,26 @@ Returns:
 
   BufferSize = sizeof (FAT_DIRECTORY_ENTRY);
   return FatAccessOFile (Parent, IoMode, Position, &BufferSize, Entry, NULL);
 }
 
-EFI_STATUS
-FatStoreDirEnt (
-  IN FAT_OFILE            *OFile,
-  IN FAT_DIRENT           *DirEnt
-  )
-/*++
-
-Routine Description:
+/**
 
   Save the directory entry to disk.
 
-Arguments:
-
-  OFile                 - The parent OFile which needs to update.
-  DirEnt                - The directory entry to be saved.
-
-Returns:
+  @param  OFile                 - The parent OFile which needs to update.
+  @param  DirEnt                - The directory entry to be saved.
 
-  EFI_SUCCESS           - Store the directory entry successfully.
-  other                 - An error occurred when writing the directory entry.
+  @retval EFI_SUCCESS           - Store the directory entry successfully.
+  @return other                 - An error occurred when writing the directory entry.
 
---*/
+**/
+EFI_STATUS
+FatStoreDirEnt (
+  IN FAT_OFILE            *OFile,
+  IN FAT_DIRENT           *DirEnt
+  )
 {
   EFI_STATUS        Status;
   FAT_DIRECTORY_LFN LfnEntry;
   UINTN             EntryPos;
   CHAR16            *LfnBufferPointer;
@@ -155,116 +133,86 @@ Returns:
   }
 
   return EFI_SUCCESS;
 }
 
-BOOLEAN
-FatIsDotDirEnt (
-  IN FAT_DIRENT  *DirEnt
-  )
-/*++
-
-Routine Description:
+/**
 
   Determine whether the directory entry is "." or ".." entry.
 
-Arguments:
+  @param  DirEnt               - The corresponding directory entry.
 
-  DirEnt               - The corresponding directory entry.
+  @retval TRUE                 - The directory entry is "." or ".." directory entry
+  @retval FALSE                - The directory entry is not "." or ".." directory entry
 
-Returns:
-
-  TRUE                 - The directory entry is "." or ".." directory entry
-  FALSE                - The directory entry is not "." or ".." directory entry
-
---*/
+**/
+BOOLEAN
+FatIsDotDirEnt (
+  IN FAT_DIRENT  *DirEnt
+  )
 {
   CHAR16  *FileString;
   FileString = DirEnt->FileString;
   if (StrCmp (FileString, L".") == 0 || StrCmp (FileString, L"..") == 0) {
     return TRUE;
   }
 
   return FALSE;
 }
 
+/**
+
+  Set the OFile's cluster info in its directory entry.
+
+  @param  OFile                 - The corresponding OFile.
+
+**/
 STATIC
 VOID
 FatSetDirEntCluster (
   IN FAT_OFILE    *OFile
   )
-/*++
-
-Routine Description:
-
-  Set the OFile's cluster info in its directory entry.
-
-Arguments:
-
-  OFile                 - The corresponding OFile.
-
-Returns:
-
-  None.
-
---*/
 {
   UINTN       Cluster;
   FAT_DIRENT  *DirEnt;
 
   DirEnt                        = OFile->DirEnt;
   Cluster                       = OFile->FileCluster;
   DirEnt->Entry.FileClusterHigh = (UINT16) (Cluster >> 16);
   DirEnt->Entry.FileCluster     = (UINT16) Cluster;
 }
 
-VOID
-FatUpdateDirEntClusterSizeInfo (
-  IN FAT_OFILE    *OFile
-  )
-/*++
-
-Routine Description:
+/**
 
   Set the OFile's cluster and size info in its directory entry.
 
-Arguments:
-
-  OFile                 - The corresponding OFile.
-
-Returns:
-
-  None.
+  @param  OFile                 - The corresponding OFile.
 
---*/
+**/
+VOID
+FatUpdateDirEntClusterSizeInfo (
+  IN FAT_OFILE    *OFile
+  )
 {
   ASSERT (OFile->ODir == NULL);
   OFile->DirEnt->Entry.FileSize = (UINT32) OFile->FileSize;
   FatSetDirEntCluster (OFile);
 }
 
+/**
+
+  Copy all the information of DirEnt2 to DirEnt1 except for 8.3 name.
+
+  @param  DirEnt1               - The destination directory entry.
+  @param  DirEnt2               - The source directory entry.
+
+**/
 VOID
 FatCloneDirEnt (
   IN  FAT_DIRENT          *DirEnt1,
   IN  FAT_DIRENT          *DirEnt2
   )
-/*++
-
-Routine Description:
-
-  Copy all the information of DirEnt2 to DirEnt1 except for 8.3 name.
-
-Arguments:
-
-  DirEnt1               - The destination directory entry.
-  DirEnt2               - The source directory entry.
-
-Returns:
-
-  None.
-
---*/
 {
   UINT8 *Entry1;
   UINT8 *Entry2;
   Entry1  = (UINT8 *) &DirEnt1->Entry;
   Entry2  = (UINT8 *) &DirEnt2->Entry;
@@ -273,32 +221,24 @@ Returns:
     Entry2 + FAT_ENTRY_INFO_OFFSET,
     sizeof (FAT_DIRECTORY_ENTRY) - FAT_ENTRY_INFO_OFFSET
     );
 }
 
+/**
+
+  Get the LFN for the directory entry.
+
+  @param  Parent                - The parent directory.
+  @param  DirEnt                - The directory entry to get LFN.
+
+**/
 STATIC
 VOID
 FatLoadLongNameEntry (
   IN FAT_OFILE           *Parent,
   IN FAT_DIRENT          *DirEnt
   )
-/*++
-
-Routine Description:
-
-  Get the LFN for the directory entry.
-
-Arguments:
-
-  Parent                - The parent directory.
-  DirEnt                - The directory entry to get LFN.
-
-Returns:
-
-  None.
-
---*/
 {
   CHAR16            LfnBuffer[MAX_LFN_ENTRIES * LFN_CHAR_TOTAL + 1];
   CHAR16            *LfnBufferPointer;
   CHAR8             *File8Dot3Name;
   UINTN             EntryPos;
@@ -365,64 +305,50 @@ Returns:
   }
 
   DirEnt->FileString = AllocateCopyPool (StrSize (LfnBuffer), LfnBuffer);
 }
 
+/**
+
+  Add this directory entry node to the list of directory entries and hash table.
+
+  @param  ODir                  - The parent OFile which needs to be updated.
+  @param  DirEnt                - The directory entry to be added.
+
+**/
 STATIC
 VOID
 FatAddDirEnt (
   IN FAT_ODIR             *ODir,
   IN FAT_DIRENT           *DirEnt
   )
-/*++
-
-Routine Description:
-
-  Add this directory entry node to the list of directory entries and hash table.
-
-Arguments:
-
-  ODir                  - The parent OFile which needs to be updated.
-  DirEnt                - The directory entry to be added.
-
-Returns:
-
-  None.
-
---*/
 {
   if (DirEnt->Link.BackLink == NULL) {
     DirEnt->Link.BackLink = &ODir->ChildList;
   }
   InsertTailList (DirEnt->Link.BackLink, &DirEnt->Link);
   FatInsertToHashTable (ODir, DirEnt);
 }
 
+/**
+
+  Load from disk the next directory entry at current end of directory position.
+
+  @param  OFile                 - The parent OFile.
+  @param  PtrDirEnt             - The directory entry that is loaded.
+
+  @retval EFI_SUCCESS           - Load the directory entry successfully.
+  @retval EFI_OUT_OF_RESOURCES  - Out of resource.
+  @return other                 - An error occurred when reading the directory entries.
+
+**/
 STATIC
 EFI_STATUS
 FatLoadNextDirEnt (
   IN  FAT_OFILE           *OFile,
   OUT FAT_DIRENT          **PtrDirEnt
   )
-/*++
-
-Routine Description:
-
-  Load from disk the next directory entry at current end of directory position
-
-Arguments:
-
-  OFile                 - The parent OFile.
-  PtrDirEnt             - The directory entry that is loaded.
-
-Returns:
-
-  EFI_SUCCESS           - Load the directory entry successfully.
-  EFI_OUT_OF_RESOURCES  - Out of resource.
-  other                 - An error occurred when reading the directory entries.
-
---*/
 {
   EFI_STATUS          Status;
   FAT_DIRENT          *DirEnt;
   FAT_ODIR            *ODir;
   FAT_DIRECTORY_ENTRY Entry;
@@ -503,36 +429,30 @@ Returns:
 Done:
   FatFreeDirEnt (DirEnt);
   return Status;
 }
 
+/**
+
+  Get the directory entry's info into Buffer.
+
+  @param  Volume                - FAT file system volume.
+  @param  DirEnt                - The corresponding directory entry.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing file info.
+
+  @retval EFI_SUCCESS           - Get the file info successfully.
+  @retval EFI_BUFFER_TOO_SMALL  - The buffer is too small.
+
+**/
 EFI_STATUS
 FatGetDirEntInfo (
   IN     FAT_VOLUME         *Volume,
   IN     FAT_DIRENT         *DirEnt,
   IN OUT UINTN              *BufferSize,
      OUT VOID               *Buffer
   )
-/*++
-
-Routine Description:
-
-  Get the directory entry's info into Buffer.
-
-Arguments:
-
-  Volume                - FAT file system volume.
-  DirEnt                - The corresponding directory entry.
-  BufferSize            - Size of Buffer.
-  Buffer                - Buffer containing file info.
-
-Returns:
-
-  EFI_SUCCESS           - Get the file info successfully.
-  EFI_BUFFER_TOO_SMALL  - The buffer is too small.
-
---*/
 {
   UINTN               Size;
   UINTN               NameSize;
   UINTN               ResultSize;
   UINTN               Cluster;
@@ -573,35 +493,29 @@ Returns:
 
   *BufferSize = ResultSize;
   return Status;
 }
 
+/**
+
+  Search the directory for the directory entry whose filename is FileNameString.
+
+  @param  OFile                 - The parent OFile whose directory is to be searched.
+  @param  FileNameString        - The filename to be searched.
+  @param  PtrDirEnt             - pointer to the directory entry if found.
+
+  @retval EFI_SUCCESS           - Find the directory entry or not found.
+  @return other                 - An error occurred when reading the directory entries.
+
+**/
 STATIC
 EFI_STATUS
 FatSearchODir (
   IN  FAT_OFILE      *OFile,
   IN  CHAR16         *FileNameString,
   OUT FAT_DIRENT     **PtrDirEnt
   )
-/*++
-
-Routine Description:
-
-  Search the directory for the directory entry whose filename is FileNameString.
-
-Arguments:
-
-  OFile                 - The parent OFile whose directory is to be searched.
-  FileNameString        - The filename to be searched.
-  PtrDirEnt             - pointer to the directory entry if found.
-
-Returns:
-
-  EFI_SUCCESS           - Find the directory entry or not found.
-  other                 - An error occurred when reading the directory entries.
-
---*/
 {
   BOOLEAN     PossibleShortName;
   CHAR8       File8Dot3Name[FAT_NAME_LEN];
   FAT_ODIR    *ODir;
   FAT_DIRENT  *DirEnt;
@@ -645,60 +559,46 @@ Returns:
 
   *PtrDirEnt = DirEnt;
   return EFI_SUCCESS;
 }
 
-VOID
-FatResetODirCursor (
-  IN FAT_OFILE    *OFile
-  )
-/*++
-
-Routine Description:
+/**
 
   Set the OFile's current directory cursor to the list head.
 
-Arguments:
+  @param OFile                 - The directory OFile whose directory cursor is reset.
 
-  OFile                 - The directory OFile whose directory cursor is reset.
-
-Returns:
-
-  None.
-
---*/
+**/
+VOID
+FatResetODirCursor (
+  IN FAT_OFILE    *OFile
+  )
 {
   FAT_ODIR  *ODir;
 
   ODir = OFile->ODir;
   ASSERT (ODir != NULL);
   ODir->CurrentCursor = &(ODir->ChildList);
   ODir->CurrentPos    = 0;
 }
 
-EFI_STATUS
-FatGetNextDirEnt (
-  IN  FAT_OFILE     *OFile,
-  OUT FAT_DIRENT    **PtrDirEnt
-  )
-/*++
-
-Routine Description:
+/**
 
   Set the directory's cursor to the next and get the next directory entry.
 
-Arguments:
-
-  OFile                 - The parent OFile.
-  PtrDirEnt             - The next directory entry.
-
-Returns:
+  @param  OFile                 - The parent OFile.
+  @param PtrDirEnt             - The next directory entry.
 
-  EFI_SUCCESS           - We get the next directory entry successfully.
-  other                 - An error occurred when get next directory entry.
+  @retval EFI_SUCCESS           - We get the next directory entry successfully.
+  @return other                 - An error occurred when get next directory entry.
 
---*/
+**/
+EFI_STATUS
+FatGetNextDirEnt (
+  IN  FAT_OFILE     *OFile,
+  OUT FAT_DIRENT    **PtrDirEnt
+  )
 {
   EFI_STATUS  Status;
   FAT_DIRENT  *DirEnt;
   FAT_ODIR    *ODir;
 
@@ -733,32 +633,24 @@ Returns:
 
   *PtrDirEnt = DirEnt;
   return EFI_SUCCESS;
 }
 
+/**
+
+  Set the directory entry count according to the filename.
+
+  @param  OFile                 - The corresponding OFile.
+  @param  DirEnt                - The directory entry to be set.
+
+**/
 STATIC
 VOID
 FatSetEntryCount (
   IN FAT_OFILE    *OFile,
   IN FAT_DIRENT   *DirEnt
   )
-/*++
-
-Routine Description:
-
-  Set the directory entry count according to the filename.
-
-Arguments:
-
-  OFile                 - The corresponding OFile.
-  DirEnt                - The directory entry to be set.
-
-Returns:
-
-  None.
-
---*/
 {
   CHAR16  *FileString;
   CHAR8   *File8Dot3Name;
 
   //
@@ -798,58 +690,46 @@ Returns:
       DirEnt->EntryCount = (UINT8)(LFN_ENTRY_NUMBER (StrLen (FileString)) + DirEnt->EntryCount);
     }
   }
 }
 
+/**
+
+  Append a zero cluster to the current OFile.
+
+  @param  OFile        - The directory OFile which needs to be updated.
+
+  @retval EFI_SUCCESS  - Append a zero cluster to the OFile successfully.
+  @return other        - An error occurred when appending the zero cluster.
+
+**/
 STATIC
 EFI_STATUS
 FatExpandODir (
   IN FAT_OFILE  *OFile
   )
-/*++
-
-Routine Description:
-
-  Append a zero cluster to the current OFile.
+{
+  return FatExpandOFile (OFile, OFile->FileSize + OFile->Volume->ClusterSize);
+}
 
-Arguments:
+/**
 
-  OFile        - The directory OFile which needs to be updated.
+  Search the Root OFile for the possible volume label.
 
-Returns:
+  @param  Root                  - The Root OFile.
+  @param  DirEnt                - The returned directory entry of volume label.
 
-  EFI_SUCCESS  - Append a zero cluster to the OFile successfully.
-  other        - An error occurred when appending the zero cluster.
-
---*/
-{
-  return FatExpandOFile (OFile, OFile->FileSize + OFile->Volume->ClusterSize);
-}
+  @retval EFI_SUCCESS           - The search process is completed successfully.
+  @return other                 - An error occurred when searching volume label.
 
+**/
 STATIC
 EFI_STATUS
 FatSeekVolumeId (
   IN  FAT_OFILE            *Root,
   OUT FAT_DIRENT           *DirEnt
   )
-/*++
-
-Routine Description:
-
-  Search the Root OFile for the possible volume label.
-
-Arguments:
-
-  Root                  - The Root OFile.
-  DirEnt                - The returned directory entry of volume label.
-
-Returns:
-
-  EFI_SUCCESS           - The search process is completed successfully.
-  other                 - An error occurred when searching volume label.
-
---*/
 {
   EFI_STATUS          Status;
   UINTN               EntryPos;
   FAT_DIRECTORY_ENTRY *Entry;
 
@@ -872,37 +752,31 @@ Returns:
     EntryPos++;
   } while (Entry->FileName[0] != EMPTY_ENTRY_MARK);
   return EFI_SUCCESS;
 }
 
-STATIC
-EFI_STATUS
-FatFirstFitInsertDirEnt (
-  IN FAT_OFILE    *OFile,
-  IN FAT_DIRENT   *DirEnt
-  )
-/*++
-
-Routine Description:
+/**
 
   Use First Fit Algorithm to insert directory entry.
   Only this function will erase "E5" entries in a directory.
   In view of safest recovery, this function will only be triggered
   when maximum directory entry number has reached.
 
-Arguments:
-
-  OFile                 - The corresponding OFile.
-  DirEnt                - The directory entry to be inserted.
+  @param  OFile                 - The corresponding OFile.
+  @param  DirEnt                - The directory entry to be inserted.
 
-Returns:
+  @retval EFI_SUCCESS           - The directory entry has been successfully inserted.
+  @retval EFI_VOLUME_FULL       - The directory can not hold more directory entries.
+  @return Others                - Some error occurred when inserting new directory entries.
 
-  EFI_SUCCESS           - The directory entry has been successfully inserted.
-  EFI_VOLUME_FULL       - The directory can not hold more directory entries.
-  Others                - Some error occurred when inserting new directory entries.
-
---*/
+**/
+STATIC
+EFI_STATUS
+FatFirstFitInsertDirEnt (
+  IN FAT_OFILE    *OFile,
+  IN FAT_DIRENT   *DirEnt
+  )
 {
   EFI_STATUS      Status;
   FAT_ODIR        *ODir;
   LIST_ENTRY      *CurrentEntry;
   FAT_DIRENT      *CurrentDirEnt;
@@ -954,34 +828,28 @@ Done:
   DirEnt->EntryPos   = (UINT16) NewEntryPos;
   DirEnt->Link.BackLink = CurrentEntry;
   return EFI_SUCCESS;
 }
 
+/**
+
+  Find the new directory entry position for the directory entry.
+
+  @param  OFile                 - The corresponding OFile.
+  @param  DirEnt                - The directory entry whose new position is to be set.
+
+  @retval EFI_SUCCESS           - The new directory entry position is successfully found.
+  @retval EFI_VOLUME_FULL       - The directory has reach its maximum capacity.
+  @return other                 - An error occurred when reading the directory entry.
+
+**/
 STATIC
 EFI_STATUS
 FatNewEntryPos (
   IN FAT_OFILE    *OFile,
   IN FAT_DIRENT   *DirEnt
   )
-/*++
-
-Routine Description:
-
-  Find the new directory entry position for the directory entry.
-
-Arguments:
-
-  OFile                 - The corresponding OFile.
-  DirEnt                - The directory entry whose new position is to be set.
-
-Returns:
-
-  EFI_SUCCESS           - The new directory entry position is successfully found.
-  EFI_VOLUME_FULL       - The directory has reach its maximum capacity.
-  other                 - An error occurred when reading the directory entry.
-
---*/
 {
   EFI_STATUS  Status;
   FAT_ODIR    *ODir;
   FAT_DIRENT  *TempDirEnt;
   UINT32      NewEndPos;
@@ -1025,32 +893,26 @@ Returns:
   ODir->CurrentEndPos = NewEndPos;
   DirEnt->EntryPos = (UINT16) (ODir->CurrentEndPos - 1);
   return EFI_SUCCESS;
 }
 
-EFI_STATUS
-FatGetVolumeEntry (
-  IN FAT_VOLUME           *Volume,
-  IN CHAR16               *Name
-  )
-/*++
-
-Routine Description:
+/**
 
   Get the directory entry for the volume.
 
-Arguments:
-
-  Volume                - FAT file system volume.
-  Name                  - The file name of the volume.
-
-Returns:
+  @param  Volume                - FAT file system volume.
+  @param  Name                  - The file name of the volume.
 
-  EFI_SUCCESS           - Update the volume with the directory entry sucessfully.
-  others                - An error occurred when getting volume label.
+  @retval EFI_SUCCESS           - Update the volume with the directory entry sucessfully.
+  @return others                - An error occurred when getting volume label.
 
---*/
+**/
+EFI_STATUS
+FatGetVolumeEntry (
+  IN FAT_VOLUME           *Volume,
+  IN CHAR16               *Name
+  )
 {
   EFI_STATUS  Status;
   FAT_DIRENT  LabelDirEnt;
 
   *Name   = 0;
@@ -1062,33 +924,27 @@ Returns:
   }
 
   return Status;
 }
 
-EFI_STATUS
-FatSetVolumeEntry (
-  IN FAT_VOLUME           *Volume,
-  IN CHAR16               *Name
-  )
-/*++
-
-Routine Description:
+/**
 
   Set the relevant directory entry into disk for the volume.
 
-Arguments:
-
-  Volume              - FAT file system volume.
-  Name                - The new file name of the volume.
-
-Returns:
+  @param  Volume              - FAT file system volume.
+  @param  Name                - The new file name of the volume.
 
-  EFI_SUCCESS         - Update the Volume sucessfully.
-  EFI_UNSUPPORTED     - The input label is not a valid volume label.
-  other               - An error occurred when setting volume label.
+  @retval EFI_SUCCESS         - Update the Volume sucessfully.
+  @retval EFI_UNSUPPORTED     - The input label is not a valid volume label.
+  @return other               - An error occurred when setting volume label.
 
---*/
+**/
+EFI_STATUS
+FatSetVolumeEntry (
+  IN FAT_VOLUME           *Volume,
+  IN CHAR16               *Name
+  )
 {
   EFI_STATUS  Status;
   FAT_DIRENT  LabelDirEnt;
   FAT_OFILE   *Root;
 
@@ -1119,30 +975,24 @@ Returns:
 
   FatGetCurrentFatTime (&LabelDirEnt.Entry.FileModificationTime);
   return FatStoreDirEnt (Root, &LabelDirEnt);
 }
 
-EFI_STATUS
-FatCreateDotDirEnts (
-  IN FAT_OFILE          *OFile
-  )
-/*++
-
-Routine Description:
+/**
 
   Create "." and ".." directory entries in the newly-created parent OFile.
 
-Arguments:
-
-  OFile                 - The parent OFile.
+  @param  OFile                 - The parent OFile.
 
-Returns:
+  @retval EFI_SUCCESS           - The dot directory entries are successfully created.
+  @return other                 - An error occurred when creating the directory entry.
 
-  EFI_SUCCESS           - The dot directory entries are successfully created.
-  other                 - An error occurred when creating the directory entry.
-
---*/
+**/
+EFI_STATUS
+FatCreateDotDirEnts (
+  IN FAT_OFILE          *OFile
+  )
 {
   EFI_STATUS  Status;
   FAT_DIRENT  *DirEnt;
 
   Status = FatExpandODir (OFile);
@@ -1163,37 +1013,31 @@ Returns:
   //
   Status = FatCreateDirEnt (OFile, L"..", FAT_ATTRIBUTE_DIRECTORY, &DirEnt);
   return Status;
 }
 
+/**
+
+  Create a directory entry in the parent OFile.
+
+  @param  OFile                 - The parent OFile.
+  @param  FileName              - The filename of the newly-created directory entry.
+  @param  Attributes            - The attribute of the newly-created directory entry.
+  @param  PtrDirEnt             - The pointer to the newly-created directory entry.
+
+  @retval EFI_SUCCESS           - The directory entry is successfully created.
+  @retval EFI_OUT_OF_RESOURCES  - Not enough memory to create the directory entry.
+  @return other                 - An error occurred when creating the directory entry.
+
+**/
 EFI_STATUS
 FatCreateDirEnt (
   IN  FAT_OFILE         *OFile,
   IN  CHAR16            *FileName,
   IN  UINT8             Attributes,
   OUT FAT_DIRENT        **PtrDirEnt
   )
-/*++
-
-Routine Description:
-
-  Create a directory entry in the parent OFile.
-
-Arguments:
-
-  OFile                 - The parent OFile.
-  FileName              - The filename of the newly-created directory entry.
-  Attributes            - The attribute of the newly-created directory entry.
-  PtrDirEnt             - The pointer to the newly-created directory entry.
-
-Returns:
-
-  EFI_SUCCESS           - The directory entry is successfully created.
-  EFI_OUT_OF_RESOURCES  - Not enough memory to create the directory entry.
-  other                 - An error occurred when creating the directory entry.
-
---*/
 {
   FAT_DIRENT  *DirEnt;
   FAT_ODIR    *ODir;
   EFI_STATUS  Status;
 
@@ -1232,32 +1076,26 @@ Returns:
 Done:
   FatFreeDirEnt (DirEnt);
   return Status;
 }
 
-EFI_STATUS
-FatRemoveDirEnt (
-  IN FAT_OFILE    *OFile,
-  IN FAT_DIRENT   *DirEnt
-  )
-/*++
-
-Routine Description:
+/**
 
   Remove this directory entry node from the list of directory entries and hash table.
 
-Arguments:
-
-  OFile                - The parent OFile.
-  DirEnt               - The directory entry to be removed.
+  @param  OFile                - The parent OFile.
+  @param  DirEnt               - The directory entry to be removed.
 
-Returns:
+  @retval EFI_SUCCESS          - The directory entry is successfully removed.
+  @return other                - An error occurred when removing the directory entry.
 
-  EFI_SUCCESS          - The directory entry is successfully removed.
-  other                - An error occurred when removing the directory entry.
-
---*/
+**/
+EFI_STATUS
+FatRemoveDirEnt (
+  IN FAT_OFILE    *OFile,
+  IN FAT_DIRENT   *DirEnt
+  )
 {
   FAT_ODIR  *ODir;
 
   ODir = OFile->ODir;
   if (ODir->CurrentCursor == &DirEnt->Link) {
@@ -1277,33 +1115,27 @@ Returns:
   DirEnt->Entry.FileName[0] = DELETE_ENTRY_MARK;
   DirEnt->Invalid           = TRUE;
   return FatStoreDirEnt (OFile, DirEnt);
 }
 
-EFI_STATUS
-FatOpenDirEnt (
-  IN FAT_OFILE         *Parent,
-  IN FAT_DIRENT        *DirEnt
-  )
-/*++
-
-Routine Description:
+/**
 
   Open the directory entry to get the OFile.
 
-Arguments:
+  @param  Parent                - The parent OFile.
+  @param  DirEnt                - The directory entry to be opened.
 
-  OFile                 - The parent OFile.
-  DirEnt                - The directory entry to be opened.
+  @retval EFI_SUCCESS           - The directory entry is successfully opened.
+  @retval EFI_OUT_OF_RESOURCES  - not enough memory to allocate a new OFile.
+  @return other                 - An error occurred when opening the directory entry.
 
-Returns:
-
-  EFI_SUCCESS           - The directory entry is successfully opened.
-  EFI_OUT_OF_RESOURCES  - not enough memory to allocate a new OFile.
-  other                 - An error occurred when opening the directory entry.
-
---*/
+**/
+EFI_STATUS
+FatOpenDirEnt (
+  IN FAT_OFILE         *Parent,
+  IN FAT_DIRENT        *DirEnt
+  )
 {
   FAT_OFILE   *OFile;
   FAT_VOLUME  *Volume;
 
   if (DirEnt->OFile == NULL) {
@@ -1362,30 +1194,21 @@ Returns:
   }
 
   return EFI_SUCCESS;
 }
 
-VOID
-FatCloseDirEnt (
-  IN FAT_DIRENT        *DirEnt
-  )
-/*++
-
-Routine Description:
+/**
 
   Close the directory entry and free the OFile.
 
-Arguments:
-
-  DirEnt               - The directory entry to be closed.
-
-Returns:
-
-  EFI_SUCCESS          - The directory entry is successfully opened.
-  Other                - An error occurred when opening the directory entry.
+  @param  DirEnt               - The directory entry to be closed.
 
---*/
+**/
+VOID
+FatCloseDirEnt (
+  IN FAT_DIRENT        *DirEnt
+  )
 {
   FAT_OFILE   *OFile;
   FAT_VOLUME  *Volume;
 
   OFile   = DirEnt->OFile;
@@ -1410,42 +1233,37 @@ Returns:
     //
     FatFreeDirEnt (DirEnt);
   }
 }
 
-EFI_STATUS
-FatLocateOFile (
-  IN OUT FAT_OFILE        **PtrOFile,
-  IN     CHAR16           *FileName,
-  IN     UINT8            Attributes,
-     OUT CHAR16           *NewFileName
-  )
-/*++
-
-Routine Description:
+/**
 
   Traverse filename and open all OFiles that can be opened.
   Update filename pointer to the component that can't be opened.
   If more than one name component remains, returns an error;
   otherwise, return the remaining name component so that the caller might choose to create it.
 
-Arguments:
-  PtrOFile              - As input, the reference OFile; as output, the located OFile.
-  FileName              - The file name relevant to the OFile.
-  Attributes            - The attribute of the destination OFile.
-  NewFileName           - The remaining file name.
-
-Returns:
+  @param  PtrOFile              - As input, the reference OFile; as output, the located OFile.
+  @param  FileName              - The file name relevant to the OFile.
+  @param  Attributes            - The attribute of the destination OFile.
+  @param  NewFileName           - The remaining file name.
 
-  EFI_NOT_FOUND         - The file name can't be opened and there is more than one
+  @retval EFI_NOT_FOUND         - The file name can't be opened and there is more than one
                           components within the name left (this means the name can
                           not be created either).
-  EFI_INVALID_PARAMETER - The parameter is not valid.
-  EFI_SUCCESS           - Open the file successfully.
-  other                 - An error occured when locating the OFile.
+  @retval EFI_INVALID_PARAMETER - The parameter is not valid.
+  @retval EFI_SUCCESS           - Open the file successfully.
+  @return other                 - An error occured when locating the OFile.
 
---*/
+**/
+EFI_STATUS
+FatLocateOFile (
+  IN OUT FAT_OFILE        **PtrOFile,
+  IN     CHAR16           *FileName,
+  IN     UINT8            Attributes,
+     OUT CHAR16           *NewFileName
+  )
 {
   EFI_STATUS  Status;
   FAT_VOLUME  *Volume;
   CHAR16      ComponentName[EFI_PATH_STRING_LENGTH];
   UINTN       FileNameLen;
diff --git a/FatPkg/EnhancedFatDxe/DiskCache.c b/FatPkg/EnhancedFatDxe/DiskCache.c
index 7f1fcf4..63f9c00 100644
--- a/FatPkg/EnhancedFatDxe/DiskCache.c
+++ b/FatPkg/EnhancedFatDxe/DiskCache.c
@@ -1,67 +1,49 @@
-/*++
+/** @file
+  Cache implementation for EFI FAT File system driver.
 
 Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
+**/
 
-Module Name:
-
-  DiskCache.c
+#include "Fat.h"
 
-Abstract:
+/**
 
-  Cache implementation for EFI FAT File system driver
+  This function is used by the Data Cache.
 
-Revision History
+  When this function is called by write command, all entries in this range
+  are older than the contents in disk, so they are invalid; just mark them invalid.
 
---*/
+  When this function is called by read command, if any entry in this range
+  is dirty, it means that the relative info directly readed from media is older than
+  than the info in the cache; So need to update the relative info in the Buffer.
 
-#include "Fat.h"
+  @param  Volume                - FAT file system volume.
+  @param  IoMode                - This function is called by read command or write command
+  @param  StartPageNo           - First PageNo to be checked in the cache.
+  @param  EndPageNo             - Last PageNo to be checked in the cache.
+  @param  Buffer                - The user buffer need to update. Only when doing the read command
+                          and there is dirty cache in the cache range, this parameter will be used.
 
+**/
 STATIC
 VOID
 FatFlushDataCacheRange (
   IN  FAT_VOLUME         *Volume,
   IN  IO_MODE            IoMode,
   IN  UINTN              StartPageNo,
   IN  UINTN              EndPageNo,
   OUT UINT8              *Buffer
   )
-/*++
-
-Routine Description:
-
-  This function is used by the Data Cache.
-
-  When this function is called by write command, all entries in this range
-  are older than the contents in disk, so they are invalid; just mark them invalid.
-
-  When this function is called by read command, if any entry in this range
-  is dirty, it means that the relative info directly readed from media is older than
-  than the info in the cache; So need to update the relative info in the Buffer.
-
-Arguments:
-
-  Volume                - FAT file system volume.
-  IoMode                - This function is called by read command or write command
-  StartPageNo           - First PageNo to be checked in the cache.
-  EndPageNo             - Last PageNo to be checked in the cache.
-  Buffer                - The user buffer need to update. Only when doing the read command
-                          and there is dirty cache in the cache range, this parameter will be used.
-
-Returns:
-
-  None.
-
---*/
 {
   UINTN       PageNo;
   UINTN       GroupNo;
   UINTN       GroupMask;
   UINTN       PageSize;
@@ -101,38 +83,33 @@ Returns:
       }
     }
   }
 }
 
+/**
+
+  Exchange the cache page with the image on the disk
+
+  @param  Volume                - FAT file system volume.
+  @param  DataType              - Indicate the cache type.
+  @param  IoMode                - Indicate whether to load this page from disk or store this page to disk.
+  @param  CacheTag              - The Cache Tag for the current cache page.
+  @param  Task                    point to task instance.
+
+  @retval EFI_SUCCESS           - Cache page exchanged successfully.
+  @return Others                - An error occurred when exchanging cache page.
+
+**/
 STATIC
 EFI_STATUS
 FatExchangeCachePage (
   IN FAT_VOLUME         *Volume,
   IN CACHE_DATA_TYPE    DataType,
   IN IO_MODE            IoMode,
   IN CACHE_TAG          *CacheTag,
   IN FAT_TASK           *Task
   )
-/*++
-
-Routine Description:
-
-  Exchange the cache page with the image on the disk
-
-Arguments:
-
-  Volume                - FAT file system volume.
-  DataType              - Indicate the cache type.
-  IoMode                - Indicate whether to load this page from disk or store this page to disk.
-  CacheTag              - The Cache Tag for the current cache page.
-
-Returns:
-
-  EFI_SUCCESS           - Cache page exchanged successfully.
-  Others                - An error occurred when exchanging cache page.
-
---*/
 {
   EFI_STATUS  Status;
   UINTN       GroupNo;
   UINTN       PageNo;
   UINTN       WriteCount;
@@ -179,37 +156,31 @@ Returns:
   CacheTag->Dirty     = FALSE;
   CacheTag->RealSize  = RealSize;
   return EFI_SUCCESS;
 }
 
+/**
+
+  Get one cache page by specified PageNo.
+
+  @param  Volume                - FAT file system volume.
+  @param  CacheDataType         - The cache type: CACHE_FAT or CACHE_DATA.
+  @param  PageNo                - PageNo to match with the cache.
+  @param  CacheTag              - The Cache Tag for the current cache page.
+
+  @retval EFI_SUCCESS           - Get the cache page successfully.
+  @return other                 - An error occurred when accessing data.
+
+**/
 STATIC
 EFI_STATUS
 FatGetCachePage (
   IN FAT_VOLUME         *Volume,
   IN CACHE_DATA_TYPE    CacheDataType,
   IN UINTN              PageNo,
   IN CACHE_TAG          *CacheTag
   )
-/*++
-
-Routine Description:
-
-  Get one cache page by specified PageNo.
-
-Arguments:
-
-  Volume                - FAT file system volume.
-  CacheDataType         - The cache type: CACHE_FAT or CACHE_DATA.
-  PageNo                - PageNo to match with the cache.
-  CacheTag              - The Cache Tag for the current cache page.
-
-Returns:
-
-  EFI_SUCCESS           - Get the cache page successfully.
-  other                 - An error occurred when accessing data.
-
---*/
 {
   EFI_STATUS  Status;
   UINTN       OldPageNo;
 
   OldPageNo = CacheTag->PageNo;
@@ -236,10 +207,27 @@ Returns:
   Status            = FatExchangeCachePage (Volume, CacheDataType, ReadDisk, CacheTag, NULL);
 
   return Status;
 }
 
+/**
+
+  Read Length bytes from the position of Offset into Buffer, or
+  write Length bytes from Buffer into the position of Offset.
+
+  @param  Volume                - FAT file system volume.
+  @param  CacheDataType         - The type of cache: CACHE_DATA or CACHE_FAT.
+  @param  IoMode                - Indicate the type of disk access.
+  @param  PageNo                - The number of unaligned cache page.
+  @param  Offset                - The starting byte of cache page.
+  @param  Length                - The number of bytes that is read or written
+  @param  Buffer                - Buffer containing cache data.
+
+  @retval EFI_SUCCESS           - The data was accessed correctly.
+  @return Others                - An error occurred when accessing unaligned cache page.
+
+**/
 STATIC
 EFI_STATUS
 FatAccessUnalignedCachePage (
   IN     FAT_VOLUME        *Volume,
   IN     CACHE_DATA_TYPE   CacheDataType,
@@ -247,32 +235,10 @@ FatAccessUnalignedCachePage (
   IN     UINTN             PageNo,
   IN     UINTN             Offset,
   IN     UINTN             Length,
   IN OUT VOID              *Buffer
   )
-/*++
-Routine Description:
-
-  Read Length bytes from the position of Offset into Buffer, or
-  write Length bytes from Buffer into the position of Offset.
-
-Arguments:
-
-  Volume                - FAT file system volume.
-  CacheDataType         - The type of cache: CACHE_DATA or CACHE_FAT.
-  IoMode                - Indicate the type of disk access.
-  PageNo                - The number of unaligned cache page.
-  Offset                - The starting byte of cache page.
-  Length                - The number of bytes that is read or written
-  Buffer                - Buffer containing cache data.
-
-Returns:
-
-  EFI_SUCCESS           - The data was accessed correctly.
-  Others                - An error occurred when accessing unaligned cache page.
-
---*/
 {
   EFI_STATUS  Status;
   VOID        *Source;
   VOID        *Destination;
   DISK_CACHE  *DiskCache;
@@ -297,22 +263,11 @@ Returns:
   }
 
   return Status;
 }
 
-EFI_STATUS
-FatAccessCache (
-  IN     FAT_VOLUME         *Volume,
-  IN     CACHE_DATA_TYPE    CacheDataType,
-  IN     IO_MODE            IoMode,
-  IN     UINT64             Offset,
-  IN     UINTN              BufferSize,
-  IN OUT UINT8              *Buffer,
-  IN     FAT_TASK           *Task
-  )
-/*++
-Routine Description:
+/**
 
   Read BufferSize bytes from the position of Offset into Buffer,
   or write BufferSize bytes from Buffer into the position of Offset.
 
   Base on the parameter of CACHE_DATA_TYPE, the data access will be divided into
@@ -324,26 +279,33 @@ Routine Description:
   2. Access of Data cache (CACHE_DATA):
      The access data will be divided into UnderRun data, Aligned data and OverRun data;
      The UnderRun data and OverRun data will be accessed by the Data cache,
      but the Aligned data will be accessed with disk directly.
 
-Arguments:
-
-  Volume                - FAT file system volume.
-  CacheDataType         - The type of cache: CACHE_DATA or CACHE_FAT.
-  IoMode                - Indicate the type of disk access.
-  Offset                - The starting byte offset to read from.
-  BufferSize            - Size of Buffer.
-  Buffer                - Buffer containing cache data.
+  @param  Volume                - FAT file system volume.
+  @param  CacheDataType         - The type of cache: CACHE_DATA or CACHE_FAT.
+  @param  IoMode                - Indicate the type of disk access.
+  @param  Offset                - The starting byte offset to read from.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing cache data.
+  @param  Task                    point to task instance.
 
-Returns:
+  @retval EFI_SUCCESS           - The data was accessed correctly.
+  @retval EFI_MEDIA_CHANGED     - The MediaId does not match the current device.
+  @return Others                - An error occurred when accessing cache.
 
-  EFI_SUCCESS           - The data was accessed correctly.
-  EFI_MEDIA_CHANGED     - The MediaId does not match the current device.
-  Others                - An error occurred when accessing cache.
-
---*/
+**/
+EFI_STATUS
+FatAccessCache (
+  IN     FAT_VOLUME         *Volume,
+  IN     CACHE_DATA_TYPE    CacheDataType,
+  IN     IO_MODE            IoMode,
+  IN     UINT64             Offset,
+  IN     UINTN              BufferSize,
+  IN OUT UINT8              *Buffer,
+  IN     FAT_TASK           *Task
+  )
 {
   EFI_STATUS  Status;
   UINTN       PageSize;
   UINTN       UnderRun;
   UINTN       OverRun;
@@ -419,31 +381,26 @@ Returns:
   }
 
   return Status;
 }
 
-EFI_STATUS
-FatVolumeFlushCache (
-  IN FAT_VOLUME         *Volume,
-  IN FAT_TASK           *Task
-  )
-/*++
-
-Routine Description:
+/**
 
   Flush all the dirty cache back, include the FAT cache and the Data cache.
 
-Arguments:
-
-  Volume                - FAT file system volume.
+  @param  Volume                - FAT file system volume.
+  @param  Task                    point to task instance.
 
-Returns:
+  @retval EFI_SUCCESS           - Flush all the dirty cache back successfully
+  @return other                 - An error occurred when writing the data into the disk
 
-  EFI_SUCCESS           - Flush all the dirty cache back successfully
-  other                 - An error occurred when writing the data into the disk
-
---*/
+**/
+EFI_STATUS
+FatVolumeFlushCache (
+  IN FAT_VOLUME         *Volume,
+  IN FAT_TASK           *Task
+  )
 {
   EFI_STATUS      Status;
   CACHE_DATA_TYPE CacheDataType;
   UINTN           GroupIndex;
   UINTN           GroupMask;
@@ -478,30 +435,24 @@ Returns:
   //
   Status = Volume->BlockIo->FlushBlocks (Volume->BlockIo);
   return Status;
 }
 
-EFI_STATUS
-FatInitializeDiskCache (
-  IN FAT_VOLUME         *Volume
-  )
-/*++
-
-Routine Description:
+/**
 
   Initialize the disk cache according to Volume's FatType.
 
-Arguments:
-
-  Volume                - FAT file system volume.
+  @param  Volume                - FAT file system volume.
 
-Returns:
+  @retval EFI_SUCCESS           - The disk cache is successfully initialized.
+  @retval EFI_OUT_OF_RESOURCES  - Not enough memory to allocate disk cache.
 
-  EFI_SUCCESS           - The disk cache is successfully initialized.
-  EFI_OUT_OF_RESOURCES  - Not enough memory to allocate disk cache.
-
---*/
+**/
+EFI_STATUS
+FatInitializeDiskCache (
+  IN FAT_VOLUME         *Volume
+  )
 {
   DISK_CACHE  *DiskCache;
   UINTN       FatCacheGroupCount;
   UINTN       DataCacheSize;
   UINTN       FatCacheSize;
diff --git a/FatPkg/EnhancedFatDxe/Fat.c b/FatPkg/EnhancedFatDxe/Fat.c
index 2080005..2e6c089 100644
--- a/FatPkg/EnhancedFatDxe/Fat.c
+++ b/FatPkg/EnhancedFatDxe/Fat.c
@@ -1,26 +1,18 @@
-/*++
+/** @file
+  Fat File System driver routines that support EFI driver model.
 
 Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
-
-Module Name:
-
-  Fat.c
-
-Abstract:
-
-  Fat File System driver routines that support EFI driver model
-
---*/
+**/
 
 #include "Fat.h"
 
 EFI_STATUS
 EFIAPI
@@ -70,33 +62,27 @@ EFI_DRIVER_BINDING_PROTOCOL gFatDriverBinding = {
   0xa,
   NULL,
   NULL
 };
 
+/**
+
+  Register Driver Binding protocol for this driver.
+
+  @param  ImageHandle           - Handle for the image of this driver.
+  @param  SystemTable           - Pointer to the EFI System Table.
+
+  @retval EFI_SUCCESS           - Driver loaded.
+  @return other                 - Driver not loaded.
+
+**/
 EFI_STATUS
 EFIAPI
 FatEntryPoint (
   IN EFI_HANDLE         ImageHandle,
   IN EFI_SYSTEM_TABLE   *SystemTable
   )
-/*++
-
-Routine Description:
-
-  Register Driver Binding protocol for this driver.
-
-Arguments:
-
-  ImageHandle           - Handle for the image of this driver.
-  SystemTable           - Pointer to the EFI System Table.
-
-Returns:
-
-  EFI_SUCCESS           - Driver loaded.
-  other                 - Driver not loaded.
-
---*/
 {
   EFI_STATUS                Status;
 
   //
   // Initialize the EFI Driver Library
@@ -112,31 +98,25 @@ Returns:
   ASSERT_EFI_ERROR (Status);
 
   return Status;
 }
 
-EFI_STATUS
-EFIAPI
-FatUnload (
-  IN EFI_HANDLE  ImageHandle
-  )
-/*++
-
-Routine Description:
+/**
 
   Unload function for this image. Uninstall DriverBinding protocol.
 
-Arguments:
+  @param ImageHandle           - Handle for the image of this driver.
 
-  ImageHandle           - Handle for the image of this driver.
+  @retval EFI_SUCCESS           - Driver unloaded successfully.
+  @return other                 - Driver can not unloaded.
 
-Returns:
-
-  EFI_SUCCESS           - Driver unloaded successfully.
-  other                 - Driver can not unloaded.
-
---*/
+**/
+EFI_STATUS
+EFIAPI
+FatUnload (
+  IN EFI_HANDLE  ImageHandle
+  )
 {
   EFI_STATUS  Status;
   EFI_HANDLE  *DeviceHandleBuffer;
   UINTN       DeviceHandleCount;
   UINTN       Index;
@@ -222,37 +202,31 @@ Returns:
   }
 
   return Status;
 }
 
+/**
+
+  Test to see if this driver can add a file system to ControllerHandle.
+  ControllerHandle must support both Disk IO and Block IO protocols.
+
+  @param  This                  - Protocol instance pointer.
+  @param  ControllerHandle      - Handle of device to test.
+  @param  RemainingDevicePath   - Not used.
+
+  @retval EFI_SUCCESS           - This driver supports this device.
+  @retval EFI_ALREADY_STARTED   - This driver is already running on this device.
+  @return other                 - This driver does not support this device.
+
+**/
 EFI_STATUS
 EFIAPI
 FatDriverBindingSupported (
   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
   IN EFI_HANDLE                   ControllerHandle,
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
   )
-/*++
-
-Routine Description:
-
-  Test to see if this driver can add a file system to ControllerHandle.
-  ControllerHandle must support both Disk IO and Block IO protocols.
-
-Arguments:
-
-  This                  - Protocol instance pointer.
-  ControllerHandle      - Handle of device to test.
-  RemainingDevicePath   - Not used.
-
-Returns:
-
-  EFI_SUCCESS           - This driver supports this device.
-  EFI_ALREADY_STARTED   - This driver is already running on this device.
-  other                 - This driver does not support this device.
-
---*/
 {
   EFI_STATUS            Status;
   EFI_DISK_IO_PROTOCOL  *DiskIo;
 
   //
@@ -293,39 +267,33 @@ Returns:
                   );
 
   return Status;
 }
 
-EFI_STATUS
-EFIAPI
-FatDriverBindingStart (
-  IN EFI_DRIVER_BINDING_PROTOCOL  *This,
-  IN EFI_HANDLE                   ControllerHandle,
-  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
-  )
-/*++
-
-Routine Description:
+/**
 
   Start this driver on ControllerHandle by opening a Block IO and Disk IO
   protocol, reading Device Path. Add a Simple File System protocol to
   ControllerHandle if the media contains a valid file system.
 
-Arguments:
-
-  This                  - Protocol instance pointer.
-  ControllerHandle      - Handle of device to bind driver to.
-  RemainingDevicePath   - Not used.
+  @param  This                  - Protocol instance pointer.
+  @param  ControllerHandle      - Handle of device to bind driver to.
+  @param  RemainingDevicePath   - Not used.
 
-Returns:
+  @retval EFI_SUCCESS           - This driver is added to DeviceHandle.
+  @retval EFI_ALREADY_STARTED   - This driver is already running on DeviceHandle.
+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
+  @return other                 - This driver does not support this device.
 
-  EFI_SUCCESS           - This driver is added to DeviceHandle.
-  EFI_ALREADY_STARTED   - This driver is already running on DeviceHandle.
-  EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
-  other                 - This driver does not support this device.
-
---*/
+**/
+EFI_STATUS
+EFIAPI
+FatDriverBindingStart (
+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,
+  IN EFI_HANDLE                   ControllerHandle,
+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
+  )
 {
   EFI_STATUS            Status;
   EFI_BLOCK_IO_PROTOCOL *BlockIo;
   EFI_DISK_IO_PROTOCOL  *DiskIo;
   EFI_DISK_IO2_PROTOCOL *DiskIo2;
@@ -428,34 +396,31 @@ Exit:
     FatReleaseLock ();
   }
   return Status;
 }
 
+/**
+
+  Stop this driver on ControllerHandle.
+
+  @param  This                  - Protocol instance pointer.
+  @param  ControllerHandle      - Handle of device to stop driver on.
+  @param  NumberOfChildren      - Not used.
+  @param  ChildHandleBuffer     - Not used.
+
+  @retval EFI_SUCCESS           - This driver is removed DeviceHandle.
+  @return other                 - This driver was not removed from this device.
+
+**/
 EFI_STATUS
 EFIAPI
 FatDriverBindingStop (
   IN  EFI_DRIVER_BINDING_PROTOCOL   *This,
   IN  EFI_HANDLE                    ControllerHandle,
   IN  UINTN                         NumberOfChildren,
   IN  EFI_HANDLE                    *ChildHandleBuffer
   )
-/*++
-
-Routine Description:
-  Stop this driver on ControllerHandle.
-
-Arguments:
-  This                  - Protocol instance pointer.
-  ControllerHandle      - Handle of device to stop driver on.
-  NumberOfChildren      - Not used.
-  ChildHandleBuffer     - Not used.
-
-Returns:
-  EFI_SUCCESS           - This driver is removed DeviceHandle.
-  other                 - This driver was not removed from this device.
-
---*/
 {
   EFI_STATUS                      Status;
   EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem;
   FAT_VOLUME                      *Volume;
   EFI_DISK_IO2_PROTOCOL           *DiskIo2;
diff --git a/FatPkg/EnhancedFatDxe/Fat.h b/FatPkg/EnhancedFatDxe/Fat.h
index f49acee..9490868 100644
--- a/FatPkg/EnhancedFatDxe/Fat.h
+++ b/FatPkg/EnhancedFatDxe/Fat.h
@@ -1,28 +1,18 @@
-/*++
+/** @file
+  Main header file for EFI FAT file system driver.
 
 Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
-
-Module Name:
-
-  Fat.h
-
-Abstract:
-
-  Main header file for EFI FAT file system driver
-
-Revision History
-
---*/
+**/
 
 #ifndef _FAT_H_
 #define _FAT_H_
 
 #include <Uefi.h>
@@ -394,401 +384,321 @@ struct _FAT_VOLUME {
 };
 
 //
 // Function Prototypes
 //
+
+/**
+
+  Implements Open() of Simple File System Protocol.
+
+  @param  FHand                 - File handle of the file serves as a starting reference point.
+  @param  NewHandle             - Handle of the file that is newly opened.
+  @param  FileName              - File name relative to FHand.
+  @param  OpenMode              - Open mode.
+  @param  Attributes            - Attributes to set if the file is created.
+
+
+  @retval EFI_INVALID_PARAMETER - The FileName is NULL or the file string is empty.
+                          The OpenMode is not supported.
+                          The Attributes is not the valid attributes.
+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory for file string.
+  @retval EFI_SUCCESS           - Open the file successfully.
+  @return Others                - The status of open file.
+
+**/
 EFI_STATUS
 EFIAPI
 FatOpen (
   IN  EFI_FILE_PROTOCOL *FHand,
   OUT EFI_FILE_PROTOCOL **NewHandle,
   IN  CHAR16            *FileName,
   IN  UINT64            OpenMode,
   IN  UINT64            Attributes
   )
-/*++
-Routine Description:
-
-  Implements Open() of Simple File System Protocol.
+;
 
-Arguments:
+/**
 
-  FHand                 - File handle of the file serves as a starting reference point.
-  NewHandle             - Handle of the file that is newly opened.
-  FileName              - File name relative to FHand.
-  OpenMode              - Open mode.
-  Attributes            - Attributes to set if the file is created.
+  Implements OpenEx() of Simple File System Protocol.
 
-Returns:
+  @param  FHand                 - File handle of the file serves as a starting reference point.
+  @param  NewHandle             - Handle of the file that is newly opened.
+  @param  FileName              - File name relative to FHand.
+  @param  OpenMode              - Open mode.
+  @param  Attributes            - Attributes to set if the file is created.
+  @param  Token                 - A pointer to the token associated with the transaction.
 
-  EFI_INVALID_PARAMETER - The FileName is NULL or the file string is empty.
+  @retval EFI_INVALID_PARAMETER - The FileName is NULL or the file string is empty.
                           The OpenMode is not supported.
                           The Attributes is not the valid attributes.
-  EFI_OUT_OF_RESOURCES  - Can not allocate the memory for file string.
-  EFI_SUCCESS           - Open the file successfully.
-  Others                - The status of open file.
-
---*/
-;
+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory for file string.
+  @retval EFI_SUCCESS           - Open the file successfully.
+  @return Others                - The status of open file.
 
+**/
 EFI_STATUS
 EFIAPI
 FatOpenEx (
   IN  EFI_FILE_PROTOCOL       *FHand,
   OUT EFI_FILE_PROTOCOL       **NewHandle,
   IN  CHAR16                  *FileName,
   IN  UINT64                  OpenMode,
   IN  UINT64                  Attributes,
   IN OUT EFI_FILE_IO_TOKEN    *Token
   )
-/*++
-Routine Description:
-
-  Implements OpenEx() of Simple File System Protocol.
-
-Arguments:
+;
 
-  FHand                 - File handle of the file serves as a starting reference point.
-  NewHandle             - Handle of the file that is newly opened.
-  FileName              - File name relative to FHand.
-  OpenMode              - Open mode.
-  Attributes            - Attributes to set if the file is created.
-  Token                 - A pointer to the token associated with the transaction.
+/**
 
-Returns:
+  Get the file's position of the file
 
-  EFI_INVALID_PARAMETER - The FileName is NULL or the file string is empty.
-                          The OpenMode is not supported.
-                          The Attributes is not the valid attributes.
-  EFI_OUT_OF_RESOURCES  - Can not allocate the memory for file string.
-  EFI_SUCCESS           - Open the file successfully.
-  Others                - The status of open file.
+  @param  FHand                 - The handle of file.
+  @param  Position              - The file's position of the file.
 
---*/
-;
+  @retval EFI_SUCCESS           - Get the info successfully.
+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
+  @retval EFI_UNSUPPORTED       - The open file is not a file.
 
+**/
 EFI_STATUS
 EFIAPI
 FatGetPosition (
   IN  EFI_FILE_PROTOCOL *FHand,
   OUT UINT64            *Position
   )
-/*++
-
-Routine Description:
-
-  Get the file's position of the file
-
-Arguments:
+;
 
-  FHand                 - The handle of file.
-  Position              - The file's position of the file.
+/**
 
-Returns:
+  Get the some types info of the file into Buffer
 
-  EFI_SUCCESS           - Get the info successfully.
-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
-  EFI_UNSUPPORTED       - The open file is not a file.
+  @param  FHand                 - The handle of file.
+  @param  Type                  - The type of the info.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing volume info.
 
---*/
-;
+  @retval EFI_SUCCESS           - Get the info successfully.
+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
 
+**/
 EFI_STATUS
 EFIAPI
 FatGetInfo (
   IN     EFI_FILE_PROTOCOL      *FHand,
   IN     EFI_GUID               *Type,
   IN OUT UINTN                  *BufferSize,
      OUT VOID                   *Buffer
   )
-/*++
-
-Routine Description:
-
-  Get the some types info of the file into Buffer
-
-Arguments:
+;
 
-  FHand                 - The handle of file.
-  Type                  - The type of the info.
-  BufferSize            - Size of Buffer.
-  Buffer                - Buffer containing volume info.
+/**
 
-Returns:
+  Set the some types info of the file into Buffer.
 
-  EFI_SUCCESS           - Get the info successfully.
-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
+  @param  FHand                 - The handle of file.
+  @param  Type                  - The type of the info.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing volume info.
 
---*/
-;
+  @retval EFI_SUCCESS           - Set the info successfully.
+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
 
+**/
 EFI_STATUS
 EFIAPI
 FatSetInfo (
   IN EFI_FILE_PROTOCOL  *FHand,
   IN EFI_GUID           *Type,
   IN UINTN              BufferSize,
   IN VOID               *Buffer
   )
-/*++
-
-Routine Description:
-
-  Set the some types info of the file into Buffer
-
-Arguments:
+;
 
-  FHand                 - The handle of file.
-  Type                  - The type of the info.
-  BufferSize            - Size of Buffer.
-  Buffer                - Buffer containing volume info.
+/**
 
-Returns:
+  Flushes all data associated with the file handle.
 
-  EFI_SUCCESS           - Set the info successfully.
-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
+  @param  FHand                 - Handle to file to flush
 
---*/
-;
+  @retval EFI_SUCCESS           - Flushed the file successfully
+  @retval EFI_WRITE_PROTECTED   - The volume is read only
+  @retval EFI_ACCESS_DENIED     - The volume is not read only
+                          but the file is read only
+  @return Others                - Flushing of the file is failed
 
+**/
 EFI_STATUS
 EFIAPI
 FatFlush (
   IN EFI_FILE_PROTOCOL  *FHand
   )
-/*++
-
-Routine Description:
-
-  Flushes all data associated with the file handle
-
-Arguments:
+;
 
-  FHand                 - Handle to file to flush
+/**
 
-Returns:
+  Flushes all data associated with the file handle.
 
-  EFI_SUCCESS           - Flushed the file successfully
-  EFI_WRITE_PROTECTED   - The volume is read only
-  EFI_ACCESS_DENIED     - The volume is not read only
-                          but the file is read only
-  Others                - Flushing of the file is failed
+  @param  FHand                 - Handle to file to flush.
+  @param  Token                 - A pointer to the token associated with the transaction.
 
---*/
-;
+  @retval EFI_SUCCESS           - Flushed the file successfully.
+  @retval EFI_WRITE_PROTECTED   - The volume is read only.
+  @retval EFI_ACCESS_DENIED     - The file is read only.
+  @return Others                - Flushing of the file failed.
 
+**/
 EFI_STATUS
 EFIAPI
 FatFlushEx (
   IN EFI_FILE_PROTOCOL  *FHand,
   IN EFI_FILE_IO_TOKEN  *Token
   )
-/*++
-
-Routine Description:
-
-  Flushes all data associated with the file handle.
-
-Arguments:
+;
 
-  FHand                 - Handle to file to flush.
-  Token                 - A pointer to the token associated with the transaction.
+/**
 
-Returns:
+  Flushes & Closes the file handle.
 
-  EFI_SUCCESS           - Flushed the file successfully.
-  EFI_WRITE_PROTECTED   - The volume is read only.
-  EFI_ACCESS_DENIED     - The file is read only.
-  Others                - Flushing of the file failed.
+  @param  FHand                 - Handle to the file to delete.
 
---*/
-;
+  @retval EFI_SUCCESS           - Closed the file successfully.
 
+**/
 EFI_STATUS
 EFIAPI
 FatClose (
   IN EFI_FILE_PROTOCOL  *FHand
   )
-/*++
-
-Routine Description:
-
-  Flushes & Closes the file handle.
-
-Arguments:
+;
 
-  FHand                 - Handle to the file to delete.
+/**
 
-Returns:
+  Deletes the file & Closes the file handle.
 
-  EFI_SUCCESS           - Closed the file successfully.
+  @param  FHand                    - Handle to the file to delete.
 
---*/
-;
+  @retval EFI_SUCCESS              - Delete the file successfully.
+  @retval EFI_WARN_DELETE_FAILURE  - Fail to delete the file.
 
+**/
 EFI_STATUS
 EFIAPI
 FatDelete (
   IN EFI_FILE_PROTOCOL  *FHand
   )
-/*++
-
-Routine Description:
-
-  Deletes the file & Closes the file handle.
-
-Arguments:
+;
 
-  FHand                    - Handle to the file to delete.
+/**
 
-Returns:
+  Set the file's position of the file.
 
-  EFI_SUCCESS              - Delete the file successfully.
-  EFI_WARN_DELETE_FAILURE  - Fail to delete the file.
+  @param  FHand                 - The handle of file
+  @param  Position              - The file's position of the file
 
---*/
-;
+  @retval EFI_SUCCESS           - Set the info successfully
+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file
+  @retval EFI_UNSUPPORTED       - Set a directory with a not-zero position
 
+**/
 EFI_STATUS
 EFIAPI
 FatSetPosition (
   IN EFI_FILE_PROTOCOL  *FHand,
   IN UINT64             Position
   )
-/*++
-
-Routine Description:
-
-  Set the file's position of the file
+;
 
-Arguments:
+/**
 
-  FHand                 - The handle of file
-  Position              - The file's position of the file
+  Get the file info.
 
-Returns:
+  @param FHand                 - The handle of the file.
+  @param BufferSize            - Size of Buffer.
+  @param Buffer                - Buffer containing read data.
 
-  EFI_SUCCESS           - Set the info successfully
-  EFI_DEVICE_ERROR      - Can not find the OFile for the file
-  EFI_UNSUPPORTED       - Set a directory with a not-zero position
-
---*/
-;
+  @retval EFI_SUCCESS           - Get the file info successfully.
+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
+  @retval EFI_VOLUME_CORRUPTED  - The file type of open file is error.
+  @return other                 - An error occurred when operation the disk.
 
+**/
 EFI_STATUS
 EFIAPI
 FatRead (
   IN     EFI_FILE_PROTOCOL    *FHand,
   IN OUT UINTN                *BufferSize,
      OUT VOID                 *Buffer
   )
-/*++
+;
 
-Routine Description:
+/**
 
   Get the file info.
 
-Arguments:
-
-  FHand                 - The handle of the file.
-  BufferSize            - Size of Buffer.
-  Buffer                - Buffer containing read data.
+  @param FHand                 - The handle of the file.
+  @param Token                 - A pointer to the token associated with the transaction.
 
-Returns:
-
-  EFI_SUCCESS           - Get the file info successfully.
-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
-  EFI_VOLUME_CORRUPTED  - The file type of open file is error.
-  other                 - An error occurred when operation the disk.
-
---*/
-;
+  @retval EFI_SUCCESS           - Get the file info successfully.
+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
+  @retval EFI_VOLUME_CORRUPTED  - The file type of open file is error.
+  @return other                 - An error occurred when operation the disk.
 
+**/
 EFI_STATUS
 EFIAPI
 FatReadEx (
   IN     EFI_FILE_PROTOCOL  *FHand,
   IN OUT EFI_FILE_IO_TOKEN  *Token
   )
-/*++
-
-Routine Description:
-
-  Get the file info.
-
-Arguments:
+;
 
-  FHand                 - The handle of the file.
-  Token                 - A pointer to the token associated with the transaction.
+/**
 
-Returns:
+  Set the file info.
 
-  EFI_SUCCESS           - Get the file info successfully.
-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
-  EFI_VOLUME_CORRUPTED  - The file type of open file is error.
-  other                 - An error occurred when operation the disk.
+  @param  FHand                 - The handle of the file.
+  @param  BufferSize            - Size of Buffer.
+  @param Buffer                - Buffer containing write data.
 
---*/
-;
+  @retval EFI_SUCCESS           - Set the file info successfully.
+  @retval EFI_WRITE_PROTECTED   - The disk is write protected.
+  @retval EFI_ACCESS_DENIED     - The file is read-only.
+  @retval EFI_DEVICE_ERROR      - The OFile is not valid.
+  @retval EFI_UNSUPPORTED       - The open file is not a file.
+                        - The writing file size is larger than 4GB.
+  @return other                 - An error occurred when operation the disk.
 
+**/
 EFI_STATUS
 EFIAPI
 FatWrite (
   IN     EFI_FILE_PROTOCOL      *FHand,
   IN OUT UINTN                  *BufferSize,
   IN     VOID                   *Buffer
   )
-/*++
-
-Routine Description:
-
-  Set the file info.
+;
 
-Arguments:
+/**
 
-  FHand                 - The handle of the file.
-  BufferSize            - Size of Buffer.
-  Buffer                - Buffer containing write data.
+  Get the file info.
 
-Returns:
+  @param  FHand                 - The handle of the file.
+  @param  Token                 - A pointer to the token associated with the transaction.
 
-  EFI_SUCCESS           - Set the file info successfully.
-  EFI_WRITE_PROTECTED   - The disk is write protected.
-  EFI_ACCESS_DENIED     - The file is read-only.
-  EFI_DEVICE_ERROR      - The OFile is not valid.
-  EFI_UNSUPPORTED       - The open file is not a file.
-                        - The writing file size is larger than 4GB.
-  other                 - An error occurred when operation the disk.
-
---*/
-;
+  @retval EFI_SUCCESS           - Get the file info successfully.
+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
+  @retval EFI_VOLUME_CORRUPTED  - The file type of open file is error.
+  @return other                 - An error occurred when operation the disk.
 
+**/
 EFI_STATUS
 EFIAPI
 FatWriteEx (
   IN     EFI_FILE_PROTOCOL  *FHand,
   IN OUT EFI_FILE_IO_TOKEN  *Token
   )
-/*++
-
-Routine Description:
-
-  Get the file info.
-
-Arguments:
-
-  FHand                 - The handle of the file.
-  Token                 - A pointer to the token associated with the transaction.
-
-Returns:
-
-  EFI_SUCCESS           - Get the file info successfully.
-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
-  EFI_VOLUME_CORRUPTED  - The file type of open file is error.
-  other                 - An error occurred when operation the disk.
-
---*/
 ;
 
 //
 // DiskCache.c
 //
diff --git a/FatPkg/EnhancedFatDxe/FatFileSystem.h b/FatPkg/EnhancedFatDxe/FatFileSystem.h
index 3f89a34..a4d4405 100644
--- a/FatPkg/EnhancedFatDxe/FatFileSystem.h
+++ b/FatPkg/EnhancedFatDxe/FatFileSystem.h
@@ -1,6 +1,7 @@
-/*++
+/** @file
+  Definitions for on-disk FAT structures.
 
 Copyright (c) 2005, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
@@ -8,21 +9,11 @@ http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 
-Module Name:
-
-  FatFileSystem.h
-
-Abstract:
-
-  Definitions for on-disk FAT structures
-
-Revision History
-
---*/
+**/
 
 #ifndef _FATFILESYSTEM_H_
 #define _FATFILESYSTEM_H_
 
 #pragma pack(1)
diff --git a/FatPkg/EnhancedFatDxe/FileName.c b/FatPkg/EnhancedFatDxe/FileName.c
index f393aa6..8aa3745 100644
--- a/FatPkg/EnhancedFatDxe/FileName.c
+++ b/FatPkg/EnhancedFatDxe/FileName.c
@@ -1,55 +1,39 @@
-/*++
+/** @file
+  Functions for manipulating file names.
 
 Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
+**/
 
-Module Name:
-
-  FileName.c
-
-Abstract:
+#include "Fat.h"
 
-  Functions for manipulating file names
+/**
 
-Revision History
+  This function checks whether the input FileName is a valid 8.3 short name.
+  If the input FileName is a valid 8.3, the output is the 8.3 short name;
+  otherwise, the output is the base tag of 8.3 short name.
 
---*/
+  @param  FileName              - The input unicode filename.
+  @param  File8Dot3Name         - The output ascii 8.3 short name or base tag of 8.3 short name.
 
-#include "Fat.h"
+  @retval TRUE                  - The input unicode filename is a valid 8.3 short name.
+  @retval FALSE                 - The input unicode filename is not a valid 8.3 short name.
 
+**/
 BOOLEAN
 FatCheckIs8Dot3Name (
   IN  CHAR16    *FileName,
   OUT CHAR8     *File8Dot3Name
   )
-/*++
-
-Routine Description:
-
-  This function checks whether the input FileName is a valid 8.3 short name.
-  If the input FileName is a valid 8.3, the output is the 8.3 short name;
-  otherwise, the output is the base tag of 8.3 short name.
-
-Arguments:
-
-  FileName              - The input unicode filename.
-  File8Dot3Name         - The output ascii 8.3 short name or base tag of 8.3 short name.
-
-Returns:
-
-  TRUE                  - The input unicode filename is a valid 8.3 short name.
-  FALSE                 - The input unicode filename is not a valid 8.3 short name.
-
---*/
 {
   BOOLEAN PossibleShortName;
   CHAR16  *TempName;
   CHAR16  *ExtendName;
   CHAR16  *SeparateDot;
@@ -116,66 +100,52 @@ Returns:
   }
 
   return PossibleShortName;
 }
 
-STATIC
-UINTN
-FatTrimAsciiTrailingBlanks (
-  IN CHAR8        *Name,
-  IN UINTN        Len
-  )
-/*++
-
-Routine Description:
+/**
 
   Trim the trailing blanks of fat name.
 
-Arguments:
-
-  Name                  - The Char8 string needs to be trimed.
-  Len                   - The length of the fat name.
-
-Returns:
+  @param  Name                  - The Char8 string needs to be trimed.
+  @param  Len                   - The length of the fat name.
 
   The real length of the fat name after the trailing blanks are trimmed.
 
---*/
+**/
+STATIC
+UINTN
+FatTrimAsciiTrailingBlanks (
+  IN CHAR8        *Name,
+  IN UINTN        Len
+  )
 {
   while (Len > 0 && Name[Len - 1] == ' ') {
     Len--;
   }
 
   return Len;
 }
 
+/**
+
+  Convert the ascii fat name to the unicode string and strip trailing spaces,
+  and if necessary, convert the unicode string to lower case.
+
+  @param  FatName               - The Char8 string needs to be converted.
+  @param  Len                   - The length of the fat name.
+  @param  LowerCase             - Indicate whether to convert the string to lower case.
+  @param  Str                   - The result of the convertion.
+
+**/
 VOID
 FatNameToStr (
   IN  CHAR8            *FatName,
   IN  UINTN            Len,
   IN  UINTN            LowerCase,
   OUT CHAR16           *Str
   )
-/*++
-
-Routine Description:
-
-  Convert the ascii fat name to the unicode string and strip trailing spaces,
-  and if necessary, convert the unicode string to lower case.
-
-Arguments:
-
-  FatName               - The Char8 string needs to be converted.
-  Len                   - The length of the fat name.
-  LowerCase             - Indicate whether to convert the string to lower case.
-  Str                   - The result of the convertion.
-
-Returns:
-
-  None.
-
---*/
 {
   //
   // First, trim the trailing blanks
   //
   Len = FatTrimAsciiTrailingBlanks (FatName, Len);
@@ -190,31 +160,23 @@ Returns:
   if (LowerCase != 0) {
     FatStrLwr (Str);
   }
 }
 
+/**
+
+  This function generates 8Dot3 name from user specified name for a newly created file.
+
+  @param  Parent                - The parent directory.
+  @param  DirEnt                - The directory entry whose 8Dot3Name needs to be generated.
+
+**/
 VOID
 FatCreate8Dot3Name (
   IN FAT_OFILE    *Parent,
   IN FAT_DIRENT   *DirEnt
   )
-/*++
-
-Routine Description:
-
-  This function generates 8Dot3 name from user specified name for a newly created file.
-
-Arguments:
-
-  Parent                - The parent directory.
-  DirEnt                - The directory entry whose 8Dot3Name needs to be generated.
-
-Returns:
-
-  None.
-
---*/
 {
   CHAR8 *ShortName;
   CHAR8 *ShortNameChar;
   UINTN BaseTagLen;
   UINTN Index;
@@ -273,33 +235,27 @@ Returns:
       *ShortNameChar    = '1';
     }
   }
 }
 
-STATIC
-UINT8
-FatCheckNameCase (
-  IN CHAR16           *Str,
-  IN UINT8            InCaseFlag
-  )
-/*++
-
-Routine Description:
+/**
 
   Check the string is lower case or upper case
   and it is used by fatname to dir entry count
 
-Arguments:
-
-  Str                   - The string which needs to be checked.
-  InCaseFlag            - The input case flag which is returned when the string is lower case.
+  @param Str                   - The string which needs to be checked.
+  @param InCaseFlag            - The input case flag which is returned when the string is lower case.
 
-Returns:
+  @retval OutCaseFlag           - The output case flag.
 
-  OutCaseFlag           - The output case flag.
-
---*/
+**/
+STATIC
+UINT8
+FatCheckNameCase (
+  IN CHAR16           *Str,
+  IN UINT8            InCaseFlag
+  )
 {
   CHAR16  Buffer[FAT_MAIN_NAME_LEN + 1 + FAT_EXTEND_NAME_LEN + 1];
   UINT8   OutCaseFlag;
 
   //
@@ -326,29 +282,21 @@ Returns:
   }
 
   return OutCaseFlag;
 }
 
-VOID
-FatSetCaseFlag (
-  IN FAT_DIRENT   *DirEnt
-  )
-/*++
-
-Routine Description:
+/**
 
   Set the caseflag value for the directory entry.
 
-Arguments:
-
-  DirEnt                - The logical directory entry whose caseflag value is to be set.
-
-Returns:
-
-  None.
+  @param DirEnt                - The logical directory entry whose caseflag value is to be set.
 
---*/
+**/
+VOID
+FatSetCaseFlag (
+  IN FAT_DIRENT   *DirEnt
+  )
 {
   CHAR16  LfnBuffer[FAT_MAIN_NAME_LEN + 1 + FAT_EXTEND_NAME_LEN + 1];
   CHAR16  *TempCharPtr;
   CHAR16  *ExtendName;
   CHAR16  *FileNameCharPtr;
@@ -387,32 +335,25 @@ Returns:
     DirEnt->Entry.CaseFlag = 0;
     DirEnt->EntryCount++;
   }
 }
 
+/**
+
+  Convert the 8.3 ASCII fat name to cased Unicode string according to case flag.
+
+  @param  DirEnt                - The corresponding directory entry.
+  @param  FileString            - The output Unicode file name.
+  @param  FileStringMax           The max length of FileString.
+
+**/
 VOID
 FatGetFileNameViaCaseFlag (
   IN     FAT_DIRENT   *DirEnt,
   IN OUT CHAR16       *FileString,
   IN     UINTN        FileStringMax
   )
-/*++
-
-Routine Description:
-
-  Convert the 8.3 ASCII fat name to cased Unicode string according to case flag.
-
-Arguments:
-
-  DirEnt                - The corresponding directory entry.
-  FileString            - The output Unicode file name.
-
-Returns:
-
-  None.
-
---*/
 {
   UINT8   CaseFlag;
   CHAR8   *File8Dot3Name;
   CHAR16  TempExt[1 + FAT_EXTEND_NAME_LEN + 1];
   //
@@ -427,29 +368,23 @@ Returns:
     TempExt[0] = L'.';
     StrCatS (FileString, FileStringMax, TempExt);
   }
 }
 
-UINT8
-FatCheckSum (
-  IN CHAR8  *ShortNameString
-  )
-/*++
-
-Routine Description:
+/**
 
   Get the Check sum for a short name.
 
-Arguments:
+  @param  ShortNameString       - The short name for a file.
 
-  ShortNameString       - The short name for a file.
+  @retval Sum                   - UINT8 checksum.
 
-Returns:
-
-  Sum                   - UINT8 checksum.
-
---*/
+**/
+UINT8
+FatCheckSum (
+  IN CHAR8  *ShortNameString
+  )
 {
   UINTN ShortNameLen;
   UINT8 Sum;
   Sum = 0;
   for (ShortNameLen = FAT_NAME_LEN; ShortNameLen != 0; ShortNameLen--) {
@@ -457,33 +392,27 @@ Returns:
   }
 
   return Sum;
 }
 
-CHAR16 *
-FatGetNextNameComponent (
-  IN  CHAR16      *Path,
-  OUT CHAR16      *Name
-  )
-/*++
-
-Routine Description:
+/**
 
   Takes Path as input, returns the next name component
   in Name, and returns the position after Name (e.g., the
   start of the next name component)
 
-Arguments:
-
-  Path                  - The path of one file.
-  Name                  - The next name component in Path.
-
-Returns:
+  @param  Path                  - The path of one file.
+  @param  Name                  - The next name component in Path.
 
   The position after Name in the Path
 
---*/
+**/
+CHAR16 *
+FatGetNextNameComponent (
+  IN  CHAR16      *Path,
+  OUT CHAR16      *Name
+  )
 {
   while (*Path != 0 && *Path != PATH_NAME_SEPARATOR) {
     *Name++ = *Path++;
   }
   *Name = 0;
@@ -495,35 +424,28 @@ Returns:
   }
 
   return Path;
 }
 
-BOOLEAN
-FatFileNameIsValid (
-  IN  CHAR16  *InputFileName,
-  OUT CHAR16  *OutputFileName
-  )
-/*++
-
-Routine Description:
+/**
 
   Check whether the IFileName is valid long file name. If the IFileName is a valid
   long file name, then we trim the possible leading blanks and leading/trailing dots.
   the trimmed filename is stored in OutputFileName
 
-Arguments:
+  @param  InputFileName         - The input file name.
+  @param  OutputFileName        - The output file name.
 
-  InputFileName         - The input file name.
-  OutputFileName        - The output file name.
+  @retval TRUE                  - The InputFileName is a valid long file name.
+  @retval FALSE                 - The InputFileName is not a valid long file name.
 
-
-Returns:
-
-  TRUE                  - The InputFileName is a valid long file name.
-  FALSE                 - The InputFileName is not a valid long file name.
-
---*/
+**/
+BOOLEAN
+FatFileNameIsValid (
+  IN  CHAR16  *InputFileName,
+  OUT CHAR16  *OutputFileName
+  )
 {
   CHAR16  *TempNamePointer;
   CHAR16  TempChar;
   //
   // Trim Leading blanks
diff --git a/FatPkg/EnhancedFatDxe/FileSpace.c b/FatPkg/EnhancedFatDxe/FileSpace.c
index db44a33..1254cd6 100644
--- a/FatPkg/EnhancedFatDxe/FileSpace.c
+++ b/FatPkg/EnhancedFatDxe/FileSpace.c
@@ -1,6 +1,7 @@
-/*++
+/** @file
+  Routines dealing with disk spaces and FAT table entries.
 
 Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
@@ -8,47 +9,32 @@ http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 
-Module Name:
 
-  FileSpace.c
+**/
 
-Abstract:
+#include "Fat.h"
 
-  Routines dealing with disk spaces and FAT table entries
 
-Revision History
+/**
 
---*/
+  Get the FAT entry of the volume, which is identified with the Index.
 
-#include "Fat.h"
+  @param  Volume                - FAT file system volume.
+  @param  Index                 - The index of the FAT entry of the volume.
 
+  @return The buffer of the FAT entry
 
+**/
 STATIC
 VOID *
 FatLoadFatEntry (
   IN FAT_VOLUME       *Volume,
   IN UINTN            Index
   )
-/*++
-
-Routine Description:
-
-  Get the FAT entry of the volume, which is identified with the Index.
-
-Arguments:
-
-  Volume                - FAT file system volume.
-  Index                 - The index of the FAT entry of the volume.
-
-Returns:
-
-  The buffer of the FAT entry
-
---*/
 {
   UINTN       Pos;
   EFI_STATUS  Status;
 
   if (Index > (Volume->MaxCluster + 1)) {
@@ -87,32 +73,26 @@ Returns:
   }
 
   return &Volume->FatEntryBuffer;
 }
 
+/**
+
+  Get the FAT entry value of the volume, which is identified with the Index.
+
+  @param  Volume                - FAT file system volume.
+  @param  Index                 - The index of the FAT entry of the volume.
+
+  @return  The value of the FAT entry.
+
+**/
 STATIC
 UINTN
 FatGetFatEntry (
   IN FAT_VOLUME       *Volume,
   IN UINTN            Index
   )
-/*++
-
-Routine Description:
-
-  Get the FAT entry value of the volume, which is identified with the Index.
-
-Arguments:
-
-  Volume                - FAT file system volume.
-  Index                 - The index of the FAT entry of the volume.
-
-Returns:
-
-  The value of the FAT entry.
-
---*/
 {
   VOID    *Pos;
   UINT8   *En12;
   UINT16  *En16;
   UINT32  *En32;
@@ -145,36 +125,30 @@ Returns:
   }
 
   return Accum;
 }
 
+/**
+
+  Set the FAT entry value of the volume, which is identified with the Index.
+
+  @param  Volume                - FAT file system volume.
+  @param  Index                 - The index of the FAT entry of the volume.
+  @param  Value                 - The new value of the FAT entry.
+
+  @retval EFI_SUCCESS           - Set the new FAT entry value sucessfully.
+  @retval EFI_VOLUME_CORRUPTED  - The FAT type of the volume is error.
+  @return other                 - An error occurred when operation the FAT entries.
+
+**/
 STATIC
 EFI_STATUS
 FatSetFatEntry (
   IN FAT_VOLUME       *Volume,
   IN UINTN            Index,
   IN UINTN            Value
   )
-/*++
-
-Routine Description:
-
-  Set the FAT entry value of the volume, which is identified with the Index.
-
-Arguments:
-
-  Volume                - FAT file system volume.
-  Index                 - The index of the FAT entry of the volume.
-  Value                 - The new value of the FAT entry.
-
-Returns:
-
-  EFI_SUCCESS           - Set the new FAT entry value sucessfully.
-  EFI_VOLUME_CORRUPTED  - The FAT type of the volume is error.
-  other                 - An error occurred when operation the FAT entries.
-
---*/
 {
   VOID        *Pos;
   UINT8       *En12;
   UINT16      *En16;
   UINT32      *En32;
@@ -251,33 +225,27 @@ Returns:
              NULL
              );
   return Status;
 }
 
+/**
+
+  Free the cluster clain.
+
+  @param  Volume                - FAT file system volume.
+  @param  Cluster               - The first cluster of cluster chain.
+
+  @retval EFI_SUCCESS           - The cluster chain is freed successfully.
+  @retval EFI_VOLUME_CORRUPTED  - There are errors in the file's clusters.
+
+**/
 STATIC
 EFI_STATUS
 FatFreeClusters (
   IN FAT_VOLUME           *Volume,
   IN UINTN                Cluster
   )
-/*++
-
-Routine Description:
-
-  Free the cluster clain.
-
-Arguments:
-
-  Volume                - FAT file system volume.
-  Cluster               - The first cluster of cluster chain.
-
-Returns:
-
-  EFI_SUCCESS           - The cluster chain is freed successfully.
-  EFI_VOLUME_CORRUPTED  - There are errors in the file's clusters.
-
---*/
 {
   UINTN LastCluster;
 
   while (!FAT_END_OF_FAT_CHAIN (Cluster)) {
     if (Cluster == FAT_CLUSTER_FREE || Cluster >= FAT_CLUSTER_SPECIAL) {
@@ -292,30 +260,24 @@ Returns:
   }
 
   return EFI_SUCCESS;
 }
 
-STATIC
-UINTN
-FatAllocateCluster (
-  IN FAT_VOLUME   *Volume
-  )
-/*++
-
-Routine Description:
+/**
 
   Allocate a free cluster and return the cluster index.
 
-Arguments:
-
-  Volume                - FAT file system volume.
+  @param  Volume                - FAT file system volume.
 
-Returns:
+  @return The index of the free cluster
 
-  The index of the free cluster
-
---*/
+**/
+STATIC
+UINTN
+FatAllocateCluster (
+  IN FAT_VOLUME   *Volume
+  )
 {
   UINTN Cluster;
 
   //
   // Start looking at FatFreePos for the next unallocated cluster
@@ -352,32 +314,26 @@ Returns:
   Cluster = Volume->FatInfoSector.FreeInfo.NextCluster;
   Volume->FatInfoSector.FreeInfo.NextCluster += 1;
   return Cluster;
 }
 
+/**
+
+  Count the number of clusters given a size.
+
+  @param  Volume                - The file system volume.
+  @param  Size                  - The size in bytes.
+
+  @return The number of the clusters.
+
+**/
 STATIC
 UINTN
 FatSizeToClusters (
   IN FAT_VOLUME       *Volume,
   IN UINTN            Size
   )
-/*++
-
-Routine Description:
-
-  Count the number of clusters given a size
-
-Arguments:
-
-  Volume                - The file system volume.
-  Size                  - The size in bytes.
-
-Returns:
-
-  The number of the clusters.
-
---*/
 {
   UINTN Clusters;
 
   Clusters = Size >> Volume->ClusterAlignment;
   if ((Size & (Volume->ClusterSize - 1)) > 0) {
@@ -385,30 +341,24 @@ Returns:
   }
 
   return Clusters;
 }
 
-EFI_STATUS
-FatShrinkEof (
-  IN FAT_OFILE            *OFile
-  )
-/*++
-
-Routine Description:
+/**
 
   Shrink the end of the open file base on the file size.
 
-Arguments:
-
-  OFile                 - The open file.
+  @param  OFile                 - The open file.
 
-Returns:
+  @retval EFI_SUCCESS           - Shrinked sucessfully.
+  @retval EFI_VOLUME_CORRUPTED  - There are errors in the file's clusters.
 
-  EFI_SUCCESS           - Shrinked sucessfully.
-  EFI_VOLUME_CORRUPTED  - There are errors in the file's clusters.
-
---*/
+**/
+EFI_STATUS
+FatShrinkEof (
+  IN FAT_OFILE            *OFile
+  )
 {
   FAT_VOLUME  *Volume;
   UINTN       NewSize;
   UINTN       CurSize;
   UINTN       Cluster;
@@ -463,34 +413,28 @@ Returns:
   // Free the remaining cluster chain
   //
   return FatFreeClusters (Volume, Cluster);
 }
 
-EFI_STATUS
-FatGrowEof (
-  IN FAT_OFILE            *OFile,
-  IN UINT64               NewSizeInBytes
-  )
-/*++
-
-Routine Description:
+/**
 
   Grow the end of the open file base on the NewSizeInBytes.
 
-Arguments:
-
-  OFile                 - The open file.
-  NewSizeInBytes        - The new size in bytes of the open file.
+  @param  OFile                 - The open file.
+  @param  NewSizeInBytes        - The new size in bytes of the open file.
 
-Returns:
+  @retval EFI_SUCCESS           - The file is grown sucessfully.
+  @retval EFI_UNSUPPORTED       - The file size is larger than 4GB.
+  @retval EFI_VOLUME_CORRUPTED  - There are errors in the files' clusters.
+  @retval EFI_VOLUME_FULL       - The volume is full and can not grow the file.
 
-  EFI_SUCCESS           - The file is grown sucessfully.
-  EFI_UNSUPPORTED       - The file size is larger than 4GB.
-  EFI_VOLUME_CORRUPTED  - There are errors in the files' clusters.
-  EFI_VOLUME_FULL       - The volume is full and can not grow the file.
-
---*/
+**/
+EFI_STATUS
+FatGrowEof (
+  IN FAT_OFILE            *OFile,
+  IN UINT64               NewSizeInBytes
+  )
 {
   FAT_VOLUME  *Volume;
   EFI_STATUS  Status;
   UINTN       Cluster;
   UINTN       CurSize;
@@ -589,35 +533,29 @@ Returns:
 Done:
   FatShrinkEof (OFile);
   return Status;
 }
 
-EFI_STATUS
-FatOFilePosition (
-  IN FAT_OFILE            *OFile,
-  IN UINTN                Position,
-  IN UINTN                PosLimit
-  )
-/*++
-
-Routine Description:
+/**
 
   Seek OFile to requested position, and calculate the number of
   consecutive clusters from the position in the file
 
-Arguments:
-
-  OFile                 - The open file.
-  Position              - The file's position which will be accessed.
-  PosLimit              - The maximum length current reading/writing may access
+  @param  OFile                 - The open file.
+  @param  Position              - The file's position which will be accessed.
+  @param  PosLimit              - The maximum length current reading/writing may access
 
-Returns:
+  @retval EFI_SUCCESS           - Set the info successfully.
+  @retval EFI_VOLUME_CORRUPTED  - Cluster chain corrupt.
 
-  EFI_SUCCESS           - Set the info successfully.
-  EFI_VOLUME_CORRUPTED  - Cluster chain corrupt.
-
---*/
+**/
+EFI_STATUS
+FatOFilePosition (
+  IN FAT_OFILE            *OFile,
+  IN UINTN                Position,
+  IN UINTN                PosLimit
+  )
 {
   FAT_VOLUME  *Volume;
   UINTN       ClusterSize;
   UINTN       Cluster;
   UINTN       StartPos;
@@ -689,32 +627,26 @@ Returns:
 
   OFile->PosRem = Run;
   return EFI_SUCCESS;
 }
 
-UINTN
-FatPhysicalDirSize (
-  IN FAT_VOLUME            *Volume,
-  IN UINTN                 Cluster
-  )
-/*++
-
-Routine Description:
-
- Get the size of directory of the open file
+/**
 
-Arguments:
+  Get the size of directory of the open file.
 
-  Volume                - The File System Volume.
-  Cluster               - The Starting cluster.
+  @param  Volume                - The File System Volume.
+  @param  Cluster               - The Starting cluster.
 
-Returns:
-
-  The physical size of the file starting at the input cluster, if there is error in the
+  @return The physical size of the file starting at the input cluster, if there is error in the
   cluster chain, the return value is 0.
 
---*/
+**/
+UINTN
+FatPhysicalDirSize (
+  IN FAT_VOLUME            *Volume,
+  IN UINTN                 Cluster
+  )
 {
   UINTN Size;
   ASSERT_VOLUME_LOCKED (Volume);
   //
   // Run the cluster chain for the OFile
@@ -740,58 +672,44 @@ Returns:
   }
 
   return Size;
 }
 
+/**
+
+  Get the physical size of a file on the disk.
+
+  @param  Volume                - The file system volume.
+  @param  RealSize              - The real size of a file.
+
+  @return The physical size of a file on the disk.
+
+**/
 UINT64
 FatPhysicalFileSize (
   IN FAT_VOLUME            *Volume,
   IN UINTN                 RealSize
   )
-/*++
-
-Routine Description:
-
- Get the physical size of a file on the disk.
-
-Arguments:
-
-  Volume                - The file system volume.
-  RealSize              - The real size of a file.
-
-Returns:
-
-  The physical size of a file on the disk.
-
---*/
 {
   UINTN   ClusterSizeMask;
   UINT64  PhysicalSize;
   ClusterSizeMask = Volume->ClusterSize - 1;
   PhysicalSize    = (RealSize + ClusterSizeMask) & (~((UINT64) ClusterSizeMask));
   return PhysicalSize;
 }
 
-VOID
-FatComputeFreeInfo (
-  IN FAT_VOLUME *Volume
-  )
-/*++
-
-Routine Description:
+/**
 
   Update the free cluster info of FatInfoSector of the volume.
 
-Arguments:
-
-  Volume                - FAT file system volume.
-
-Returns:
-
-  None.
+  @param  Volume                - FAT file system volume.
 
---*/
+**/
+VOID
+FatComputeFreeInfo (
+  IN FAT_VOLUME *Volume
+  )
 {
   UINTN Index;
 
   //
   // If we don't have valid info, compute it now
diff --git a/FatPkg/EnhancedFatDxe/Flush.c b/FatPkg/EnhancedFatDxe/Flush.c
index 172f202..9cb0d9a 100644
--- a/FatPkg/EnhancedFatDxe/Flush.c
+++ b/FatPkg/EnhancedFatDxe/Flush.c
@@ -1,6 +1,7 @@
-/*++
+/** @file
+  Routines that check references and flush OFiles
 
 Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
@@ -8,49 +9,33 @@ http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 
-Module Name:
-
-  flush.c
+**/
 
-Abstract:
+#include "Fat.h"
 
-  Routines that check references and flush OFiles
+/**
 
-Revision History
+  Flushes all data associated with the file handle.
 
---*/
+  @param  FHand                 - Handle to file to flush.
+  @param  Token                 - A pointer to the token associated with the transaction.
 
-#include "Fat.h"
+  @retval EFI_SUCCESS           - Flushed the file successfully.
+  @retval EFI_WRITE_PROTECTED   - The volume is read only.
+  @retval EFI_ACCESS_DENIED     - The file is read only.
+  @return Others                - Flushing of the file failed.
 
+**/
 EFI_STATUS
 EFIAPI
 FatFlushEx (
   IN EFI_FILE_PROTOCOL  *FHand,
   IN EFI_FILE_IO_TOKEN  *Token
   )
-/*++
-
-Routine Description:
-
-  Flushes all data associated with the file handle.
-
-Arguments:
-
-  FHand                 - Handle to file to flush.
-  Token                 - A pointer to the token associated with the transaction.
-
-Returns:
-
-  EFI_SUCCESS           - Flushed the file successfully.
-  EFI_WRITE_PROTECTED   - The volume is read only.
-  EFI_ACCESS_DENIED     - The file is read only.
-  Others                - Flushing of the file failed.
-
---*/
 {
   FAT_IFILE   *IFile;
   FAT_OFILE   *OFile;
   FAT_VOLUME  *Volume;
   EFI_STATUS  Status;
@@ -111,57 +96,45 @@ Returns:
   }
 
   return Status;
 }
 
-EFI_STATUS
-EFIAPI
-FatFlush (
-  IN EFI_FILE_PROTOCOL  *FHand
-  )
-/*++
-
-Routine Description:
+/**
 
   Flushes all data associated with the file handle.
 
-Arguments:
-
-  FHand                 - Handle to file to flush.
-
-Returns:
+  @param  FHand                 - Handle to file to flush.
 
-  EFI_SUCCESS           - Flushed the file successfully.
-  EFI_WRITE_PROTECTED   - The volume is read only.
-  EFI_ACCESS_DENIED     - The file is read only.
-  Others                - Flushing of the file failed.
-
---*/
-{
-  return FatFlushEx (FHand, NULL);
-}
+  @retval EFI_SUCCESS           - Flushed the file successfully.
+  @retval EFI_WRITE_PROTECTED   - The volume is read only.
+  @retval EFI_ACCESS_DENIED     - The file is read only.
+  @return Others                - Flushing of the file failed.
 
+**/
 EFI_STATUS
 EFIAPI
-FatClose (
+FatFlush (
   IN EFI_FILE_PROTOCOL  *FHand
   )
-/*++
+{
+  return FatFlushEx (FHand, NULL);
+}
 
-Routine Description:
+/**
 
   Flushes & Closes the file handle.
 
-Arguments:
-
-  FHand                 - Handle to the file to delete.
-
-Returns:
+  @param  FHand                 - Handle to the file to delete.
 
-  EFI_SUCCESS           - Closed the file successfully.
+  @retval EFI_SUCCESS           - Closed the file successfully.
 
---*/
+**/
+EFI_STATUS
+EFIAPI
+FatClose (
+  IN EFI_FILE_PROTOCOL  *FHand
+  )
 {
   FAT_IFILE   *IFile;
   FAT_OFILE   *OFile;
   FAT_VOLUME  *Volume;
 
@@ -189,29 +162,23 @@ Returns:
   // Close always succeed
   //
   return EFI_SUCCESS;
 }
 
-EFI_STATUS
-FatIFileClose (
-  FAT_IFILE           *IFile
-  )
-/*++
-
-Routine Description:
+/**
 
   Close the open file instance.
 
-Arguments:
+  @param  IFile                 - Open file instance.
 
-  IFile                 - Open file instance.
+  @retval EFI_SUCCESS           - Closed the file successfully.
 
-Returns:
-
-  EFI_SUCCESS           - Closed the file successfully.
-
---*/
+**/
+EFI_STATUS
+FatIFileClose (
+  FAT_IFILE           *IFile
+  )
 {
   FAT_OFILE   *OFile;
   FAT_VOLUME  *Volume;
 
   OFile   = IFile->OFile;
@@ -237,31 +204,25 @@ Returns:
   //
   FreePool (IFile);
   return EFI_SUCCESS;
 }
 
-EFI_STATUS
-FatOFileFlush (
-  IN FAT_OFILE    *OFile
-  )
-/*++
-
-Routine Description:
+/**
 
   Flush the data associated with an open file.
   In this implementation, only last Mod/Access time is updated.
 
-Arguments:
+  @param  OFile                 - The open file.
 
-  OFile                 - The open file.
+  @retval EFI_SUCCESS           - The OFile is flushed successfully.
+  @return Others                - An error occurred when flushing this OFile.
 
-Returns:
-
-  EFI_SUCCESS           - The OFile is flushed successfully.
-  Others                - An error occurred when flushing this OFile.
-
---*/
+**/
+EFI_STATUS
+FatOFileFlush (
+  IN FAT_OFILE    *OFile
+  )
 {
   EFI_STATUS    Status;
   FAT_OFILE     *Parent;
   FAT_DIRENT    *DirEnt;
   FAT_DATE_TIME FatNow;
@@ -316,32 +277,26 @@ Returns:
     OFile = Parent;
   } while (OFile != NULL);
   return EFI_SUCCESS;
 }
 
-BOOLEAN
-FatCheckOFileRef (
-  IN FAT_OFILE   *OFile
-  )
-/*++
-
-Routine Description:
+/**
 
   Check the references of the OFile.
   If the OFile (that is checked) is no longer
   referenced, then it is freed.
 
-Arguments:
+  @param  OFile                 - The OFile to be checked.
 
-  OFile                 - The OFile to be checked.
+  @retval TRUE                  - The OFile is not referenced and freed.
+  @retval FALSE                 - The OFile is kept.
 
-Returns:
-
-  TRUE                  - The OFile is not referenced and freed.
-  FALSE                 - The OFile is kept.
-
---*/
+**/
+BOOLEAN
+FatCheckOFileRef (
+  IN FAT_OFILE   *OFile
+  )
 {
   //
   // If the OFile is on the check ref list, remove it
   //
   if (OFile->CheckLink.ForwardLink != NULL) {
@@ -364,33 +319,25 @@ Returns:
   //
   FatCloseDirEnt (OFile->DirEnt);
   return TRUE;
 }
 
-STATIC
-VOID
-FatCheckVolumeRef (
-  IN FAT_VOLUME   *Volume
-  )
-/*++
-
-Routine Description:
+/**
 
   Check the references of all open files on the volume.
   Any open file (that is checked) that is no longer
   referenced, is freed - and it's parent open file
   is then referenced checked.
 
-Arguments:
-
-  Volume                - The volume to check the pending open file list.
-
-Returns:
+  @param  Volume                - The volume to check the pending open file list.
 
-  None
-
---*/
+**/
+STATIC
+VOID
+FatCheckVolumeRef (
+  IN FAT_VOLUME   *Volume
+  )
 {
   FAT_OFILE *OFile;
   FAT_OFILE *Parent;
 
   //
@@ -412,38 +359,33 @@ Returns:
       }
     }
   }
 }
 
-EFI_STATUS
-FatCleanupVolume (
-  IN FAT_VOLUME       *Volume,
-  IN FAT_OFILE        *OFile,
-  IN EFI_STATUS       EfiStatus,
-  IN FAT_TASK         *Task
-  )
-/*++
-
-Routine Description:
+/**
 
   Set error status for a specific OFile, reference checking the volume.
   If volume is already marked as invalid, and all resources are freed
   after reference checking, the file system protocol is uninstalled and
   the volume structure is freed.
 
-Arguments:
+  @param  Volume                - the Volume that is to be reference checked and unlocked.
+  @param  OFile                 - the OFile whose permanent error code is to be set.
+  @param  EfiStatus             - error code to be set.
+  @param  Task                    point to task instance.
 
-  Volume                - the Volume that is to be reference checked and unlocked.
-  OFile                 - the OFile whose permanent error code is to be set.
-  EfiStatus             - error code to be set.
+  @retval EFI_SUCCESS           - Clean up the volume successfully.
+  @return Others                - Cleaning up of the volume is failed.
 
-Returns:
-
-  EFI_SUCCESS           - Clean up the volume successfully.
-  Others                - Cleaning up of the volume is failed.
-
---*/
+**/
+EFI_STATUS
+FatCleanupVolume (
+  IN FAT_VOLUME       *Volume,
+  IN FAT_OFILE        *OFile,
+  IN EFI_STATUS       EfiStatus,
+  IN FAT_TASK         *Task
+  )
 {
   EFI_STATUS  Status;
   //
   // Flag the OFile
   //
@@ -497,31 +439,23 @@ Returns:
   }
 
   return EfiStatus;
 }
 
+/**
+
+  Set the OFile and its child OFile with the error Status
+
+  @param  OFile                 - The OFile whose permanent error code is to be set.
+  @param  Status                - Error code to be set.
+
+**/
 VOID
 FatSetVolumeError (
   IN FAT_OFILE            *OFile,
   IN EFI_STATUS           Status
   )
-/*++
-
-Routine Description:
-
-  Set the OFile and its child OFile with the error Status
-
-Arguments:
-
-  OFile                 - The OFile whose permanent error code is to be set.
-  Status                - Error code to be set.
-
-Returns:
-
-  None
-
---*/
 {
   LIST_ENTRY      *Link;
   FAT_OFILE       *ChildOFile;
 
   //
diff --git a/FatPkg/EnhancedFatDxe/Hash.c b/FatPkg/EnhancedFatDxe/Hash.c
index f827368..5a9bbda 100644
--- a/FatPkg/EnhancedFatDxe/Hash.c
+++ b/FatPkg/EnhancedFatDxe/Hash.c
@@ -1,51 +1,35 @@
-/*++
+/** @file
+  Hash table operations.
 
 Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
+**/
 
-Module Name:
-
-  Hash.c
-
-Abstract:
+#include "Fat.h"
 
-  Hash table operations
+/**
 
-Revision History
+  Get hash value for long name.
 
---*/
+  @param  LongNameString        - The long name string to be hashed.
 
-#include "Fat.h"
+  @return HashValue.
 
+**/
 STATIC
 UINT32
 FatHashLongName (
   IN CHAR16   *LongNameString
   )
-/*++
-
-Routine Description:
-
-  Get hash value for long name.
-
-Arguments:
-
-  LongNameString        - The long name string to be hashed.
-
-Returns:
-
-  HashValue.
-
---*/
 {
   UINT32  HashValue;
   CHAR16  UpCasedLongFileName[EFI_PATH_STRING_LENGTH];
   StrnCpyS (
     UpCasedLongFileName,
@@ -56,57 +40,45 @@ Returns:
   FatStrUpr (UpCasedLongFileName);
   gBS->CalculateCrc32 (UpCasedLongFileName, StrSize (UpCasedLongFileName), &HashValue);
   return (HashValue & HASH_TABLE_MASK);
 }
 
-STATIC
-UINT32
-FatHashShortName (
-  IN CHAR8   *ShortNameString
-  )
-/*++
-
-Routine Description:
+/**
 
   Get hash value for short name.
 
-Arguments:
+  @param  ShortNameString       - The short name string to be hashed.
 
-  ShortNameString       - The short name string to be hashed.
+  @return HashValue
 
-Returns:
-
-  HashValue
-
---*/
+**/
+STATIC
+UINT32
+FatHashShortName (
+  IN CHAR8   *ShortNameString
+  )
 {
   UINT32  HashValue;
   gBS->CalculateCrc32 (ShortNameString, FAT_NAME_LEN, &HashValue);
   return (HashValue & HASH_TABLE_MASK);
 }
 
-FAT_DIRENT **
-FatLongNameHashSearch (
-  IN FAT_ODIR       *ODir,
-  IN CHAR16         *LongNameString
-  )
-/*++
-
-Routine Description:
+/**
 
   Search the long name hash table for the directory entry.
 
-Arguments:
-
-  ODir                  - The directory to be searched.
-  LongNameString        - The long name string to search.
-
-Returns:
+  @param  ODir                  - The directory to be searched.
+  @param  LongNameString        - The long name string to search.
 
-  The previous long name hash node of the directory entry.
+  @return The previous long name hash node of the directory entry.
 
---*/
+**/
+FAT_DIRENT **
+FatLongNameHashSearch (
+  IN FAT_ODIR       *ODir,
+  IN CHAR16         *LongNameString
+  )
 {
   FAT_DIRENT  **PreviousHashNode;
   for (PreviousHashNode   = &ODir->LongNameHashTable[FatHashLongName (LongNameString)];
        *PreviousHashNode != NULL;
        PreviousHashNode   = &(*PreviousHashNode)->LongNameForwardLink
@@ -117,31 +89,25 @@ Returns:
   }
 
   return PreviousHashNode;
 }
 
-FAT_DIRENT **
-FatShortNameHashSearch (
-  IN FAT_ODIR      *ODir,
-  IN CHAR8         *ShortNameString
-  )
-/*++
-
-Routine Description:
+/**
 
   Search the short name hash table for the directory entry.
 
-Arguments:
-
-  ODir                  - The directory to be searched.
-  ShortNameString       - The short name string to search.
+  @param  ODir                  - The directory to be searched.
+  @param  ShortNameString       - The short name string to search.
 
-Returns:
+  @return The previous short name hash node of the directory entry.
 
-  The previous short name hash node of the directory entry.
-
---*/
+**/
+FAT_DIRENT **
+FatShortNameHashSearch (
+  IN FAT_ODIR      *ODir,
+  IN CHAR8         *ShortNameString
+  )
 {
   FAT_DIRENT  **PreviousHashNode;
   for (PreviousHashNode   = &ODir->ShortNameHashTable[FatHashShortName (ShortNameString)];
        *PreviousHashNode != NULL;
        PreviousHashNode   = &(*PreviousHashNode)->ShortNameForwardLink
@@ -152,31 +118,23 @@ Returns:
   }
 
   return PreviousHashNode;
 }
 
+/**
+
+  Insert directory entry to hash table.
+
+  @param  ODir                  - The parent directory.
+  @param  DirEnt                - The directory entry node.
+
+**/
 VOID
 FatInsertToHashTable (
   IN FAT_ODIR     *ODir,
   IN FAT_DIRENT   *DirEnt
   )
-/*++
-
-Routine Description:
-
-  Insert directory entry to hash table.
-
-Arguments:
-
-  ODir                  - The parent directory.
-  DirEnt                - The directory entry node.
-
-Returns:
-
-  None.
-
---*/
 {
   FAT_DIRENT  **HashTable;
   UINT32      HashTableIndex;
 
   //
@@ -193,30 +151,22 @@ Returns:
   HashTable                     = ODir->LongNameHashTable;
   DirEnt->LongNameForwardLink   = HashTable[HashTableIndex];
   HashTable[HashTableIndex]     = DirEnt;
 }
 
+/**
+
+  Delete directory entry from hash table.
+
+  @param  ODir                  - The parent directory.
+  @param  DirEnt                - The directory entry node.
+
+**/
 VOID
 FatDeleteFromHashTable (
   IN FAT_ODIR     *ODir,
   IN FAT_DIRENT   *DirEnt
   )
-/*++
-
-Routine Description:
-
-  Delete directory entry from hash table.
-
-Arguments:
-
-  ODir                  - The parent directory.
-  DirEnt                - The directory entry node.
-
-Returns:
-
-  None.
-
---*/
 {
   *FatShortNameHashSearch (ODir, DirEnt->Entry.FileName) = DirEnt->ShortNameForwardLink;
   *FatLongNameHashSearch (ODir, DirEnt->FileString)      = DirEnt->LongNameForwardLink;
 }
diff --git a/FatPkg/EnhancedFatDxe/Info.c b/FatPkg/EnhancedFatDxe/Info.c
index aa1b0f2..1a7f828 100644
--- a/FatPkg/EnhancedFatDxe/Info.c
+++ b/FatPkg/EnhancedFatDxe/Info.c
@@ -1,6 +1,7 @@
-/*++
+/** @file
+  Routines dealing with setting/getting file/volume info
 
 Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
@@ -8,21 +9,12 @@ http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 
-Module Name:
-
-  Info.c
-
-Abstract:
-
-  Routines dealing with setting/getting file/volume info
-
-Revision History
 
---*/
+**/
 
 #include "Fat.h"
 
 EFI_STATUS
 FatGetVolumeInfo (
@@ -45,62 +37,50 @@ FatSetOrGetInfo (
   IN EFI_GUID             *Type,
   IN OUT UINTN            *BufferSize,
   IN OUT VOID             *Buffer
   );
 
+/**
+
+  Get the open file's info into Buffer.
+
+  @param  OFile                 - The open file.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing file info.
+
+  @retval EFI_SUCCESS           - Get the file info successfully.
+  @retval EFI_BUFFER_TOO_SMALL  - The buffer is too small.
+
+**/
 EFI_STATUS
 FatGetFileInfo (
   IN FAT_OFILE        *OFile,
   IN OUT UINTN        *BufferSize,
   OUT VOID            *Buffer
   )
-/*++
-
-Routine Description:
-
-  Get the open file's info into Buffer.
-
-Arguments:
+{
+  return FatGetDirEntInfo (OFile->Volume, OFile->DirEnt, BufferSize, Buffer);
+}
 
-  OFile                 - The open file.
-  BufferSize            - Size of Buffer.
-  Buffer                - Buffer containing file info.
+/**
 
-Returns:
+  Get the volume's info into Buffer.
 
-  EFI_SUCCESS           - Get the file info successfully.
-  EFI_BUFFER_TOO_SMALL  - The buffer is too small.
+  @param  Volume                - FAT file system volume.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing volume info.
 
---*/
-{
-  return FatGetDirEntInfo (OFile->Volume, OFile->DirEnt, BufferSize, Buffer);
-}
+  @retval EFI_SUCCESS           - Get the volume info successfully.
+  @retval EFI_BUFFER_TOO_SMALL  - The buffer is too small.
 
+**/
 EFI_STATUS
 FatGetVolumeInfo (
   IN     FAT_VOLUME     *Volume,
   IN OUT UINTN          *BufferSize,
      OUT VOID           *Buffer
   )
-/*++
-
-Routine Description:
-
-  Get the volume's info into Buffer.
-
-Arguments:
-
-  Volume                - FAT file system volume.
-  BufferSize            - Size of Buffer.
-  Buffer                - Buffer containing volume info.
-
-Returns:
-
-  EFI_SUCCESS           - Get the volume info successfully.
-  EFI_BUFFER_TOO_SMALL  - The buffer is too small.
-
---*/
 {
   UINTN                 Size;
   UINTN                 NameSize;
   UINTN                 ResultSize;
   CHAR16                Name[FAT_NAME_LEN + 1];
@@ -139,34 +119,28 @@ Returns:
 
   *BufferSize = ResultSize;
   return Status;
 }
 
+/**
+
+  Get the volume's label info into Buffer.
+
+  @param  Volume                - FAT file system volume.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing volume's label info.
+
+  @retval EFI_SUCCESS           - Get the volume's label info successfully.
+  @retval EFI_BUFFER_TOO_SMALL  - The buffer is too small.
+
+**/
 EFI_STATUS
 FatGetVolumeLabelInfo (
   IN FAT_VOLUME       *Volume,
   IN OUT UINTN        *BufferSize,
   OUT VOID            *Buffer
   )
-/*++
-
-Routine Description:
-
-  Get the volume's label info into Buffer.
-
-Arguments:
-
-  Volume                - FAT file system volume.
-  BufferSize            - Size of Buffer.
-  Buffer                - Buffer containing volume's label info.
-
-Returns:
-
-  EFI_SUCCESS           - Get the volume's label info successfully.
-  EFI_BUFFER_TOO_SMALL  - The buffer is too small.
-
---*/
 {
   UINTN                             Size;
   UINTN                             NameSize;
   UINTN                             ResultSize;
   CHAR16                            Name[FAT_NAME_LEN + 1];
@@ -185,36 +159,30 @@ Returns:
 
   *BufferSize = ResultSize;
   return Status;
 }
 
+/**
+
+  Set the volume's info.
+
+  @param  Volume                - FAT file system volume.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing the new volume info.
+
+  @retval EFI_SUCCESS           - Set the volume info successfully.
+  @retval EFI_BAD_BUFFER_SIZE   - The buffer size is error.
+  @retval EFI_WRITE_PROTECTED   - The volume is read only.
+  @return other                 - An error occurred when operation the disk.
+
+**/
 EFI_STATUS
 FatSetVolumeInfo (
   IN FAT_VOLUME       *Volume,
   IN UINTN            BufferSize,
   IN VOID             *Buffer
   )
-/*++
-
-Routine Description:
-
-  Set the volume's info.
-
-Arguments:
-
-  Volume                - FAT file system volume.
-  BufferSize            - Size of Buffer.
-  Buffer                - Buffer containing the new volume info.
-
-Returns:
-
-  EFI_SUCCESS           - Set the volume info successfully.
-  EFI_BAD_BUFFER_SIZE   - The buffer size is error.
-  EFI_WRITE_PROTECTED   - The volume is read only.
-  other                 - An error occurred when operation the disk.
-
---*/
 {
   EFI_FILE_SYSTEM_INFO  *Info;
 
   Info = (EFI_FILE_SYSTEM_INFO *) Buffer;
 
@@ -223,36 +191,30 @@ Returns:
   }
 
   return FatSetVolumeEntry (Volume, Info->VolumeLabel);
 }
 
+/**
+
+  Set the volume's label info.
+
+  @param  Volume                - FAT file system volume.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing the new volume label info.
+
+  @retval EFI_SUCCESS           - Set the volume label info successfully.
+  @retval EFI_WRITE_PROTECTED   - The disk is write protected.
+  @retval EFI_BAD_BUFFER_SIZE   - The buffer size is error.
+  @return other                 - An error occurred when operation the disk.
+
+**/
 EFI_STATUS
 FatSetVolumeLabelInfo (
   IN FAT_VOLUME       *Volume,
   IN UINTN            BufferSize,
   IN VOID             *Buffer
   )
-/*++
-
-Routine Description:
-
-  Set the volume's label info
-
-Arguments:
-
-  Volume                - FAT file system volume.
-  BufferSize            - Size of Buffer.
-  Buffer                - Buffer containing the new volume label info.
-
-Returns:
-
-  EFI_SUCCESS           - Set the volume label info successfully.
-  EFI_WRITE_PROTECTED   - The disk is write protected.
-  EFI_BAD_BUFFER_SIZE   - The buffer size is error.
-  other                 - An error occurred when operation the disk.
-
---*/
 {
   EFI_FILE_SYSTEM_VOLUME_LABEL *Info;
 
   Info = (EFI_FILE_SYSTEM_VOLUME_LABEL *) Buffer;
 
@@ -261,48 +223,42 @@ Returns:
   }
 
   return FatSetVolumeEntry (Volume, Info->VolumeLabel);
 }
 
+/**
+
+  Set the file info.
+
+  @param  Volume                - FAT file system volume.
+  @param  IFile                 - The instance of the open file.
+  @param  OFile                 - The open file.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing the new file info.
+
+  @retval EFI_SUCCESS           - Set the file info successfully.
+  @retval EFI_ACCESS_DENIED     - It is the root directory
+                          or the directory attribute bit can not change
+                          or try to change a directory size
+                          or something else.
+  @retval EFI_UNSUPPORTED       - The new file size is larger than 4GB.
+  @retval EFI_WRITE_PROTECTED   - The disk is write protected.
+  @retval EFI_BAD_BUFFER_SIZE   - The buffer size is error.
+  @retval EFI_INVALID_PARAMETER - The time info or attributes info is error.
+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate new memory.
+  @retval EFI_VOLUME_CORRUPTED  - The volume is corrupted.
+  @return other                 - An error occurred when operation the disk.
+
+**/
 EFI_STATUS
 FatSetFileInfo (
   IN FAT_VOLUME       *Volume,
   IN FAT_IFILE        *IFile,
   IN FAT_OFILE        *OFile,
   IN UINTN            BufferSize,
   IN VOID             *Buffer
   )
-/*++
-
-Routine Description:
-
-  Set the file info.
-
-Arguments:
-
-  Volume                - FAT file system volume.
-  IFile                 - The instance of the open file.
-  OFile                 - The open file.
-  BufferSize            - Size of Buffer.
-  Buffer                - Buffer containing the new file info.
-
-Returns:
-
-  EFI_SUCCESS           - Set the file info successfully.
-  EFI_ACCESS_DENIED     - It is the root directory
-                          or the directory attribute bit can not change
-                          or try to change a directory size
-                          or something else.
-  EFI_UNSUPPORTED       - The new file size is larger than 4GB.
-  EFI_WRITE_PROTECTED   - The disk is write protected.
-  EFI_BAD_BUFFER_SIZE   - The buffer size is error.
-  EFI_INVALID_PARAMETER - The time info or attributes info is error.
-  EFI_OUT_OF_RESOURCES  - Can not allocate new memory.
-  EFI_VOLUME_CORRUPTED  - The volume is corrupted.
-  other                 - An error occurred when operation the disk.
-
---*/
 {
   EFI_STATUS    Status;
   EFI_FILE_INFO *NewInfo;
   FAT_OFILE     *DotOFile;
   FAT_OFILE     *Parent;
@@ -470,38 +426,32 @@ Returns:
 
   OFile->Dirty = TRUE;
   return FatOFileFlush (OFile);
 }
 
+/**
+
+  Set or Get the some types info of the file into Buffer.
+
+  @param  IsSet      - TRUE:The access is set, else is get
+  @param  FHand      - The handle of file
+  @param  Type       - The type of the info
+  @param  BufferSize - Size of Buffer
+  @param  Buffer     - Buffer containing volume info
+
+  @retval EFI_SUCCESS       - Get the info successfully
+  @retval EFI_DEVICE_ERROR  - Can not find the OFile for the file
+
+**/
 EFI_STATUS
 FatSetOrGetInfo (
   IN     BOOLEAN            IsSet,
   IN     EFI_FILE_PROTOCOL  *FHand,
   IN     EFI_GUID           *Type,
   IN OUT UINTN              *BufferSize,
   IN OUT VOID               *Buffer
   )
-/*++
-
-Routine Description:
-
-  Set or Get the some types info of the file into Buffer
-
-Arguments:
-
-  IsSet      - TRUE:The access is set, else is get
-  FHand      - The handle of file
-  Type       - The type of the info
-  BufferSize - Size of Buffer
-  Buffer     - Buffer containing volume info
-
-Returns:
-
-  EFI_SUCCESS       - Get the info successfully
-  EFI_DEVICE_ERROR  - Can not find the OFile for the file
-
---*/
 {
   FAT_IFILE   *IFile;
   FAT_OFILE   *OFile;
   FAT_VOLUME  *Volume;
   EFI_STATUS  Status;
@@ -558,66 +508,54 @@ Returns:
 
   FatReleaseLock ();
   return Status;
 }
 
+/**
+
+  Get the some types info of the file into Buffer.
+
+  @param  FHand                 - The handle of file.
+  @param  Type                  - The type of the info.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing volume info.
+
+  @retval EFI_SUCCESS           - Get the info successfully.
+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
+
+**/
 EFI_STATUS
 EFIAPI
 FatGetInfo (
   IN     EFI_FILE_PROTOCOL   *FHand,
   IN     EFI_GUID            *Type,
   IN OUT UINTN               *BufferSize,
      OUT VOID                *Buffer
   )
-/*++
-
-Routine Description:
-
-  Get the some types info of the file into Buffer.
-
-Arguments:
+{
+  return FatSetOrGetInfo (FALSE, FHand, Type, BufferSize, Buffer);
+}
 
-  FHand                 - The handle of file.
-  Type                  - The type of the info.
-  BufferSize            - Size of Buffer.
-  Buffer                - Buffer containing volume info.
+/**
 
-Returns:
+  Set the some types info of the file into Buffer.
 
-  EFI_SUCCESS           - Get the info successfully.
-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
+  @param  FHand                 - The handle of file.
+  @param  Type                  - The type of the info.
+  @param  BufferSize            - Size of Buffer
+  @param  Buffer                - Buffer containing volume info.
 
---*/
-{
-  return FatSetOrGetInfo (FALSE, FHand, Type, BufferSize, Buffer);
-}
+  @retval EFI_SUCCESS           - Set the info successfully.
+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
 
+**/
 EFI_STATUS
 EFIAPI
 FatSetInfo (
   IN EFI_FILE_PROTOCOL  *FHand,
   IN EFI_GUID           *Type,
   IN UINTN              BufferSize,
   IN VOID               *Buffer
   )
-/*++
-
-Routine Description:
-
-  Set the some types info of the file into Buffer.
-
-Arguments:
-
-  FHand                 - The handle of file.
-  Type                  - The type of the info.
-  BufferSize            - Size of Buffer
-  Buffer                - Buffer containing volume info.
-
-Returns:
-
-  EFI_SUCCESS           - Set the info successfully.
-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
-
---*/
 {
   return FatSetOrGetInfo (TRUE, FHand, Type, &BufferSize, Buffer);
 }
diff --git a/FatPkg/EnhancedFatDxe/Init.c b/FatPkg/EnhancedFatDxe/Init.c
index d7cfa82..6febffc 100644
--- a/FatPkg/EnhancedFatDxe/Init.c
+++ b/FatPkg/EnhancedFatDxe/Init.c
@@ -1,56 +1,43 @@
-/*++
+/** @file
+  Initialization routines.
 
 Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
+**/
 
-Module Name:
-
-  Init.c
+#include "Fat.h"
 
-Abstract:
+/**
 
-  Initialization routines
+  Allocates volume structure, detects FAT file system, installs protocol,
+  and initialize cache.
 
---*/
+  @param  Handle                - The handle of parent device.
+  @param  DiskIo                - The DiskIo of parent device.
+  @param  DiskIo2               - The DiskIo2 of parent device.
+  @param  BlockIo               - The BlockIo of parent devicel
 
-#include "Fat.h"
+  @retval EFI_SUCCESS           - Allocate a new volume successfully.
+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
+  @return Others                - Allocating a new volume failed.
 
+**/
 EFI_STATUS
 FatAllocateVolume (
   IN  EFI_HANDLE                Handle,
   IN  EFI_DISK_IO_PROTOCOL      *DiskIo,
   IN  EFI_DISK_IO2_PROTOCOL     *DiskIo2,
   IN  EFI_BLOCK_IO_PROTOCOL     *BlockIo
   )
-/*++
-
-Routine Description:
-
-  Allocates volume structure, detects FAT file system, installs protocol,
-  and initialize cache.
-
-Arguments:
-
-  Handle                - The handle of parent device.
-  DiskIo                - The DiskIo of parent device.
-  BlockIo               - The BlockIo of parent devicel
-
-Returns:
-
-  EFI_SUCCESS           - Allocate a new volume successfully.
-  EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
-  Others                - Allocating a new volume failed.
-
---*/
 {
   EFI_STATUS  Status;
   FAT_VOLUME  *Volume;
 
   //
@@ -118,30 +105,24 @@ Done:
   }
 
   return Status;
 }
 
-EFI_STATUS
-FatAbandonVolume (
-  IN FAT_VOLUME *Volume
-  )
-/*++
-
-Routine Description:
+/**
 
   Called by FatDriverBindingStop(), Abandon the volume.
 
-Arguments:
-
-  Volume                - The volume to be abandoned.
-
-Returns:
+  @param  Volume                - The volume to be abandoned.
 
-  EFI_SUCCESS           - Abandoned the volume successfully.
-  Others                - Can not uninstall the protocol interfaces.
+  @retval EFI_SUCCESS           - Abandoned the volume successfully.
+  @return Others                - Can not uninstall the protocol interfaces.
 
---*/
+**/
+EFI_STATUS
+FatAbandonVolume (
+  IN FAT_VOLUME *Volume
+  )
 {
   EFI_STATUS  Status;
   BOOLEAN     LockedByMe;
 
   //
@@ -200,31 +181,25 @@ Returns:
   }
 
   return EFI_SUCCESS;
 }
 
-EFI_STATUS
-FatOpenDevice (
-  IN OUT FAT_VOLUME           *Volume
-  )
-/*++
-
-Routine Description:
-
-  Detects FAT file system on Disk and set relevant fields of Volume
-
-Arguments:
+/**
 
-  Volume                - The volume structure.
+  Detects FAT file system on Disk and set relevant fields of Volume.
 
-Returns:
+  @param Volume                - The volume structure.
 
-  EFI_SUCCESS           - The Fat File System is detected successfully
-  EFI_UNSUPPORTED       - The volume is not FAT file system.
-  EFI_VOLUME_CORRUPTED  - The volume is corrupted.
+  @retval EFI_SUCCESS           - The Fat File System is detected successfully
+  @retval EFI_UNSUPPORTED       - The volume is not FAT file system.
+  @retval EFI_VOLUME_CORRUPTED  - The volume is corrupted.
 
---*/
+**/
+EFI_STATUS
+FatOpenDevice (
+  IN OUT FAT_VOLUME           *Volume
+  )
 {
   EFI_STATUS            Status;
   UINT32                BlockSize;
   UINT32                DirtyMask;
   EFI_DISK_IO_PROTOCOL  *DiskIo;
diff --git a/FatPkg/EnhancedFatDxe/Misc.c b/FatPkg/EnhancedFatDxe/Misc.c
index 48c99f9..c36bdb8 100644
--- a/FatPkg/EnhancedFatDxe/Misc.c
+++ b/FatPkg/EnhancedFatDxe/Misc.c
@@ -1,6 +1,7 @@
-/*++
+/** @file
+  Miscellaneous functions.
 
 Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
@@ -8,43 +9,29 @@ http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 
-Module Name:
-
-  Misc.c
+**/
 
-Abstract:
+#include "Fat.h"
 
-  Miscellaneous functions
+/**
 
-Revision History
+  Create the task
 
---*/
+  @param  IFile                 - The instance of the open file.
+  @param  Token                 - A pointer to the token associated with the transaction.
 
-#include "Fat.h"
+  @return FAT_TASK *            - Return the task instance.
 
+**/
 FAT_TASK *
 FatCreateTask (
   FAT_IFILE           *IFile,
   EFI_FILE_IO_TOKEN   *Token
   )
-/*++
-
-Routine Description:
-
-  Create the task
-
-Arguments:
-
-  IFile                 - The instance of the open file.
-  Token                 - A pointer to the token associated with the transaction.
-
-Return:
-  FAT_TASK *            - Return the task instance.
-**/
 {
   FAT_TASK            *Task;
 
   Task = AllocateZeroPool (sizeof (*Task));
   if (Task != NULL) {
@@ -55,24 +42,21 @@ Return:
     InitializeListHead (&Task->Link);
   }
   return Task;
 }
 
-VOID
-FatDestroyTask (
-  FAT_TASK            *Task
-  )
-/*++
-
-Routine Description:
+/**
 
-  Destroy the task
+  Destroy the task.
 
-Arguments:
+  @param  Task                  - The task to be destroyed.
 
-  Task                  - The task to be destroyed.
 **/
+VOID
+FatDestroyTask (
+  FAT_TASK            *Task
+  )
 {
   LIST_ENTRY          *Link;
   FAT_SUBTASK         *Subtask;
 
   Link = GetFirstNode (&Task->Subtasks);
@@ -81,53 +65,44 @@ Arguments:
     Link = FatDestroySubtask (Subtask);
   }
   FreePool (Task);
 }
 
-VOID
-FatWaitNonblockingTask (
-  FAT_IFILE           *IFile
-  )
-/*++
-
-Routine Description:
+/**
 
   Wait all non-blocking requests complete.
 
-Arguments:
+  @param  IFile                 - The instance of the open file.
 
-  IFile                 - The instance of the open file.
 **/
+VOID
+FatWaitNonblockingTask (
+  FAT_IFILE           *IFile
+  )
 {
   BOOLEAN             TaskQueueEmpty;
 
   do {
     EfiAcquireLock (&FatTaskLock);
     TaskQueueEmpty = IsListEmpty (&IFile->Tasks);
     EfiReleaseLock (&FatTaskLock);
   } while (!TaskQueueEmpty);
 }
 
-LIST_ENTRY *
-FatDestroySubtask (
-  FAT_SUBTASK         *Subtask
-  )
-/*++
-
-Routine Description:
+/**
 
   Remove the subtask from subtask list.
 
-Arguments:
-
-  Subtask               - The subtask to be removed.
+  @param  Subtask               - The subtask to be removed.
 
-Returns:
+  @return LIST_ENTRY *          - The next node in the list.
 
-  LIST_ENTRY *          - The next node in the list.
-
---*/
+**/
+LIST_ENTRY *
+FatDestroySubtask (
+  FAT_SUBTASK         *Subtask
+  )
 {
   LIST_ENTRY          *Link;
 
   gBS->CloseEvent (Subtask->DiskIo2Token.Event);
 
@@ -135,32 +110,26 @@ Returns:
   FreePool (Subtask);
 
   return Link;
 }
 
+/**
+
+  Execute the task.
+
+  @param  IFile                 - The instance of the open file.
+  @param  Task                  - The task to be executed.
+
+  @retval EFI_SUCCESS           - The task was executed sucessfully.
+  @return other                 - An error occurred when executing the task.
+
+**/
 EFI_STATUS
 FatQueueTask (
   IN FAT_IFILE        *IFile,
   IN FAT_TASK         *Task
   )
-/*++
-
-Routine Description:
-
-  Execute the task
-
-Arguments:
-
-  IFile                 - The instance of the open file.
-  Task                  - The task to be executed.
-
-Returns:
-
-  EFI_SUCCESS           - The task was executed sucessfully.
-  other                 - An error occurred when executing the task.
-
---*/
 {
   EFI_STATUS          Status;
   LIST_ENTRY          *Link;
   FAT_SUBTASK         *Subtask;
 
@@ -236,43 +205,37 @@ Returns:
   }
 
   return Status;
 }
 
+/**
+
+  Set the volume as dirty or not.
+
+  @param  Volume                - FAT file system volume.
+  @param  IoMode                - The access mode.
+  @param  DirtyValue            - Set the volume as dirty or not.
+
+  @retval EFI_SUCCESS           - Set the new FAT entry value sucessfully.
+  @return other                 - An error occurred when operation the FAT entries.
+
+**/
 EFI_STATUS
 FatAccessVolumeDirty (
   IN FAT_VOLUME       *Volume,
   IN IO_MODE          IoMode,
   IN VOID             *DirtyValue
   )
-/*++
-
-Routine Description:
-
-  Set the volume as dirty or not
-
-Arguments:
-
-  Volume                - FAT file system volume.
-  IoMode                - The access mode.
-  DirtyValue            - Set the volume as dirty or not.
-
-Returns:
-
-  EFI_SUCCESS           - Set the new FAT entry value sucessfully.
-  other                 - An error occurred when operation the FAT entries.
-
---*/
 {
   UINTN WriteCount;
 
   WriteCount = Volume->FatEntrySize;
   return FatDiskIo (Volume, IoMode, Volume->FatPos + WriteCount, WriteCount, DirtyValue, NULL);
 }
 
 /**
-  Invoke a notification event
+  Invoke a notification event.
 
   @param  Event                 Event whose notification function is being invoked.
   @param  Context               The pointer to the notification function's context,
                                 which is implementation-dependent.
 
@@ -281,26 +244,10 @@ VOID
 EFIAPI
 FatOnAccessComplete (
   IN  EFI_EVENT                Event,
   IN  VOID                     *Context
   )
-/*++
-
-Routine Description:
-
-  Invoke a notification event
-  case #1. some subtasks are not completed when the FatOpenEx checks the Task->Subtasks
-           - sets Task->SubtaskCollected so callback to signal the event and free the task.
-  case #2. all subtasks are completed when the FatOpenEx checks the Task->Subtasks
-           - FatOpenEx signal the event and free the task.
-Arguments:
-
-  Event                 - Event whose notification function is being invoked.
-  Context               - The pointer to the notification function's context,
-                          which is implementation-dependent.
-
---*/
 {
   EFI_STATUS             Status;
   FAT_SUBTASK            *Subtask;
   FAT_TASK               *Task;
 
@@ -339,40 +286,35 @@ Arguments:
     RemoveEntryList (&Task->Link);
     FreePool (Task);
   }
 }
 
+/**
+
+  General disk access function.
+
+  @param  Volume                - FAT file system volume.
+  @param  IoMode                - The access mode (disk read/write or cache access).
+  @param  Offset                - The starting byte offset to read from.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing read data.
+  @param  Task                    point to task instance.
+
+  @retval EFI_SUCCESS           - The operation is performed successfully.
+  @retval EFI_VOLUME_CORRUPTED  - The accesss is
+  @return Others                - The status of read/write the disk
+
+**/
 EFI_STATUS
 FatDiskIo (
   IN     FAT_VOLUME       *Volume,
   IN     IO_MODE          IoMode,
   IN     UINT64           Offset,
   IN     UINTN            BufferSize,
   IN OUT VOID             *Buffer,
   IN     FAT_TASK         *Task
   )
-/*++
-
-Routine Description:
-
-  General disk access function
-
-Arguments:
-
-  Volume                - FAT file system volume.
-  IoMode                - The access mode (disk read/write or cache access).
-  Offset                - The starting byte offset to read from.
-  BufferSize            - Size of Buffer.
-  Buffer                - Buffer containing read data.
-
-Returns:
-
-  EFI_SUCCESS           - The operation is performed successfully.
-  EFI_VOLUME_CORRUPTED  - The accesss is
-  Others                - The status of read/write the disk
-
---*/
 {
   EFI_STATUS            Status;
   EFI_DISK_IO_PROTOCOL  *DiskIo;
   EFI_DISK_READ         IoFunction;
   FAT_SUBTASK           *Subtask;
@@ -435,128 +377,84 @@ Returns:
   }
 
   return Status;
 }
 
+/**
+
+  Lock the volume.
+
+**/
 VOID
 FatAcquireLock (
   VOID
   )
-/*++
-
-Routine Description:
-
-  Lock the volume.
-
-Arguments:
-
-  None.
-
-Returns:
-
-  None.
-
---*/
 {
   EfiAcquireLock (&FatFsLock);
 }
 
-EFI_STATUS
-FatAcquireLockOrFail (
-  VOID
-  )
-/*++
-
-Routine Description:
+/**
 
   Lock the volume.
   If the lock is already in the acquired state, then EFI_ACCESS_DENIED is returned.
   Otherwise, EFI_SUCCESS is returned.
 
-Arguments:
-
-  None.
-
-Returns:
+  @retval EFI_SUCCESS           - The volume is locked.
+  @retval EFI_ACCESS_DENIED     - The volume could not be locked because it is already locked.
 
-  EFI_SUCCESS           - The volume is locked.
-  EFI_ACCESS_DENIED     - The volume could not be locked because it is already locked.
-
---*/
+**/
+EFI_STATUS
+FatAcquireLockOrFail (
+  VOID
+  )
 {
   return EfiAcquireLockOrFail (&FatFsLock);
 }
 
+/**
+
+  Unlock the volume.
+
+**/
 VOID
 FatReleaseLock (
   VOID
   )
-/*++
-
-Routine Description:
-
-  Unlock the volume.
-
-Arguments:
-
-  Null.
-
-Returns:
-
-  None.
-
---*/
 {
   EfiReleaseLock (&FatFsLock);
 }
 
-VOID
-FatFreeDirEnt (
-  IN FAT_DIRENT       *DirEnt
-  )
-/*++
-
-Routine Description:
+/**
 
   Free directory entry.
 
-Arguments:
-
-  DirEnt                - The directory entry to be freed.
-
-Returns:
+  @param  DirEnt                - The directory entry to be freed.
 
-  None.
-
---*/
+**/
+VOID
+FatFreeDirEnt (
+  IN FAT_DIRENT       *DirEnt
+  )
 {
   if (DirEnt->FileString != NULL) {
     FreePool (DirEnt->FileString);
   }
 
   FreePool (DirEnt);
 }
 
-VOID
-FatFreeVolume (
-  IN FAT_VOLUME       *Volume
-  )
-/*++
-
-Routine Description:
+/**
 
   Free volume structure (including the contents of directory cache and disk cache).
 
-Arguments:
-
-  Volume                - The volume structure to be freed.
+  @param  Volume                - The volume structure to be freed.
 
-Returns:
-
-  None.
-
---*/
+**/
+VOID
+FatFreeVolume (
+  IN FAT_VOLUME       *Volume
+  )
 {
   //
   // Free disk cache
   //
   if (Volume->CacheBuffer != NULL) {
@@ -567,31 +465,23 @@ Returns:
   //
   FatCleanupODirCache (Volume);
   FreePool (Volume);
 }
 
+/**
+
+  Translate EFI time to FAT time.
+
+  @param  ETime                 - The time of EFI_TIME.
+  @param  FTime                 - The time of FAT_DATE_TIME.
+
+**/
 VOID
 FatEfiTimeToFatTime (
   IN  EFI_TIME        *ETime,
   OUT FAT_DATE_TIME   *FTime
   )
-/*++
-
-Routine Description:
-
-  Translate EFI time to FAT time.
-
-Arguments:
-
-  ETime                 - The time of EFI_TIME.
-  FTime                 - The time of FAT_DATE_TIME.
-
-Returns:
-
-  None.
-
---*/
 {
   //
   // ignores timezone info in source ETime
   //
   if (ETime->Year > 1980) {
@@ -607,31 +497,23 @@ Returns:
   FTime->Time.Hour          = ETime->Hour;
   FTime->Time.Minute        = ETime->Minute;
   FTime->Time.DoubleSecond  = (UINT16) (ETime->Second / 2);
 }
 
+/**
+
+  Translate Fat time to EFI time.
+
+  @param  FTime                 - The time of FAT_DATE_TIME.
+  @param  ETime                 - The time of EFI_TIME..
+
+**/
 VOID
 FatFatTimeToEfiTime (
   IN  FAT_DATE_TIME     *FTime,
   OUT EFI_TIME          *ETime
   )
-/*++
-
-Routine Description:
-
-  Translate Fat time to EFI time.
-
-Arguments:
-
-  FTime                 - The time of FAT_DATE_TIME.
-  ETime                 - The time of EFI_TIME.
-
-Returns:
-
-  None.
-
---*/
 {
   ETime->Year       = (UINT16) (FTime->Date.Year + 1980);
   ETime->Month      = (UINT8) FTime->Date.Month;
   ETime->Day        = (UINT8) FTime->Date.Day;
   ETime->Hour       = (UINT8) FTime->Time.Hour;
@@ -640,29 +522,21 @@ Returns:
   ETime->Nanosecond = 0;
   ETime->TimeZone   = EFI_UNSPECIFIED_TIMEZONE;
   ETime->Daylight   = 0;
 }
 
-VOID
-FatGetCurrentFatTime (
-  OUT FAT_DATE_TIME   *FatNow
-  )
-/*++
-
-Routine Description:
+/**
 
   Get Current FAT time.
 
-Arguments:
-
-  FatNow                - Current FAT time.
-
-Returns:
+  @param  FatNow                - Current FAT time.
 
-  None.
-
---*/
+**/
+VOID
+FatGetCurrentFatTime (
+  OUT FAT_DATE_TIME   *FatNow
+  )
 {
   EFI_STATUS Status;
   EFI_TIME   Now;
 
   Status = gRT->GetTime (&Now, NULL);
@@ -675,30 +549,24 @@ Returns:
     Now.Day = 1;
     FatEfiTimeToFatTime (&Now, FatNow);
   }
 }
 
-BOOLEAN
-FatIsValidTime (
-  IN EFI_TIME         *Time
-  )
-/*++
-
-Routine Description:
+/**
 
   Check whether a time is valid.
 
-Arguments:
-
-  Time                  - The time of EFI_TIME.
+  @param  Time                  - The time of EFI_TIME.
 
-Returns:
+  @retval TRUE                  - The time is valid.
+  @retval FALSE                 - The time is not valid.
 
-  TRUE                  - The time is valid.
-  FALSE                 - The time is not valid.
-
---*/
+**/
+BOOLEAN
+FatIsValidTime (
+  IN EFI_TIME         *Time
+  )
 {
   STATIC UINT8  MonthDays[12];
   UINTN         Day;
   BOOLEAN       ValidTime;
 
diff --git a/FatPkg/EnhancedFatDxe/Open.c b/FatPkg/EnhancedFatDxe/Open.c
index 1d864d1..7b273fe 100644
--- a/FatPkg/EnhancedFatDxe/Open.c
+++ b/FatPkg/EnhancedFatDxe/Open.c
@@ -1,54 +1,38 @@
-/*++
+/** @file
+  Routines dealing with file open.
 
 Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
+**/
 
-Module Name:
-
-  open.c
+#include "Fat.h"
 
-Abstract:
+/**
 
-  Routines dealing with file open
+  Create an Open instance for the existing OFile.
+  The IFile of the newly opened file is passed out.
 
-Revision History
+  @param  OFile                 - The file that serves as a starting reference point.
+  @param  PtrIFile              - The newly generated IFile instance.
 
---*/
-
-#include "Fat.h"
+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory for the IFile
+  @retval EFI_SUCCESS           - Create the new IFile for the OFile successfully
 
+**/
 EFI_STATUS
 FatAllocateIFile (
   IN FAT_OFILE    *OFile,
   OUT FAT_IFILE   **PtrIFile
   )
-/*++
-
-Routine Description:
-
-  Create an Open instance for the existing OFile.
-  The IFile of the newly opened file is passed out.
-
-Arguments:
-
-  OFile                 - The file that serves as a starting reference point.
-  PtrIFile              - The newly generated IFile instance.
-
-Returns:
-
-  EFI_OUT_OF_RESOURCES  - Can not allocate the memory for the IFile
-  EFI_SUCCESS           - Create the new IFile for the OFile successfully
-
---*/
 {
   FAT_IFILE *IFile;
 
   ASSERT_VOLUME_LOCKED (OFile->Volume);
 
@@ -79,45 +63,40 @@ Returns:
 
   *PtrIFile = IFile;
   return EFI_SUCCESS;
 }
 
-EFI_STATUS
-FatOFileOpen (
-  IN  FAT_OFILE            *OFile,
-  OUT FAT_IFILE            **NewIFile,
-  IN  CHAR16               *FileName,
-  IN  UINT64               OpenMode,
-  IN  UINT8                Attributes
-  )
-/*++
-
-Routine Description:
+/**
 
   Open a file for a file name relative to an existing OFile.
   The IFile of the newly opened file is passed out.
 
-Arguments:
-
-  OFile                 - The file that serves as a starting reference point.
-  NewIFile              - The newly generated IFile instance.
-  FileName              - The file name relative to the OFile.
-  OpenMode              - Open mode.
-  Attributes            - Attributes to set if the file is created.
+  @param  OFile                 - The file that serves as a starting reference point.
+  @param  NewIFile              - The newly generated IFile instance.
+  @param  FileName              - The file name relative to the OFile.
+  @param  OpenMode              - Open mode.
+  @param  Attributes            - Attributes to set if the file is created.
 
-Returns:
 
-  EFI_SUCCESS           - Open the file successfully.
-  EFI_INVALID_PARAMETER - The open mode is conflict with the attributes
+  @retval EFI_SUCCESS           - Open the file successfully.
+  @retval EFI_INVALID_PARAMETER - The open mode is conflict with the attributes
                           or the file name is not valid.
-  EFI_NOT_FOUND         - Conficts between dir intention and attribute.
-  EFI_WRITE_PROTECTED   - Can't open for write if the volume is read only.
-  EFI_ACCESS_DENIED     - If the file's attribute is read only, and the
+  @retval EFI_NOT_FOUND         - Conficts between dir intention and attribute.
+  @retval EFI_WRITE_PROTECTED   - Can't open for write if the volume is read only.
+  @retval EFI_ACCESS_DENIED     - If the file's attribute is read only, and the
                           open is for read-write fail it.
-  EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
 
---*/
+**/
+EFI_STATUS
+FatOFileOpen (
+  IN  FAT_OFILE            *OFile,
+  OUT FAT_IFILE            **NewIFile,
+  IN  CHAR16               *FileName,
+  IN  UINT64               OpenMode,
+  IN  UINT8                Attributes
+  )
 {
   FAT_VOLUME  *Volume;
   EFI_STATUS  Status;
   CHAR16      NewFileName[EFI_PATH_STRING_LENGTH];
   FAT_DIRENT  *DirEnt;
@@ -197,44 +176,39 @@ Returns:
 
   DEBUG ((EFI_D_INFO, "FSOpen: Open '%S' %r\n", FileName, Status));
   return FatOFileFlush (OFile);
 }
 
+/**
+
+  Implements OpenEx() of Simple File System Protocol.
+
+  @param  FHand                 - File handle of the file serves as a starting reference point.
+  @param  NewHandle             - Handle of the file that is newly opened.
+  @param  FileName              - File name relative to FHand.
+  @param  OpenMode              - Open mode.
+  @param  Attributes            - Attributes to set if the file is created.
+  @param  Token                 - A pointer to the token associated with the transaction.:
+
+  @retval EFI_INVALID_PARAMETER - The FileName is NULL or the file string is empty.
+                          The OpenMode is not supported.
+                          The Attributes is not the valid attributes.
+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory for file string.
+  @retval EFI_SUCCESS           - Open the file successfully.
+  @return Others                - The status of open file.
+
+**/
 EFI_STATUS
 EFIAPI
 FatOpenEx (
   IN  EFI_FILE_PROTOCOL       *FHand,
   OUT EFI_FILE_PROTOCOL       **NewHandle,
   IN  CHAR16                  *FileName,
   IN  UINT64                  OpenMode,
   IN  UINT64                  Attributes,
   IN OUT EFI_FILE_IO_TOKEN    *Token
   )
-/*++
-Routine Description:
-
-  Implements OpenEx() of Simple File System Protocol.
-
-Arguments:
-
-  FHand                 - File handle of the file serves as a starting reference point.
-  NewHandle             - Handle of the file that is newly opened.
-  FileName              - File name relative to FHand.
-  OpenMode              - Open mode.
-  Attributes            - Attributes to set if the file is created.
-  Token                 - A pointer to the token associated with the transaction.
-
-Returns:
-
-  EFI_INVALID_PARAMETER - The FileName is NULL or the file string is empty.
-                          The OpenMode is not supported.
-                          The Attributes is not the valid attributes.
-  EFI_OUT_OF_RESOURCES  - Can not allocate the memory for file string.
-  EFI_SUCCESS           - Open the file successfully.
-  Others                - The status of open file.
-
---*/
 {
   FAT_IFILE   *IFile;
   FAT_IFILE   *NewIFile;
   FAT_OFILE   *OFile;
   EFI_STATUS  Status;
@@ -317,40 +291,36 @@ Returns:
   }
 
   return Status;
 }
 
+/**
+
+  Implements Open() of Simple File System Protocol.
+
+
+  @param   FHand                 - File handle of the file serves as a starting reference point.
+  @param   NewHandle             - Handle of the file that is newly opened.
+  @param   FileName              - File name relative to FHand.
+  @param   OpenMode              - Open mode.
+  @param   Attributes            - Attributes to set if the file is created.
+
+  @retval EFI_INVALID_PARAMETER - The FileName is NULL or the file string is empty.
+                          The OpenMode is not supported.
+                          The Attributes is not the valid attributes.
+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory for file string.
+  @retval EFI_SUCCESS           - Open the file successfully.
+  @return Others                - The status of open file.
+
+**/
 EFI_STATUS
 EFIAPI
 FatOpen (
   IN  EFI_FILE_PROTOCOL   *FHand,
   OUT EFI_FILE_PROTOCOL   **NewHandle,
   IN  CHAR16              *FileName,
   IN  UINT64              OpenMode,
   IN  UINT64              Attributes
   )
-/*++
-Routine Description:
-
-  Implements Open() of Simple File System Protocol.
-
-Arguments:
-
-  FHand                 - File handle of the file serves as a starting reference point.
-  NewHandle             - Handle of the file that is newly opened.
-  FileName              - File name relative to FHand.
-  OpenMode              - Open mode.
-  Attributes            - Attributes to set if the file is created.
-
-Returns:
-
-  EFI_INVALID_PARAMETER - The FileName is NULL or the file string is empty.
-                          The OpenMode is not supported.
-                          The Attributes is not the valid attributes.
-  EFI_OUT_OF_RESOURCES  - Can not allocate the memory for file string.
-  EFI_SUCCESS           - Open the file successfully.
-  Others                - The status of open file.
-
---*/
 {
   return FatOpenEx (FHand, NewHandle, FileName, OpenMode, Attributes, NULL);
 }
diff --git a/FatPkg/EnhancedFatDxe/OpenVolume.c b/FatPkg/EnhancedFatDxe/OpenVolume.c
index 0f43ffa..4e12db3 100644
--- a/FatPkg/EnhancedFatDxe/OpenVolume.c
+++ b/FatPkg/EnhancedFatDxe/OpenVolume.c
@@ -1,55 +1,39 @@
-/*++
+/** @file
+  OpenVolume() function of Simple File System Protocol.
 
 Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
+**/
 
-Module Name:
-
-  OpenVolume.c
+#include "Fat.h"
 
-Abstract:
+/**
 
-  OpenVolume() function of Simple File System Protocol
+  Implements Simple File System Protocol interface function OpenVolume().
 
-Revision History
+  @param  This                  - Calling context.
+  @param  File                  - the Root Directory of the volume.
 
---*/
-
-#include "Fat.h"
+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
+  @retval EFI_VOLUME_CORRUPTED  - The FAT type is error.
+  @retval EFI_SUCCESS           - Open the volume successfully.
 
+**/
 EFI_STATUS
 EFIAPI
 FatOpenVolume (
   IN  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL  *This,
   OUT EFI_FILE_PROTOCOL                **File
   )
-/*++
-
-Routine Description:
-
-  Implements Simple File System Protocol interface function OpenVolume().
-
-Arguments:
-
-  This                  - Calling context.
-  File                  - the Root Directory of the volume.
-
-Returns:
-
-  EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
-  EFI_VOLUME_CORRUPTED  - The FAT type is error.
-  EFI_SUCCESS           - Open the volume successfully.
-
---*/
 {
   EFI_STATUS  Status;
   FAT_VOLUME  *Volume;
   FAT_IFILE   *IFile;
 
diff --git a/FatPkg/EnhancedFatDxe/ReadWrite.c b/FatPkg/EnhancedFatDxe/ReadWrite.c
index 81676cd..a6e0ec4 100644
--- a/FatPkg/EnhancedFatDxe/ReadWrite.c
+++ b/FatPkg/EnhancedFatDxe/ReadWrite.c
@@ -1,6 +1,7 @@
-/*++
+/** @file
+  Functions that perform file read/write.
 
 Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
 This program and the accompanying materials are licensed and made available
 under the terms and conditions of the BSD License which accompanies this
 distribution. The full text of the license may be found at
@@ -8,48 +9,33 @@ http://opensource.org/licenses/bsd-license.php
 
 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 
-Module Name:
+**/
 
-  ReadWrite.c
+#include "Fat.h"
 
-Abstract:
+/**
 
-  Functions that perform file read/write
+  Get the file's position of the file.
 
-Revision History
 
---*/
+  @param  FHand                 - The handle of file.
+  @param  Position              - The file's position of the file.
 
-#include "Fat.h"
+  @retval EFI_SUCCESS           - Get the info successfully.
+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
+  @retval EFI_UNSUPPORTED       - The open file is not a file.
 
+**/
 EFI_STATUS
 EFIAPI
 FatGetPosition (
   IN  EFI_FILE_PROTOCOL *FHand,
   OUT UINT64            *Position
   )
-/*++
-
-Routine Description:
-
-  Get the file's position of the file.
-
-Arguments:
-
-  FHand                 - The handle of file.
-  Position              - The file's position of the file.
-
-Returns:
-
-  EFI_SUCCESS           - Get the info successfully.
-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
-  EFI_UNSUPPORTED       - The open file is not a file.
-
---*/
 {
   FAT_IFILE *IFile;
   FAT_OFILE *OFile;
 
   IFile = IFILE_FROM_FHAND (FHand);
@@ -65,34 +51,28 @@ Returns:
 
   *Position = IFile->Position;
   return EFI_SUCCESS;
 }
 
+/**
+
+  Set the file's position of the file.
+
+  @param  FHand                 - The handle of file.
+  @param  Position              - The file's position of the file.
+
+  @retval EFI_SUCCESS           - Set the info successfully.
+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
+  @retval EFI_UNSUPPORTED       - Set a directory with a not-zero position.
+
+**/
 EFI_STATUS
 EFIAPI
 FatSetPosition (
   IN EFI_FILE_PROTOCOL  *FHand,
   IN UINT64             Position
   )
-/*++
-
-Routine Description:
-
-  Set the file's position of the file.
-
-Arguments:
-
-  FHand                 - The handle of file.
-  Position              - The file's position of the file.
-
-Returns:
-
-  EFI_SUCCESS           - Set the info successfully.
-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
-  EFI_UNSUPPORTED       - Set a directory with a not-zero position.
-
---*/
 {
   FAT_IFILE *IFile;
   FAT_OFILE *OFile;
 
   IFile = IFILE_FROM_FHAND (FHand);
@@ -128,34 +108,28 @@ Returns:
   //
   IFile->Position = Position;
   return EFI_SUCCESS;
 }
 
+/**
+
+  Get the file info from the open file of the IFile into Buffer.
+
+  @param  IFile                 - The instance of the open file.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing read data.
+
+  @retval EFI_SUCCESS           - Get the file info successfully.
+  @retval other                 - An error occurred when operation the disk.
+
+**/
 EFI_STATUS
 FatIFileReadDir (
   IN     FAT_IFILE              *IFile,
   IN OUT UINTN                  *BufferSize,
      OUT VOID                   *Buffer
   )
-/*++
-
-Routine Description:
-
-  Get the file info from the open file of the IFile into Buffer.
-
-Arguments:
-
-  IFile                 - The instance of the open file.
-  BufferSize            - Size of Buffer.
-  Buffer                - Buffer containing read data.
-
-Returns:
-
-  EFI_SUCCESS           - Get the file info successfully.
-  other                 - An error occurred when operation the disk.
-
---*/
 {
   EFI_STATUS  Status;
   FAT_OFILE   *OFile;
   FAT_ODIR    *ODir;
   FAT_DIRENT  *DirEnt;
@@ -203,42 +177,36 @@ Done:
   }
 
   return Status;
 }
 
+/**
+
+  Get the file info from the open file of the IFile into Buffer.
+
+  @param FHand                 - The file handle to access.
+  @param  IoMode                - Indicate whether the access mode is reading or writing.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing read data.
+  @param  Token                 - A pointer to the token associated with the transaction.
+
+  @retval EFI_SUCCESS           - Get the file info successfully.
+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
+  @retval EFI_VOLUME_CORRUPTED  - The file type of open file is error.
+  @retval EFI_WRITE_PROTECTED   - The disk is write protect.
+  @retval EFI_ACCESS_DENIED     - The file is read-only.
+  @return other                 - An error occurred when operating on the disk.
+
+**/
 EFI_STATUS
 FatIFileAccess (
   IN     EFI_FILE_PROTOCOL     *FHand,
   IN     IO_MODE               IoMode,
   IN OUT UINTN                 *BufferSize,
   IN OUT VOID                  *Buffer,
   IN     EFI_FILE_IO_TOKEN     *Token
   )
-/*++
-
-Routine Description:
-
-  Get the file info from the open file of the IFile into Buffer.
-
-Arguments:
-
-  FHand                 - The file handle to access.
-  IoMode                - Indicate whether the access mode is reading or writing.
-  BufferSize            - Size of Buffer.
-  Buffer                - Buffer containing read data.
-  Token                 - A pointer to the token associated with the transaction.
-
-Returns:
-
-  EFI_SUCCESS           - Get the file info successfully.
-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
-  EFI_VOLUME_CORRUPTED  - The file type of open file is error.
-  EFI_WRITE_PROTECTED   - The disk is write protect.
-  EFI_ACCESS_DENIED     - The file is read-only.
-  other                 - An error occurred when operating on the disk.
-
---*/
 {
   EFI_STATUS  Status;
   FAT_IFILE   *IFile;
   FAT_OFILE   *OFile;
   FAT_VOLUME  *Volume;
@@ -371,163 +339,135 @@ Done:
 
   FatReleaseLock ();
   return Status;
 }
 
+/**
+
+  Get the file info.
+
+  @param  FHand                 - The handle of the file.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing read data.
+
+
+  @retval EFI_SUCCESS           - Get the file info successfully.
+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
+  @retval EFI_VOLUME_CORRUPTED  - The file type of open file is error.
+  @return other                 - An error occurred when operation the disk.
+
+**/
 EFI_STATUS
 EFIAPI
 FatRead (
   IN     EFI_FILE_PROTOCOL  *FHand,
   IN OUT UINTN              *BufferSize,
      OUT VOID               *Buffer
   )
-/*++
+{
+  return FatIFileAccess (FHand, ReadData, BufferSize, Buffer, NULL);
+}
 
-Routine Description:
+/**
 
   Get the file info.
 
-Arguments:
-
-  FHand                 - The handle of the file.
-  BufferSize            - Size of Buffer.
-  Buffer                - Buffer containing read data.
+  @param  FHand                 - The handle of the file.
+  @param  Token                 - A pointer to the token associated with the transaction.
 
-Returns:
-
-  EFI_SUCCESS           - Get the file info successfully.
-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
-  EFI_VOLUME_CORRUPTED  - The file type of open file is error.
-  other                 - An error occurred when operation the disk.
-
---*/
-{
-  return FatIFileAccess (FHand, ReadData, BufferSize, Buffer, NULL);
-}
+  @retval EFI_SUCCESS           - Get the file info successfully.
+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
+  @retval EFI_VOLUME_CORRUPTED  - The file type of open file is error.
+  @return other                 - An error occurred when operation the disk.
 
+**/
 EFI_STATUS
 EFIAPI
 FatReadEx (
   IN     EFI_FILE_PROTOCOL  *FHand,
   IN OUT EFI_FILE_IO_TOKEN  *Token
   )
-/*++
-
-Routine Description:
-
-  Get the file info.
-
-Arguments:
+{
+  return FatIFileAccess (FHand, ReadData, &Token->BufferSize, Token->Buffer, Token);
+}
 
-  FHand                 - The handle of the file.
-  Token                 - A pointer to the token associated with the transaction.
+/**
 
-Returns:
+  Write the content of buffer into files.
 
-  EFI_SUCCESS           - Get the file info successfully.
-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
-  EFI_VOLUME_CORRUPTED  - The file type of open file is error.
-  other                 - An error occurred when operation the disk.
+  @param  FHand                 - The handle of the file.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing write data.
 
---*/
-{
-  return FatIFileAccess (FHand, ReadData, &Token->BufferSize, Token->Buffer, Token);
-}
+  @retval EFI_SUCCESS           - Set the file info successfully.
+  @retval EFI_WRITE_PROTECTED   - The disk is write protect.
+  @retval EFI_ACCESS_DENIED     - The file is read-only.
+  @retval EFI_DEVICE_ERROR      - The OFile is not valid.
+  @retval EFI_UNSUPPORTED       - The open file is not a file.
+                        - The writing file size is larger than 4GB.
+  @return other                 - An error occurred when operation the disk.
 
+**/
 EFI_STATUS
 EFIAPI
 FatWrite (
   IN     EFI_FILE_PROTOCOL  *FHand,
   IN OUT UINTN              *BufferSize,
   IN     VOID               *Buffer
   )
-/*++
-
-Routine Description:
-
-  Write the content of buffer into files.
+{
+  return FatIFileAccess (FHand, WriteData, BufferSize, Buffer, NULL);
+}
 
-Arguments:
+/**
 
-  FHand                 - The handle of the file.
-  BufferSize            - Size of Buffer.
-  Buffer                - Buffer containing write data.
+  Get the file info.
 
-Returns:
+  @param  FHand                 - The handle of the file.
+  @param  Token                 - A pointer to the token associated with the transaction.
 
-  EFI_SUCCESS           - Set the file info successfully.
-  EFI_WRITE_PROTECTED   - The disk is write protect.
-  EFI_ACCESS_DENIED     - The file is read-only.
-  EFI_DEVICE_ERROR      - The OFile is not valid.
-  EFI_UNSUPPORTED       - The open file is not a file.
-                        - The writing file size is larger than 4GB.
-  other                 - An error occurred when operation the disk.
-
---*/
-{
-  return FatIFileAccess (FHand, WriteData, BufferSize, Buffer, NULL);
-}
+  @retval EFI_SUCCESS           - Get the file info successfully.
+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
+  @retval EFI_VOLUME_CORRUPTED  - The file type of open file is error.
+  @return other                 - An error occurred when operation the disk.
 
+**/
 EFI_STATUS
 EFIAPI
 FatWriteEx (
   IN     EFI_FILE_PROTOCOL  *FHand,
   IN OUT EFI_FILE_IO_TOKEN  *Token
   )
-/*++
-
-Routine Description:
-
-  Get the file info.
-
-Arguments:
+{
+  return FatIFileAccess (FHand, WriteData, &Token->BufferSize, Token->Buffer, Token);
+}
 
-  FHand                 - The handle of the file.
-  Token                 - A pointer to the token associated with the transaction.
+/**
 
-Returns:
+  This function reads data from a file or writes data to a file.
+  It uses OFile->PosRem to determine how much data can be accessed in one time.
 
-  EFI_SUCCESS           - Get the file info successfully.
-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
-  EFI_VOLUME_CORRUPTED  - The file type of open file is error.
-  other                 - An error occurred when operation the disk.
+  @param  OFile                 - The open file.
+  @param  IoMode                - Indicate whether the access mode is reading or writing.
+  @param  Position              - The position where data will be accessed.
+  @param  DataBufferSize        - Size of Buffer.
+  @param  UserBuffer            - Buffer containing data.
+  @param  Task                    point to task instance.
 
---*/
-{
-  return FatIFileAccess (FHand, WriteData, &Token->BufferSize, Token->Buffer, Token);
-}
+  @retval EFI_SUCCESS           - Access the data successfully.
+  @return other                 - An error occurred when operating on the disk.
 
+**/
 EFI_STATUS
 FatAccessOFile (
   IN     FAT_OFILE      *OFile,
   IN     IO_MODE        IoMode,
   IN     UINTN          Position,
   IN OUT UINTN          *DataBufferSize,
   IN OUT UINT8          *UserBuffer,
   IN FAT_TASK           *Task
   )
-/*++
-
-Routine Description:
-
-  This function reads data from a file or writes data to a file.
-  It uses OFile->PosRem to determine how much data can be accessed in one time.
-
-Arguments:
-
-  OFile                 - The open file.
-  IoMode                - Indicate whether the access mode is reading or writing.
-  Position              - The position where data will be accessed.
-  DataBufferSize        - Size of Buffer.
-  UserBuffer            - Buffer containing data.
-
-Returns:
-
-  EFI_SUCCESS           - Access the data successfully.
-  other                 - An error occurred when operating on the disk.
-
---*/
 {
   FAT_VOLUME  *Volume;
   UINTN       Len;
   EFI_STATUS  Status;
   UINTN       BufferSize;
@@ -577,32 +517,26 @@ Returns:
   //
   *DataBufferSize -= BufferSize;
   return Status;
 }
 
-EFI_STATUS
-FatExpandOFile (
-  IN FAT_OFILE          *OFile,
-  IN UINT64             ExpandedSize
-  )
-/*++
-
-Routine Description:
+/**
 
   Expand OFile by appending zero bytes at the end of OFile.
 
-Arguments:
-
-  OFile                 - The open file.
-  ExpandedSize          - The number of zero bytes appended at the end of the file.
+  @param  OFile                 - The open file.
+  @param  ExpandedSize          - The number of zero bytes appended at the end of the file.
 
-Returns:
+  @retval EFI_SUCCESS           - The file is expanded successfully.
+  @return other                 - An error occurred when expanding file.
 
-  EFI_SUCCESS           - The file is expanded successfully.
-  other                 - An error occurred when expanding file.
-
---*/
+**/
+EFI_STATUS
+FatExpandOFile (
+  IN FAT_OFILE          *OFile,
+  IN UINT64             ExpandedSize
+  )
 {
   EFI_STATUS  Status;
   UINTN       WritePos;
 
   WritePos  = OFile->FileSize;
@@ -612,33 +546,27 @@ Returns:
   }
 
   return Status;
 }
 
-EFI_STATUS
-FatWriteZeroPool (
-  IN FAT_OFILE  *OFile,
-  IN UINTN      WritePos
-  )
-/*++
-
-Routine Description:
+/**
 
   Write zero pool from the WritePos to the end of OFile.
 
-Arguments:
-
-  OFile                 - The open file to write zero pool.
-  WritePos              - The number of zero bytes written.
-
-Returns:
+  @param  OFile                 - The open file to write zero pool.
+  @param  WritePos              - The number of zero bytes written.
 
-  EFI_SUCCESS           - Write the zero pool successfully.
-  EFI_OUT_OF_RESOURCES  - Not enough memory to perform the operation.
-  other                 - An error occurred when writing disk.
+  @retval EFI_SUCCESS           - Write the zero pool successfully.
+  @retval EFI_OUT_OF_RESOURCES  - Not enough memory to perform the operation.
+  @return other                 - An error occurred when writing disk.
 
---*/
+**/
+EFI_STATUS
+FatWriteZeroPool (
+  IN FAT_OFILE  *OFile,
+  IN UINTN      WritePos
+  )
 {
   EFI_STATUS  Status;
   VOID        *ZeroBuffer;
   UINTN       AppendedSize;
   UINTN       BufferSize;
@@ -674,31 +602,25 @@ Returns:
 
   FreePool (ZeroBuffer);
   return Status;
 }
 
-EFI_STATUS
-FatTruncateOFile (
-  IN FAT_OFILE          *OFile,
-  IN UINTN              TruncatedSize
-  )
-/*++
-
-Routine Description:
+/**
 
   Truncate the OFile to smaller file size.
 
-Arguments:
-
-  OFile                 - The open file.
-  TruncatedSize         - The new file size.
+  @param  OFile                 - The open file.
+  @param  TruncatedSize         - The new file size.
 
-Returns:
+  @retval EFI_SUCCESS           - The file is truncated successfully.
+  @return other                 - An error occurred when truncating file.
 
-  EFI_SUCCESS           - The file is truncated successfully.
-  other                 - An error occurred when truncating file.
-
---*/
+**/
+EFI_STATUS
+FatTruncateOFile (
+  IN FAT_OFILE          *OFile,
+  IN UINTN              TruncatedSize
+  )
 {
   OFile->FileSize = TruncatedSize;
   return FatShrinkEof (OFile);
 }
diff --git a/FatPkg/EnhancedFatDxe/UnicodeCollation.c b/FatPkg/EnhancedFatDxe/UnicodeCollation.c
index 61b9aab..b240a93 100644
--- a/FatPkg/EnhancedFatDxe/UnicodeCollation.c
+++ b/FatPkg/EnhancedFatDxe/UnicodeCollation.c
@@ -187,13 +187,12 @@ FatStriCmp (
 
 
 /**
   Uppercase a string.
 
-  @param  Str                   The string which will be upper-cased.
+  @param  String                   The string which will be upper-cased.
 
-  @return None.
 
 **/
 VOID
 FatStrUpr (
   IN OUT CHAR16   *String
@@ -207,13 +206,12 @@ FatStrUpr (
 
 
 /**
   Lowercase a string
 
-  @param  Str                   The string which will be lower-cased.
+  @param  String                   The string which will be lower-cased.
 
-  @return None
 
 **/
 VOID
 FatStrLwr (
   IN OUT CHAR16   *String
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [patch 7/8] FatPkg\EnhancedFatDxe: Add comments for functions
  2016-12-08 10:54 [patch 0/8] FatPkg: Fix coding style issues Dandan Bi
                   ` (5 preceding siblings ...)
  2016-12-08 10:54 ` [patch 6/8] FatPkg\EnhancedFatDxe: Make the comments align with EDKII coding style Dandan Bi
@ 2016-12-08 10:54 ` 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
  7 siblings, 1 reply; 27+ messages in thread
From: Dandan Bi @ 2016-12-08 10:54 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ruiyu Ni

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/Fat.c  |  64 ++++
 FatPkg/EnhancedFatDxe/Fat.h  | 804 +++++++++++++++++++++++++++++++++++++++++++
 FatPkg/EnhancedFatDxe/Info.c |  40 +++
 3 files changed, 908 insertions(+)

diff --git a/FatPkg/EnhancedFatDxe/Fat.c b/FatPkg/EnhancedFatDxe/Fat.c
index 2e6c089..e29c64c 100644
--- a/FatPkg/EnhancedFatDxe/Fat.c
+++ b/FatPkg/EnhancedFatDxe/Fat.c
@@ -12,39 +12,103 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 **/
 
 #include "Fat.h"
 
+/**
+
+  Register Driver Binding protocol for this driver.
+
+  @param  ImageHandle           - Handle for the image of this driver.
+  @param  SystemTable           - Pointer to the EFI System Table.
+
+  @retval EFI_SUCCESS           - Driver loaded.
+  @return other                 - Driver not loaded.
+
+**/
 EFI_STATUS
 EFIAPI
 FatEntryPoint (
   IN EFI_HANDLE         ImageHandle,
   IN EFI_SYSTEM_TABLE   *SystemTable
   );
 
+/**
+
+  Unload function for this image. Uninstall DriverBinding protocol.
+
+  @param ImageHandle           - Handle for the image of this driver.
+
+  @retval EFI_SUCCESS           - Driver unloaded successfully.
+  @return other                 - Driver can not unloaded.
+
+**/
 EFI_STATUS
 EFIAPI
 FatUnload (
   IN EFI_HANDLE         ImageHandle
   );
 
+/**
+
+  Test to see if this driver can add a file system to ControllerHandle.
+  ControllerHandle must support both Disk IO and Block IO protocols.
+
+  @param  This                  - Protocol instance pointer.
+  @param  ControllerHandle      - Handle of device to test.
+  @param  RemainingDevicePath   - Not used.
+
+  @retval EFI_SUCCESS           - This driver supports this device.
+  @retval EFI_ALREADY_STARTED   - This driver is already running on this device.
+  @return other                 - This driver does not support this device.
+
+**/
 EFI_STATUS
 EFIAPI
 FatDriverBindingSupported (
   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
   IN EFI_HANDLE                   Controller,
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
   );
 
+/**
+
+  Start this driver on ControllerHandle by opening a Block IO and Disk IO
+  protocol, reading Device Path. Add a Simple File System protocol to
+  ControllerHandle if the media contains a valid file system.
+
+  @param  This                  - Protocol instance pointer.
+  @param  ControllerHandle      - Handle of device to bind driver to.
+  @param  RemainingDevicePath   - Not used.
+
+  @retval EFI_SUCCESS           - This driver is added to DeviceHandle.
+  @retval EFI_ALREADY_STARTED   - This driver is already running on DeviceHandle.
+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
+  @return other                 - This driver does not support this device.
+
+**/
 EFI_STATUS
 EFIAPI
 FatDriverBindingStart (
   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
   IN EFI_HANDLE                   Controller,
   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
   );
 
+/**
+
+  Stop this driver on ControllerHandle.
+
+  @param  This                  - Protocol instance pointer.
+  @param  ControllerHandle      - Handle of device to stop driver on.
+  @param  NumberOfChildren      - Not used.
+  @param  ChildHandleBuffer     - Not used.
+
+  @retval EFI_SUCCESS           - This driver is removed DeviceHandle.
+  @return other                 - This driver was not removed from this device.
+
+**/
 EFI_STATUS
 EFIAPI
 FatDriverBindingStop (
   IN  EFI_DRIVER_BINDING_PROTOCOL  *This,
   IN  EFI_HANDLE                   Controller,
diff --git a/FatPkg/EnhancedFatDxe/Fat.h b/FatPkg/EnhancedFatDxe/Fat.h
index 9490868..8355261 100644
--- a/FatPkg/EnhancedFatDxe/Fat.h
+++ b/FatPkg/EnhancedFatDxe/Fat.h
@@ -700,15 +700,54 @@ FatWriteEx (
 ;
 
 //
 // DiskCache.c
 //
+/**
+
+  Initialize the disk cache according to Volume's FatType.
+
+  @param  Volume                - FAT file system volume.
+
+  @retval EFI_SUCCESS           - The disk cache is successfully initialized.
+  @retval EFI_OUT_OF_RESOURCES  - Not enough memory to allocate disk cache.
+
+**/
 EFI_STATUS
 FatInitializeDiskCache (
   IN FAT_VOLUME              *Volume
   );
 
+/**
+
+  Read BufferSize bytes from the position of Offset into Buffer,
+  or write BufferSize bytes from Buffer into the position of Offset.
+
+  Base on the parameter of CACHE_DATA_TYPE, the data access will be divided into
+  the access of FAT cache (CACHE_FAT) and the access of Data cache (CACHE_DATA):
+
+  1. Access of FAT cache (CACHE_FAT): Access the data in the FAT cache, if there is cache
+     page hit, just return the cache page; else update the related cache page and return
+     the right cache page.
+  2. Access of Data cache (CACHE_DATA):
+     The access data will be divided into UnderRun data, Aligned data and OverRun data;
+     The UnderRun data and OverRun data will be accessed by the Data cache,
+     but the Aligned data will be accessed with disk directly.
+
+  @param  Volume                - FAT file system volume.
+  @param  CacheDataType         - The type of cache: CACHE_DATA or CACHE_FAT.
+  @param  IoMode                - Indicate the type of disk access.
+  @param  Offset                - The starting byte offset to read from.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing cache data.
+  @param  Task                    point to task instance.
+
+  @retval EFI_SUCCESS           - The data was accessed correctly.
+  @retval EFI_MEDIA_CHANGED     - The MediaId does not match the current device.
+  @return Others                - An error occurred when accessing cache.
+
+**/
 EFI_STATUS
 FatAccessCache (
   IN     FAT_VOLUME          *Volume,
   IN     CACHE_DATA_TYPE     CacheDataType,
   IN     IO_MODE             IoMode,
@@ -716,40 +755,107 @@ FatAccessCache (
   IN     UINTN               BufferSize,
   IN OUT UINT8               *Buffer,
   IN     FAT_TASK            *Task
   );
 
+/**
+
+  Flush all the dirty cache back, include the FAT cache and the Data cache.
+
+  @param  Volume                - FAT file system volume.
+  @param  Task                    point to task instance.
+
+  @retval EFI_SUCCESS           - Flush all the dirty cache back successfully
+  @return other                 - An error occurred when writing the data into the disk
+
+**/
 EFI_STATUS
 FatVolumeFlushCache (
   IN FAT_VOLUME              *Volume,
   IN FAT_TASK                *Task
   );
 
 //
 // Flush.c
 //
+/**
+
+  Flush the data associated with an open file.
+  In this implementation, only last Mod/Access time is updated.
+
+  @param  OFile                 - The open file.
+
+  @retval EFI_SUCCESS           - The OFile is flushed successfully.
+  @return Others                - An error occurred when flushing this OFile.
+
+**/
 EFI_STATUS
 FatOFileFlush (
   IN FAT_OFILE          *OFile
   );
 
+/**
+
+  Check the references of the OFile.
+  If the OFile (that is checked) is no longer
+  referenced, then it is freed.
+
+  @param  OFile                 - The OFile to be checked.
+
+  @retval TRUE                  - The OFile is not referenced and freed.
+  @retval FALSE                 - The OFile is kept.
+
+**/
 BOOLEAN
 FatCheckOFileRef (
   IN FAT_OFILE          *OFile
   );
 
+/**
+
+  Set the OFile and its child OFile with the error Status
+
+  @param  OFile                 - The OFile whose permanent error code is to be set.
+  @param  Status                - Error code to be set.
+
+**/
 VOID
 FatSetVolumeError (
   IN FAT_OFILE          *OFile,
   IN EFI_STATUS         Status
   );
 
+/**
+
+  Close the open file instance.
+
+  @param  IFile                 - Open file instance.
+
+  @retval EFI_SUCCESS           - Closed the file successfully.
+
+**/
 EFI_STATUS
 FatIFileClose (
   FAT_IFILE             *IFile
   );
 
+/**
+
+  Set error status for a specific OFile, reference checking the volume.
+  If volume is already marked as invalid, and all resources are freed
+  after reference checking, the file system protocol is uninstalled and
+  the volume structure is freed.
+
+  @param  Volume                - the Volume that is to be reference checked and unlocked.
+  @param  OFile                 - the OFile whose permanent error code is to be set.
+  @param  EfiStatus             - error code to be set.
+  @param  Task                    point to task instance.
+
+  @retval EFI_SUCCESS           - Clean up the volume successfully.
+  @return Others                - Cleaning up of the volume is failed.
+
+**/
 EFI_STATUS
 FatCleanupVolume (
   IN FAT_VOLUME         *Volume,
   IN FAT_OFILE          *OFile,
   IN EFI_STATUS         EfiStatus,
@@ -757,443 +863,1141 @@ FatCleanupVolume (
   );
 
 //
 // FileSpace.c
 //
+/**
+
+  Shrink the end of the open file base on the file size.
+
+  @param  OFile                 - The open file.
+
+  @retval EFI_SUCCESS           - Shrinked sucessfully.
+  @retval EFI_VOLUME_CORRUPTED  - There are errors in the file's clusters.
+
+**/
 EFI_STATUS
 FatShrinkEof (
   IN FAT_OFILE          *OFile
   );
 
+/**
+
+  Grow the end of the open file base on the NewSizeInBytes.
+
+  @param  OFile                 - The open file.
+  @param  NewSizeInBytes        - The new size in bytes of the open file.
+
+  @retval EFI_SUCCESS           - The file is grown sucessfully.
+  @retval EFI_UNSUPPORTED       - The file size is larger than 4GB.
+  @retval EFI_VOLUME_CORRUPTED  - There are errors in the files' clusters.
+  @retval EFI_VOLUME_FULL       - The volume is full and can not grow the file.
+
+**/
 EFI_STATUS
 FatGrowEof (
   IN FAT_OFILE          *OFile,
   IN UINT64             NewSizeInBytes
   );
 
+/**
+
+  Get the size of directory of the open file.
+
+  @param  Volume                - The File System Volume.
+  @param  Cluster               - The Starting cluster.
+
+  @return The physical size of the file starting at the input cluster, if there is error in the
+  cluster chain, the return value is 0.
+
+**/
 UINTN
 FatPhysicalDirSize (
   IN FAT_VOLUME         *Volume,
   IN UINTN              Cluster
   );
 
+/**
+
+  Get the physical size of a file on the disk.
+
+  @param  Volume                - The file system volume.
+  @param  RealSize              - The real size of a file.
+
+  @return The physical size of a file on the disk.
+
+**/
 UINT64
 FatPhysicalFileSize (
   IN FAT_VOLUME         *Volume,
   IN UINTN              RealSize
   );
 
+/**
+
+  Seek OFile to requested position, and calculate the number of
+  consecutive clusters from the position in the file
+
+  @param  OFile                 - The open file.
+  @param  Position              - The file's position which will be accessed.
+  @param  PosLimit              - The maximum length current reading/writing may access
+
+  @retval EFI_SUCCESS           - Set the info successfully.
+  @retval EFI_VOLUME_CORRUPTED  - Cluster chain corrupt.
+
+**/
 EFI_STATUS
 FatOFilePosition (
   IN FAT_OFILE            *OFile,
   IN UINTN                Position,
   IN UINTN                PosLimit
   );
 
+/**
+
+  Update the free cluster info of FatInfoSector of the volume.
+
+  @param  Volume                - FAT file system volume.
+
+**/
 VOID
 FatComputeFreeInfo (
   IN FAT_VOLUME         *Volume
   );
 
 //
 // Init.c
 //
+/**
+
+  Allocates volume structure, detects FAT file system, installs protocol,
+  and initialize cache.
+
+  @param  Handle                - The handle of parent device.
+  @param  DiskIo                - The DiskIo of parent device.
+  @param  DiskIo2               - The DiskIo2 of parent device.
+  @param  BlockIo               - The BlockIo of parent devicel
+
+  @retval EFI_SUCCESS           - Allocate a new volume successfully.
+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
+  @return Others                - Allocating a new volume failed.
+
+**/
 EFI_STATUS
 FatAllocateVolume (
   IN  EFI_HANDLE                     Handle,
   IN  EFI_DISK_IO_PROTOCOL           *DiskIo,
   IN  EFI_DISK_IO2_PROTOCOL          *DiskIo2,
   IN  EFI_BLOCK_IO_PROTOCOL          *BlockIo
   );
 
+/**
+
+  Detects FAT file system on Disk and set relevant fields of Volume.
+
+  @param Volume                - The volume structure.
+
+  @retval EFI_SUCCESS           - The Fat File System is detected successfully
+  @retval EFI_UNSUPPORTED       - The volume is not FAT file system.
+  @retval EFI_VOLUME_CORRUPTED  - The volume is corrupted.
+
+**/
 EFI_STATUS
 FatOpenDevice (
   IN OUT FAT_VOLUME     *Volume
   );
 
+/**
+
+  Called by FatDriverBindingStop(), Abandon the volume.
+
+  @param  Volume                - The volume to be abandoned.
+
+  @retval EFI_SUCCESS           - Abandoned the volume successfully.
+  @return Others                - Can not uninstall the protocol interfaces.
+
+**/
 EFI_STATUS
 FatAbandonVolume (
   IN FAT_VOLUME         *Volume
   );
 
 //
 // Misc.c
 //
+/**
+
+  Create the task
+
+  @param  IFile                 - The instance of the open file.
+  @param  Token                 - A pointer to the token associated with the transaction.
+
+  @return FAT_TASK *            - Return the task instance.
+
+**/
 FAT_TASK *
 FatCreateTask (
   FAT_IFILE           *IFile,
   EFI_FILE_IO_TOKEN   *Token
   );
 
+/**
+
+  Destroy the task.
+
+  @param  Task                  - The task to be destroyed.
+
+**/
 VOID
 FatDestroyTask (
   FAT_TASK            *Task
   );
 
+/**
+
+  Wait all non-blocking requests complete.
+
+  @param  IFile                 - The instance of the open file.
+
+**/
 VOID
 FatWaitNonblockingTask (
   FAT_IFILE           *IFile
   );
 
+/**
+
+  Remove the subtask from subtask list.
+
+  @param  Subtask               - The subtask to be removed.
+
+  @return LIST_ENTRY *          - The next node in the list.
+
+**/
 LIST_ENTRY *
 FatDestroySubtask (
   FAT_SUBTASK         *Subtask
   );
 
+/**
+
+  Execute the task.
+
+  @param  IFile                 - The instance of the open file.
+  @param  Task                  - The task to be executed.
+
+  @retval EFI_SUCCESS           - The task was executed sucessfully.
+  @return other                 - An error occurred when executing the task.
+
+**/
 EFI_STATUS
 FatQueueTask (
   IN FAT_IFILE        *IFile,
   IN FAT_TASK         *Task
   );
 
+/**
+
+  Set the volume as dirty or not.
+
+  @param  Volume                - FAT file system volume.
+  @param  IoMode                - The access mode.
+  @param  DirtyValue            - Set the volume as dirty or not.
+
+  @retval EFI_SUCCESS           - Set the new FAT entry value sucessfully.
+  @return other                 - An error occurred when operation the FAT entries.
+
+**/
 EFI_STATUS
 FatAccessVolumeDirty (
   IN FAT_VOLUME         *Volume,
   IN IO_MODE            IoMode,
   IN VOID               *DirtyValue
   );
 
+/**
+
+  General disk access function.
+
+  @param  Volume                - FAT file system volume.
+  @param  IoMode                - The access mode (disk read/write or cache access).
+  @param  Offset                - The starting byte offset to read from.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing read data.
+  @param  Task                    point to task instance.
+
+  @retval EFI_SUCCESS           - The operation is performed successfully.
+  @retval EFI_VOLUME_CORRUPTED  - The accesss is
+  @return Others                - The status of read/write the disk
+
+**/
 EFI_STATUS
 FatDiskIo (
   IN FAT_VOLUME         *Volume,
   IN IO_MODE            IoMode,
   IN UINT64             Offset,
   IN UINTN              BufferSize,
   IN OUT VOID           *Buffer,
   IN FAT_TASK           *Task
   );
 
+/**
+
+  Lock the volume.
+
+**/
 VOID
 FatAcquireLock (
   VOID
   );
 
+/**
+
+  Unlock the volume.
+
+**/
 VOID
 FatReleaseLock (
   VOID
   );
 
+/**
+
+  Lock the volume.
+  If the lock is already in the acquired state, then EFI_ACCESS_DENIED is returned.
+  Otherwise, EFI_SUCCESS is returned.
+
+  @retval EFI_SUCCESS           - The volume is locked.
+  @retval EFI_ACCESS_DENIED     - The volume could not be locked because it is already locked.
+
+**/
 EFI_STATUS
 FatAcquireLockOrFail (
   VOID
   );
 
+/**
+
+  Free directory entry.
+
+  @param  DirEnt                - The directory entry to be freed.
+
+**/
 VOID
 FatFreeDirEnt (
   IN FAT_DIRENT         *DirEnt
   );
 
+/**
+
+  Free volume structure (including the contents of directory cache and disk cache).
+
+  @param  Volume                - The volume structure to be freed.
+
+**/
 VOID
 FatFreeVolume (
   IN FAT_VOLUME         *Volume
   );
 
+/**
+
+  Translate EFI time to FAT time.
+
+  @param  ETime                 - The time of EFI_TIME.
+  @param  FTime                 - The time of FAT_DATE_TIME.
+
+**/
 VOID
 FatEfiTimeToFatTime (
   IN EFI_TIME           *ETime,
   OUT FAT_DATE_TIME     *FTime
   );
 
+/**
+
+  Translate Fat time to EFI time.
+
+  @param  FTime                 - The time of FAT_DATE_TIME.
+  @param  ETime                 - The time of EFI_TIME..
+
+**/
 VOID
 FatFatTimeToEfiTime (
   IN FAT_DATE_TIME      *FTime,
   OUT EFI_TIME          *ETime
   );
 
+/**
+
+  Get Current FAT time.
+
+  @param  FatTime               - Current FAT time.
+
+**/
 VOID
 FatGetCurrentFatTime (
   OUT FAT_DATE_TIME     *FatTime
   );
 
+/**
+
+  Check whether a time is valid.
+
+  @param  Time                  - The time of EFI_TIME.
+
+  @retval TRUE                  - The time is valid.
+  @retval FALSE                 - The time is not valid.
+
+**/
 BOOLEAN
 FatIsValidTime (
   IN EFI_TIME           *Time
   );
 
 //
 // UnicodeCollation.c
 //
+/**
+  Initialize Unicode Collation support.
+
+  It tries to locate Unicode Collation 2 protocol and matches it with current
+  platform language code. If for any reason the first attempt fails, it then tries to
+  use Unicode Collation Protocol.
+
+  @param  AgentHandle          The handle used to open Unicode Collation (2) protocol.
+
+  @retval EFI_SUCCESS          The Unicode Collation (2) protocol has been successfully located.
+  @retval Others               The Unicode Collation (2) protocol has not been located.
+
+**/
 EFI_STATUS
 InitializeUnicodeCollationSupport (
   IN EFI_HANDLE    AgentHandle
   );
 
+/**
+  Convert FAT string to unicode string.
+
+  @param  FatSize               The size of FAT string.
+  @param  Fat                   The FAT string.
+  @param  String                The unicode string.
+
+  @return None.
+
+**/
 VOID
 FatFatToStr (
   IN UINTN              FatSize,
   IN CHAR8              *Fat,
   OUT CHAR16            *String
   );
 
+/**
+  Convert unicode string to Fat string.
+
+  @param  String                The unicode string.
+  @param  FatSize               The size of the FAT string.
+  @param  Fat                   The FAT string.
+
+  @retval TRUE                  Convert successfully.
+  @retval FALSE                 Convert error.
+
+**/
 BOOLEAN
 FatStrToFat (
   IN  CHAR16            *String,
   IN  UINTN             FatSize,
   OUT CHAR8             *Fat
   );
 
+/**
+  Lowercase a string
+
+  @param  Str                   The string which will be lower-cased.
+
+**/
 VOID
 FatStrLwr (
   IN CHAR16             *Str
   );
 
+/**
+  Uppercase a string.
+
+  @param  Str                   The string which will be upper-cased.
+
+**/
 VOID
 FatStrUpr (
   IN CHAR16             *Str
   );
 
+/**
+  Performs a case-insensitive comparison of two Null-terminated Unicode strings.
+
+  @param  Str1                   A pointer to a Null-terminated Unicode string.
+  @param  Str2                   A pointer to a Null-terminated Unicode string.
+
+  @retval 0                    S1 is equivalent to S2.
+  @retval >0                   S1 is lexically greater than S2.
+  @retval <0                   S1 is lexically less than S2.
+**/
 INTN
 FatStriCmp (
   IN CHAR16             *Str1,
   IN CHAR16             *Str2
   );
 
 //
 // Open.c
 //
+
+/**
+
+  Open a file for a file name relative to an existing OFile.
+  The IFile of the newly opened file is passed out.
+
+  @param  OFile                 - The file that serves as a starting reference point.
+  @param  NewIFile              - The newly generated IFile instance.
+  @param  FileName              - The file name relative to the OFile.
+  @param  OpenMode              - Open mode.
+  @param  Attributes            - Attributes to set if the file is created.
+
+
+  @retval EFI_SUCCESS           - Open the file successfully.
+  @retval EFI_INVALID_PARAMETER - The open mode is conflict with the attributes
+                          or the file name is not valid.
+  @retval EFI_NOT_FOUND         - Conficts between dir intention and attribute.
+  @retval EFI_WRITE_PROTECTED   - Can't open for write if the volume is read only.
+  @retval EFI_ACCESS_DENIED     - If the file's attribute is read only, and the
+                          open is for read-write fail it.
+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
+
+**/
 EFI_STATUS
 FatOFileOpen (
   IN FAT_OFILE          *OFile,
   OUT FAT_IFILE         **NewIFile,
   IN CHAR16             *FileName,
   IN UINT64             OpenMode,
   IN UINT8              Attributes
   );
 
+/**
+
+  Create an Open instance for the existing OFile.
+  The IFile of the newly opened file is passed out.
+
+  @param  OFile                 - The file that serves as a starting reference point.
+  @param  PtrIFile              - The newly generated IFile instance.
+
+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory for the IFile
+  @retval EFI_SUCCESS           - Create the new IFile for the OFile successfully
+
+**/
 EFI_STATUS
 FatAllocateIFile (
   IN FAT_OFILE          *OFile,
   OUT FAT_IFILE         **PtrIFile
   );
 
 //
 // OpenVolume.c
 //
+/**
+
+  Implements Simple File System Protocol interface function OpenVolume().
+
+  @param  This                  - Calling context.
+  @param  File                  - the Root Directory of the volume.
+
+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
+  @retval EFI_VOLUME_CORRUPTED  - The FAT type is error.
+  @retval EFI_SUCCESS           - Open the volume successfully.
+
+**/
 EFI_STATUS
 EFIAPI
 FatOpenVolume (
   IN  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
   OUT EFI_FILE_PROTOCOL               **File
   );
 
 //
 // ReadWrite.c
 //
+/**
+
+  This function reads data from a file or writes data to a file.
+  It uses OFile->PosRem to determine how much data can be accessed in one time.
+
+  @param  OFile                 - The open file.
+  @param  IoMode                - Indicate whether the access mode is reading or writing.
+  @param  Position              - The position where data will be accessed.
+  @param  DataBufferSize        - Size of Buffer.
+  @param  UserBuffer            - Buffer containing data.
+  @param  Task                    point to task instance.
+
+  @retval EFI_SUCCESS           - Access the data successfully.
+  @return other                 - An error occurred when operating on the disk.
+
+**/
 EFI_STATUS
 FatAccessOFile (
   IN FAT_OFILE          *OFile,
   IN IO_MODE            IoMode,
   IN UINTN              Position,
   IN UINTN              *DataBufferSize,
   IN UINT8              *UserBuffer,
   IN FAT_TASK           *Task
   );
 
+/**
+
+  Expand OFile by appending zero bytes at the end of OFile.
+
+  @param  OFile                 - The open file.
+  @param  ExpandedSize          - The number of zero bytes appended at the end of the file.
+
+  @retval EFI_SUCCESS           - The file is expanded successfully.
+  @return other                 - An error occurred when expanding file.
+
+**/
 EFI_STATUS
 FatExpandOFile (
   IN FAT_OFILE          *OFile,
   IN UINT64             ExpandedSize
   );
 
+/**
+
+  Write zero pool from the WritePos to the end of OFile.
+
+  @param  OFile                 - The open file to write zero pool.
+  @param  WritePos              - The number of zero bytes written.
+
+  @retval EFI_SUCCESS           - Write the zero pool successfully.
+  @retval EFI_OUT_OF_RESOURCES  - Not enough memory to perform the operation.
+  @return other                 - An error occurred when writing disk.
+
+**/
 EFI_STATUS
 FatWriteZeroPool (
   IN FAT_OFILE          *OFile,
   IN UINTN              WritePos
   );
 
+/**
+
+  Truncate the OFile to smaller file size.
+
+  @param  OFile                 - The open file.
+  @param  TruncatedSize         - The new file size.
+
+  @retval EFI_SUCCESS           - The file is truncated successfully.
+  @return other                 - An error occurred when truncating file.
+
+**/
 EFI_STATUS
 FatTruncateOFile (
   IN FAT_OFILE          *OFile,
   IN UINTN              TruncatedSize
   );
 
 //
 // DirectoryManage.c
 //
+/**
+
+  Set the OFile's current directory cursor to the list head.
+
+  @param OFile                 - The directory OFile whose directory cursor is reset.
+
+**/
 VOID
 FatResetODirCursor (
   IN FAT_OFILE          *OFile
   );
 
+/**
+
+  Set the directory's cursor to the next and get the next directory entry.
+
+  @param  OFile                 - The parent OFile.
+  @param PtrDirEnt             - The next directory entry.
+
+  @retval EFI_SUCCESS           - We get the next directory entry successfully.
+  @return other                 - An error occurred when get next directory entry.
+
+**/
 EFI_STATUS
 FatGetNextDirEnt (
   IN  FAT_OFILE         *OFile,
   OUT FAT_DIRENT        **PtrDirEnt
   );
 
+/**
+
+  Remove this directory entry node from the list of directory entries and hash table.
+
+  @param  OFile                - The parent OFile.
+  @param  DirEnt               - The directory entry to be removed.
+
+  @retval EFI_SUCCESS          - The directory entry is successfully removed.
+  @return other                - An error occurred when removing the directory entry.
+
+**/
 EFI_STATUS
 FatRemoveDirEnt (
   IN FAT_OFILE          *OFile,
   IN FAT_DIRENT         *DirEnt
   );
 
+/**
+
+  Save the directory entry to disk.
+
+  @param  OFile                 - The parent OFile which needs to update.
+  @param  DirEnt                - The directory entry to be saved.
+
+  @retval EFI_SUCCESS           - Store the directory entry successfully.
+  @return other                 - An error occurred when writing the directory entry.
+
+**/
 EFI_STATUS
 FatStoreDirEnt (
   IN FAT_OFILE          *OFile,
   IN FAT_DIRENT         *DirEnt
   );
 
+/**
+
+  Create a directory entry in the parent OFile.
+
+  @param  OFile                 - The parent OFile.
+  @param  FileName              - The filename of the newly-created directory entry.
+  @param  Attributes            - The attribute of the newly-created directory entry.
+  @param  PtrDirEnt             - The pointer to the newly-created directory entry.
+
+  @retval EFI_SUCCESS           - The directory entry is successfully created.
+  @retval EFI_OUT_OF_RESOURCES  - Not enough memory to create the directory entry.
+  @return other                 - An error occurred when creating the directory entry.
+
+**/
 EFI_STATUS
 FatCreateDirEnt (
   IN  FAT_OFILE         *OFile,
   IN  CHAR16            *FileName,
   IN  UINT8             Attributes,
   OUT FAT_DIRENT        **PtrDirEnt
   );
 
+/**
+
+  Determine whether the directory entry is "." or ".." entry.
+
+  @param  DirEnt               - The corresponding directory entry.
+
+  @retval TRUE                 - The directory entry is "." or ".." directory entry
+  @retval FALSE                - The directory entry is not "." or ".." directory entry
+
+**/
 BOOLEAN
 FatIsDotDirEnt (
   IN FAT_DIRENT         *DirEnt
   );
 
+/**
+
+  Set the OFile's cluster and size info in its directory entry.
+
+  @param  OFile                 - The corresponding OFile.
+
+**/
 VOID
 FatUpdateDirEntClusterSizeInfo (
   IN FAT_OFILE          *OFile
   );
 
+/**
+
+  Copy all the information of DirEnt2 to DirEnt1 except for 8.3 name.
+
+  @param  DirEnt1               - The destination directory entry.
+  @param  DirEnt2               - The source directory entry.
+
+**/
 VOID
 FatCloneDirEnt (
   IN  FAT_DIRENT        *DirEnt1,
   IN  FAT_DIRENT        *DirEnt2
   );
 
+/**
+
+  Get the directory entry's info into Buffer.
+
+  @param  Volume                - FAT file system volume.
+  @param  DirEnt                - The corresponding directory entry.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing file info.
+
+  @retval EFI_SUCCESS           - Get the file info successfully.
+  @retval EFI_BUFFER_TOO_SMALL  - The buffer is too small.
+
+**/
 EFI_STATUS
 FatGetDirEntInfo (
   IN FAT_VOLUME         *Volume,
   IN FAT_DIRENT         *DirEnt,
   IN OUT UINTN          *BufferSize,
   OUT VOID              *Buffer
   );
 
+/**
+
+  Open the directory entry to get the OFile.
+
+  @param  Parent                - The parent OFile.
+  @param  DirEnt                - The directory entry to be opened.
+
+  @retval EFI_SUCCESS           - The directory entry is successfully opened.
+  @retval EFI_OUT_OF_RESOURCES  - not enough memory to allocate a new OFile.
+  @return other                 - An error occurred when opening the directory entry.
+
+**/
 EFI_STATUS
 FatOpenDirEnt (
   IN FAT_OFILE          *OFile,
   IN FAT_DIRENT         *DirEnt
   );
 
+/**
+
+  Create "." and ".." directory entries in the newly-created parent OFile.
+
+  @param  OFile                 - The parent OFile.
+
+  @retval EFI_SUCCESS           - The dot directory entries are successfully created.
+  @return other                 - An error occurred when creating the directory entry.
+
+**/
 EFI_STATUS
 FatCreateDotDirEnts (
   IN FAT_OFILE          *OFile
   );
 
+/**
+
+  Close the directory entry and free the OFile.
+
+  @param  DirEnt               - The directory entry to be closed.
+
+**/
 VOID
 FatCloseDirEnt (
   IN FAT_DIRENT         *DirEnt
   );
 
+/**
+
+  Traverse filename and open all OFiles that can be opened.
+  Update filename pointer to the component that can't be opened.
+  If more than one name component remains, returns an error;
+  otherwise, return the remaining name component so that the caller might choose to create it.
+
+  @param  PtrOFile              - As input, the reference OFile; as output, the located OFile.
+  @param  FileName              - The file name relevant to the OFile.
+  @param  Attributes            - The attribute of the destination OFile.
+  @param  NewFileName           - The remaining file name.
+
+  @retval EFI_NOT_FOUND         - The file name can't be opened and there is more than one
+                          components within the name left (this means the name can
+                          not be created either).
+  @retval EFI_INVALID_PARAMETER - The parameter is not valid.
+  @retval EFI_SUCCESS           - Open the file successfully.
+  @return other                 - An error occured when locating the OFile.
+
+**/
 EFI_STATUS
 FatLocateOFile (
   IN OUT FAT_OFILE      **PtrOFile,
   IN     CHAR16         *FileName,
   IN     UINT8          Attributes,
      OUT CHAR16         *NewFileName
   );
 
+/**
+
+  Get the directory entry for the volume.
+
+  @param  Volume                - FAT file system volume.
+  @param  Name                  - The file name of the volume.
+
+  @retval EFI_SUCCESS           - Update the volume with the directory entry sucessfully.
+  @return others                - An error occurred when getting volume label.
+
+**/
 EFI_STATUS
 FatGetVolumeEntry (
   IN FAT_VOLUME         *Volume,
   IN CHAR16             *Name
   );
 
+/**
+
+  Set the relevant directory entry into disk for the volume.
+
+  @param  Volume              - FAT file system volume.
+  @param  Name                - The new file name of the volume.
+
+  @retval EFI_SUCCESS         - Update the Volume sucessfully.
+  @retval EFI_UNSUPPORTED     - The input label is not a valid volume label.
+  @return other               - An error occurred when setting volume label.
+
+**/
 EFI_STATUS
 FatSetVolumeEntry (
   IN FAT_VOLUME         *Volume,
   IN CHAR16             *Name
   );
 
 //
 // Hash.c
 //
+/**
+
+  Search the long name hash table for the directory entry.
+
+  @param  ODir                  - The directory to be searched.
+  @param  LongNameString        - The long name string to search.
+
+  @return The previous long name hash node of the directory entry.
+
+**/
 FAT_DIRENT **
 FatLongNameHashSearch (
   IN FAT_ODIR           *ODir,
   IN CHAR16             *LongNameString
   );
 
+/**
+
+  Search the short name hash table for the directory entry.
+
+  @param  ODir                  - The directory to be searched.
+  @param  ShortNameString       - The short name string to search.
+
+  @return The previous short name hash node of the directory entry.
+
+**/
 FAT_DIRENT **
 FatShortNameHashSearch (
   IN FAT_ODIR           *ODir,
   IN CHAR8              *ShortNameString
   );
 
+/**
+
+  Insert directory entry to hash table.
+
+  @param  ODir                  - The parent directory.
+  @param  DirEnt                - The directory entry node.
+
+**/
 VOID
 FatInsertToHashTable (
   IN FAT_ODIR           *ODir,
   IN FAT_DIRENT         *DirEnt
   );
 
+/**
+
+  Delete directory entry from hash table.
+
+  @param  ODir                  - The parent directory.
+  @param  DirEnt                - The directory entry node.
+
+**/
 VOID
 FatDeleteFromHashTable (
   IN FAT_ODIR           *ODir,
   IN FAT_DIRENT         *DirEnt
   );
 
 //
 // FileName.c
 //
+/**
+
+  This function checks whether the input FileName is a valid 8.3 short name.
+  If the input FileName is a valid 8.3, the output is the 8.3 short name;
+  otherwise, the output is the base tag of 8.3 short name.
+
+  @param  FileName              - The input unicode filename.
+  @param  File8Dot3Name         - The output ascii 8.3 short name or base tag of 8.3 short name.
+
+  @retval TRUE                  - The input unicode filename is a valid 8.3 short name.
+  @retval FALSE                 - The input unicode filename is not a valid 8.3 short name.
+
+**/
 BOOLEAN
 FatCheckIs8Dot3Name (
   IN CHAR16             *FileName,
   OUT CHAR8             *File8Dot3Name
   );
 
+/**
+
+  This function generates 8Dot3 name from user specified name for a newly created file.
+
+  @param  Parent                - The parent directory.
+  @param  DirEnt                - The directory entry whose 8Dot3Name needs to be generated.
+
+**/
 VOID
 FatCreate8Dot3Name (
   IN FAT_OFILE          *Parent,
   IN FAT_DIRENT         *DirEnt
   );
 
+/**
+
+  Convert the ascii fat name to the unicode string and strip trailing spaces,
+  and if necessary, convert the unicode string to lower case.
+
+  @param  FatName               - The Char8 string needs to be converted.
+  @param  Len                   - The length of the fat name.
+  @param  LowerCase             - Indicate whether to convert the string to lower case.
+  @param  Str                   - The result of the convertion.
+
+**/
 VOID
 FatNameToStr (
   IN CHAR8              *FatName,
   IN UINTN              Len,
   IN UINTN              LowerCase,
   IN CHAR16             *Str
   );
 
+/**
+
+  Set the caseflag value for the directory entry.
+
+  @param DirEnt                - The logical directory entry whose caseflag value is to be set.
+
+**/
 VOID
 FatSetCaseFlag (
   IN FAT_DIRENT         *DirEnt
   );
 
+/**
+
+  Convert the 8.3 ASCII fat name to cased Unicode string according to case flag.
+
+  @param  DirEnt                - The corresponding directory entry.
+  @param  FileString            - The output Unicode file name.
+  @param  FileStringMax           The max length of FileString.
+
+**/
 VOID
 FatGetFileNameViaCaseFlag (
   IN     FAT_DIRENT     *DirEnt,
   IN OUT CHAR16         *FileString,
   IN     UINTN          FileStringMax
   );
 
+/**
+
+  Get the Check sum for a short name.
+
+  @param  ShortNameString       - The short name for a file.
+
+  @retval Sum                   - UINT8 checksum.
+
+**/
 UINT8
 FatCheckSum (
   IN CHAR8              *ShortNameString
   );
 
+/**
+
+  Takes Path as input, returns the next name component
+  in Name, and returns the position after Name (e.g., the
+  start of the next name component)
+
+  @param  Path                  - The path of one file.
+  @param  Name                  - The next name component in Path.
+
+  The position after Name in the Path
+
+**/
 CHAR16*
 FatGetNextNameComponent (
   IN  CHAR16            *Path,
   OUT CHAR16            *Name
   );
 
+/**
+
+  Check whether the IFileName is valid long file name. If the IFileName is a valid
+  long file name, then we trim the possible leading blanks and leading/trailing dots.
+  the trimmed filename is stored in OutputFileName
+
+  @param  InputFileName         - The input file name.
+  @param  OutputFileName        - The output file name.
+
+  @retval TRUE                  - The InputFileName is a valid long file name.
+  @retval FALSE                 - The InputFileName is not a valid long file name.
+
+**/
 BOOLEAN
 FatFileNameIsValid (
   IN  CHAR16  *InputFileName,
   OUT CHAR16  *OutputFileName
   );
 
 //
 // DirectoryCache.c
 //
+/**
+
+  Discard the directory structure when an OFile will be freed.
+  Volume will cache this directory if the OFile does not represent a deleted file.
+
+  @param  OFile                 - The OFile whose directory structure is to be discarded.
+
+**/
 VOID
 FatDiscardODir (
   IN FAT_OFILE    *OFile
   );
 
+/**
+
+  Request the directory structure when an OFile is newly generated.
+  If the directory structure is cached by volume, then just return this directory;
+  Otherwise, allocate a new one for OFile.
+
+  @param  OFile                 - The OFile which requests directory structure.
+
+**/
 VOID
 FatRequestODir (
   IN FAT_OFILE    *OFile
   );
 
+/**
+
+  Clean up all the cached directory structures when the volume is going to be abandoned.
+
+  @param  Volume                - FAT file system volume.
+
+**/
 VOID
 FatCleanupODirCache (
   IN FAT_VOLUME   *Volume
   );
 
diff --git a/FatPkg/EnhancedFatDxe/Info.c b/FatPkg/EnhancedFatDxe/Info.c
index 1a7f828..50b840b 100644
--- a/FatPkg/EnhancedFatDxe/Info.c
+++ b/FatPkg/EnhancedFatDxe/Info.c
@@ -14,24 +14,64 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
 **/
 
 #include "Fat.h"
 
+/**
+
+  Get the volume's info into Buffer.
+
+  @param  Volume                - FAT file system volume.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing volume info.
+
+  @retval EFI_SUCCESS           - Get the volume info successfully.
+  @retval EFI_BUFFER_TOO_SMALL  - The buffer is too small.
+
+**/
 EFI_STATUS
 FatGetVolumeInfo (
   IN FAT_VOLUME       *Volume,
   IN OUT UINTN        *BufferSize,
   OUT VOID            *Buffer
   );
 
+/**
+
+  Set the volume's info.
+
+  @param  Volume                - FAT file system volume.
+  @param  BufferSize            - Size of Buffer.
+  @param  Buffer                - Buffer containing the new volume info.
+
+  @retval EFI_SUCCESS           - Set the volume info successfully.
+  @retval EFI_BAD_BUFFER_SIZE   - The buffer size is error.
+  @retval EFI_WRITE_PROTECTED   - The volume is read only.
+  @return other                 - An error occurred when operation the disk.
+
+**/
 EFI_STATUS
 FatSetVolumeInfo (
   IN FAT_VOLUME       *Volume,
   IN UINTN            BufferSize,
   IN VOID            *Buffer
   );
 
+/**
+
+  Set or Get the some types info of the file into Buffer.
+
+  @param  IsSet      - TRUE:The access is set, else is get
+  @param  FHand      - The handle of file
+  @param  Type       - The type of the info
+  @param  BufferSize - Size of Buffer
+  @param  Buffer     - Buffer containing volume info
+
+  @retval EFI_SUCCESS       - Get the info successfully
+  @retval EFI_DEVICE_ERROR  - Can not find the OFile for the file
+
+**/
 EFI_STATUS
 FatSetOrGetInfo (
   IN BOOLEAN              IsSet,
   IN EFI_FILE_PROTOCOL    *FHand,
   IN EFI_GUID             *Type,
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [patch 8/8] FatPkg: Fix format issues in dec/inf/dsc files
  2016-12-08 10:54 [patch 0/8] FatPkg: Fix coding style issues Dandan Bi
                   ` (6 preceding siblings ...)
  2016-12-08 10:54 ` [patch 7/8] FatPkg\EnhancedFatDxe: Add comments for functions Dandan Bi
@ 2016-12-08 10:54 ` Dandan Bi
  2016-12-09  1:09   ` Ni, Ruiyu
  7 siblings, 1 reply; 27+ messages in thread
From: Dandan Bi @ 2016-12-08 10:54 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ruiyu Ni

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/Fat.inf | 2 +-
 FatPkg/FatPei/FatPei.inf      | 6 +++---
 FatPkg/FatPkg.dec             | 1 -
 FatPkg/FatPkg.dsc             | 3 +--
 4 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/FatPkg/EnhancedFatDxe/Fat.inf b/FatPkg/EnhancedFatDxe/Fat.inf
index 158f34c..e7044cd 100644
--- a/FatPkg/EnhancedFatDxe/Fat.inf
+++ b/FatPkg/EnhancedFatDxe/Fat.inf
@@ -1,7 +1,7 @@
 ## @file
-#  Component description file for FAT module.
+#  Component Description File for FAT module.
 #
 #  This UEFI driver detects the FAT file system in the disk.
 #  It also produces the Simple File System protocol for the consumer to
 #  perform file and directory operations on the disk.
 #  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
diff --git a/FatPkg/FatPei/FatPei.inf b/FatPkg/FatPei/FatPei.inf
index 1409e28..273f72d 100644
--- a/FatPkg/FatPei/FatPei.inf
+++ b/FatPkg/FatPei/FatPei.inf
@@ -59,13 +59,13 @@ [Guids]
   gRecoveryOnFatIdeDiskGuid                   ## SOMETIMES_CONSUMES   ## UNDEFINED
   gRecoveryOnFatFloppyDiskGuid                ## SOMETIMES_CONSUMES   ## UNDEFINED
 
 
 [Ppis]
-  gEfiPeiVirtualBlockIoPpiGuid                  # PPI_NOTIFY SOMETIMES_CONSUMED
-  gEfiPeiVirtualBlockIo2PpiGuid                 # PPI_NOTIFY SOMETIMES_CONSUMED
-  gEfiPeiDeviceRecoveryModulePpiGuid            # SOMETIMES_PRODUCED
+  gEfiPeiVirtualBlockIoPpiGuid                  ## SOMETIMES_CONSUMES PPI_NOTIFY
+  gEfiPeiVirtualBlockIo2PpiGuid                 ## SOMETIMES_CONSUMES PPI_NOTIFY
+  gEfiPeiDeviceRecoveryModulePpiGuid            ## SOMETIMES_PRODUCES
 
 
 [FeaturePcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport         ## CONSUMES
 
diff --git a/FatPkg/FatPkg.dec b/FatPkg/FatPkg.dec
index e898d95..8bdddb1 100644
--- a/FatPkg/FatPkg.dec
+++ b/FatPkg/FatPkg.dec
@@ -1,7 +1,6 @@
 ## @file
-#
 #  FAT Package
 #
 #  FAT 32 Driver
 #  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
 #
diff --git a/FatPkg/FatPkg.dsc b/FatPkg/FatPkg.dsc
index d654120..841201c 100644
--- a/FatPkg/FatPkg.dsc
+++ b/FatPkg/FatPkg.dsc
@@ -1,8 +1,7 @@
 ## @file
-#
-#  Build Binary Enhanced Fat Driver Modules
+#  Build Binary Enhanced Fat Driver Modules.
 #
 #  This Platform file is used to generate the Binary Fat Drivers
 #  for EDK II Prime release.
 #  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
 #
-- 
1.9.5.msysgit.1



^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration
  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-08 23:47     ` Yao, Jiewen
  2016-12-09  0:57   ` Ni, Ruiyu
  1 sibling, 2 replies; 27+ messages in thread
From: Kurt Kennett @ 2016-12-08 17:27 UTC (permalink / raw)
  To: Dandan Bi, edk2-devel@lists.01.org; +Cc: Ruiyu Ni

This seems kind of silly.
Why isn't this just const data?  This adds code and memory accesses that are worthless and happen on every call to the function.

K2

-----Original Message-----
From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Dandan Bi
Sent: Thursday, December 8, 2016 2:54 AM
To: edk2-devel@lists.01.org
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Subject: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration

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/Misc.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/FatPkg/EnhancedFatDxe/Misc.c b/FatPkg/EnhancedFatDxe/Misc.c index f91759c..6ad688c 100644
--- a/FatPkg/EnhancedFatDxe/Misc.c
+++ b/FatPkg/EnhancedFatDxe/Misc.c
@@ -696,15 +696,27 @@ Returns:
   TRUE                  - The time is valid.
   FALSE                 - The time is not valid.
 
 --*/
 {
-  static UINT8  MonthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
+  STATIC UINT8  MonthDays[12];
   UINTN         Day;
   BOOLEAN       ValidTime;
 
   ValidTime = TRUE;
+  MonthDays[0] = 31;
+  MonthDays[1] = 28;
+  MonthDays[2] = 31;
+  MonthDays[3] = 30;
+  MonthDays[4] = 31;
+  MonthDays[5] = 30;
+  MonthDays[6] = 31;
+  MonthDays[7] = 31;
+  MonthDays[8] = 30;
+  MonthDays[9] = 31;
+  MonthDays[10] = 30;
+  MonthDays[11] = 31;
 
   //
   // Check the fields for range problems
   // Fat can only support from 1980
   //
--
1.9.5.msysgit.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration
  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
  1 sibling, 1 reply; 27+ messages in thread
From: Andrew Fish @ 2016-12-08 23:11 UTC (permalink / raw)
  To: Kurt Kennett; +Cc: Dandan Bi, edk2-devel@lists.01.org, Ruiyu Ni


> On Dec 8, 2016, at 9:27 AM, Kurt Kennett <Kurt.Kennett@microsoft.com> wrote:
> 
> This seems kind of silly.
> Why isn't this just const data?  This adds code and memory accesses that are worthless and happen on every call to the function.
> 

K2,

I think this is an attempt to conform to the coding standard?

I do agree it is pointless to make it static if you are going to initialize it every time. Seems like it would have been better to make this a global variable. 

Given that a static local variable is very much like a global that is limited in scope it may make sense to relax the coding standard in this regard (I did not re-read the coding standard so hopefully this is not a bad assumption), or just require pre-initialized local static variables to be globals?


In this simple example you can see that a local static variable that is initialized ends up with code generation that is very close to a global variable. The name is not global and it is mangled with the function name. The other interesting tidbit is the compiler realized the static was const and marked it as such. 

~/work/Compiler>cat static.c
const unsigned char gMonthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 131 };

int test (int i)
{
  static unsigned char MonthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

  return MonthDays[i];
}
~/work/Compiler>clang -S -Os static.c
~/work/Compiler>cat static.S
	.section	__TEXT,__text,regular,pure_instructions
	.globl	_test
_test:                                  ## @test
	pushq	%rbp
	movq	%rsp, %rbp
	movslq	%edi, %rax
	leaq	_test.MonthDays(%rip), %rcx
	movzbl	(%rax,%rcx), %eax
	popq	%rbp
	retq

	.section	__TEXT,__const
	.globl	_gMonthDays             ## @gMonthDays
_gMonthDays:
	.ascii	"\037\034\037\036\037\036\037\037\036\037\036\203"

_test.MonthDays:                        ## @test.MonthDays
	.ascii	"\037\034\037\036\037\036\037\037\036\037\036\037"

Note: I had to make gMonthDays different than _test.MonthDays or _test.MonthDays gets optimized out. 

Thanks,

Andrew Fish


> K2
> 
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Dandan Bi
> Sent: Thursday, December 8, 2016 2:54 AM
> To: edk2-devel@lists.01.org
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Subject: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration
> 
> 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/Misc.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/FatPkg/EnhancedFatDxe/Misc.c b/FatPkg/EnhancedFatDxe/Misc.c index f91759c..6ad688c 100644
> --- a/FatPkg/EnhancedFatDxe/Misc.c
> +++ b/FatPkg/EnhancedFatDxe/Misc.c
> @@ -696,15 +696,27 @@ Returns:
>   TRUE                  - The time is valid.
>   FALSE                 - The time is not valid.
> 
> --*/
> {
> -  static UINT8  MonthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
> +  STATIC UINT8  MonthDays[12];
>   UINTN         Day;
>   BOOLEAN       ValidTime;
> 
>   ValidTime = TRUE;
> +  MonthDays[0] = 31;
> +  MonthDays[1] = 28;
> +  MonthDays[2] = 31;
> +  MonthDays[3] = 30;
> +  MonthDays[4] = 31;
> +  MonthDays[5] = 30;
> +  MonthDays[6] = 31;
> +  MonthDays[7] = 31;
> +  MonthDays[8] = 30;
> +  MonthDays[9] = 31;
> +  MonthDays[10] = 30;
> +  MonthDays[11] = 31;
> 
>   //
>   // Check the fields for range problems
>   // Fat can only support from 1980
>   //
> --
> 1.9.5.msysgit.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration
  2016-12-08 17:27   ` Kurt Kennett
  2016-12-08 23:11     ` Andrew Fish
@ 2016-12-08 23:47     ` Yao, Jiewen
  2016-12-09  0:26       ` Kurt Kennett
  1 sibling, 1 reply; 27+ messages in thread
From: Yao, Jiewen @ 2016-12-08 23:47 UTC (permalink / raw)
  To: Kurt Kennett, Bi, Dandan, edk2-devel@lists.01.org; +Cc: Ni, Ruiyu

Agree. Maybe we can move it to be a global variable ?

Thank you
Yao Jiewen

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of Kurt
> Kennett
> Sent: Friday, December 9, 2016 1:28 AM
> To: Bi, Dandan <dandan.bi@intel.com>; edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
> Subject: Re: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after
> declaration
> 
> This seems kind of silly.
> Why isn't this just const data?  This adds code and memory accesses that are
> worthless and happen on every call to the function.
> 
> K2
> 
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Dandan Bi
> Sent: Thursday, December 8, 2016 2:54 AM
> To: edk2-devel@lists.01.org
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Subject: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after
> declaration
> 
> 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/Misc.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/FatPkg/EnhancedFatDxe/Misc.c b/FatPkg/EnhancedFatDxe/Misc.c
> index f91759c..6ad688c 100644
> --- a/FatPkg/EnhancedFatDxe/Misc.c
> +++ b/FatPkg/EnhancedFatDxe/Misc.c
> @@ -696,15 +696,27 @@ Returns:
>    TRUE                  - The time is valid.
>    FALSE                 - The time is not valid.
> 
>  --*/
>  {
> -  static UINT8  MonthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
> +  STATIC UINT8  MonthDays[12];
>    UINTN         Day;
>    BOOLEAN       ValidTime;
> 
>    ValidTime = TRUE;
> +  MonthDays[0] = 31;
> +  MonthDays[1] = 28;
> +  MonthDays[2] = 31;
> +  MonthDays[3] = 30;
> +  MonthDays[4] = 31;
> +  MonthDays[5] = 30;
> +  MonthDays[6] = 31;
> +  MonthDays[7] = 31;
> +  MonthDays[8] = 30;
> +  MonthDays[9] = 31;
> +  MonthDays[10] = 30;
> +  MonthDays[11] = 31;
> 
>    //
>    // Check the fields for range problems
>    // Fat can only support from 1980
>    //
> --
> 1.9.5.msysgit.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration
  2016-12-08 23:47     ` Yao, Jiewen
@ 2016-12-09  0:26       ` Kurt Kennett
  2016-12-09  0:36         ` Andrew Fish
  0 siblings, 1 reply; 27+ messages in thread
From: Kurt Kennett @ 2016-12-09  0:26 UTC (permalink / raw)
  To: Yao, Jiewen, Bi, Dandan, edk2-devel@lists.01.org; +Cc: Ni, Ruiyu

Is the data 'variable'?  i.e does it ever change?

A normal compiler should put this data into a section marked read-only if it is marked as const, and a loader could read-protect the region after load.

K2

-----Original Message-----
From: Yao, Jiewen [mailto:jiewen.yao@intel.com] 
Sent: Thursday, December 8, 2016 3:47 PM
To: Kurt Kennett <Kurt.Kennett@microsoft.com>; Bi, Dandan <dandan.bi@intel.com>; edk2-devel@lists.01.org
Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
Subject: RE: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration

Agree. Maybe we can move it to be a global variable ?

Thank you
Yao Jiewen

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of 
> Kurt Kennett
> Sent: Friday, December 9, 2016 1:28 AM
> To: Bi, Dandan <dandan.bi@intel.com>; edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
> Subject: Re: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize 
> variable after declaration
> 
> This seems kind of silly.
> Why isn't this just const data?  This adds code and memory accesses 
> that are worthless and happen on every call to the function.
> 
> K2
> 
> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of 
> Dandan Bi
> Sent: Thursday, December 8, 2016 2:54 AM
> To: edk2-devel@lists.01.org
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Subject: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable 
> after declaration
> 
> 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/Misc.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/FatPkg/EnhancedFatDxe/Misc.c 
> b/FatPkg/EnhancedFatDxe/Misc.c index f91759c..6ad688c 100644
> --- a/FatPkg/EnhancedFatDxe/Misc.c
> +++ b/FatPkg/EnhancedFatDxe/Misc.c
> @@ -696,15 +696,27 @@ Returns:
>    TRUE                  - The time is valid.
>    FALSE                 - The time is not valid.
> 
>  --*/
>  {
> -  static UINT8  MonthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 
> 31, 30, 31 };
> +  STATIC UINT8  MonthDays[12];
>    UINTN         Day;
>    BOOLEAN       ValidTime;
> 
>    ValidTime = TRUE;
> +  MonthDays[0] = 31;
> +  MonthDays[1] = 28;
> +  MonthDays[2] = 31;
> +  MonthDays[3] = 30;
> +  MonthDays[4] = 31;
> +  MonthDays[5] = 30;
> +  MonthDays[6] = 31;
> +  MonthDays[7] = 31;
> +  MonthDays[8] = 30;
> +  MonthDays[9] = 31;
> +  MonthDays[10] = 30;
> +  MonthDays[11] = 31;
> 
>    //
>    // Check the fields for range problems
>    // Fat can only support from 1980
>    //
> --
> 1.9.5.msysgit.1
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration
  2016-12-09  0:26       ` Kurt Kennett
@ 2016-12-09  0:36         ` Andrew Fish
  2016-12-09  0:40           ` Yao, Jiewen
  2016-12-09  0:40           ` Kurt Kennett
  0 siblings, 2 replies; 27+ messages in thread
From: Andrew Fish @ 2016-12-09  0:36 UTC (permalink / raw)
  To: Kurt Kennett; +Cc: Yao, Jiewen, Bi, Dandan, edk2-devel@lists.01.org, Ni, Ruiyu


> On Dec 8, 2016, at 4:26 PM, Kurt Kennett <Kurt.Kennett@microsoft.com> wrote:
> 
> Is the data 'variable'?  i.e does it ever change?
> 
> A normal compiler should put this data into a section marked read-only if it is marked as const, and a loader could read-protect the region after load.
> 

K2,

Did you mean write-protoect? 

FYI in my example in this thread from a macOS clang compiler the constant date ends up in a const TEXT section, as the text section in general is const. That is why the compiler emitted a PC relative access. This only ever becomes an issue when hand writing assemble code for X64. 

Thanks,

Andrew Fish 

> K2
> 
> -----Original Message-----
> From: Yao, Jiewen [mailto:jiewen.yao@intel.com] 
> Sent: Thursday, December 8, 2016 3:47 PM
> To: Kurt Kennett <Kurt.Kennett@microsoft.com>; Bi, Dandan <dandan.bi@intel.com>; edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
> Subject: RE: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration
> 
> Agree. Maybe we can move it to be a global variable ?
> 
> Thank you
> Yao Jiewen
> 
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of 
>> Kurt Kennett
>> Sent: Friday, December 9, 2016 1:28 AM
>> To: Bi, Dandan <dandan.bi@intel.com>; edk2-devel@lists.01.org
>> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
>> Subject: Re: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize 
>> variable after declaration
>> 
>> This seems kind of silly.
>> Why isn't this just const data?  This adds code and memory accesses 
>> that are worthless and happen on every call to the function.
>> 
>> K2
>> 
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of 
>> Dandan Bi
>> Sent: Thursday, December 8, 2016 2:54 AM
>> To: edk2-devel@lists.01.org
>> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
>> Subject: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable 
>> after declaration
>> 
>> 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/Misc.c | 14 +++++++++++++-
>> 1 file changed, 13 insertions(+), 1 deletion(-)
>> 
>> diff --git a/FatPkg/EnhancedFatDxe/Misc.c 
>> b/FatPkg/EnhancedFatDxe/Misc.c index f91759c..6ad688c 100644
>> --- a/FatPkg/EnhancedFatDxe/Misc.c
>> +++ b/FatPkg/EnhancedFatDxe/Misc.c
>> @@ -696,15 +696,27 @@ Returns:
>>   TRUE                  - The time is valid.
>>   FALSE                 - The time is not valid.
>> 
>> --*/
>> {
>> -  static UINT8  MonthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 
>> 31, 30, 31 };
>> +  STATIC UINT8  MonthDays[12];
>>   UINTN         Day;
>>   BOOLEAN       ValidTime;
>> 
>>   ValidTime = TRUE;
>> +  MonthDays[0] = 31;
>> +  MonthDays[1] = 28;
>> +  MonthDays[2] = 31;
>> +  MonthDays[3] = 30;
>> +  MonthDays[4] = 31;
>> +  MonthDays[5] = 30;
>> +  MonthDays[6] = 31;
>> +  MonthDays[7] = 31;
>> +  MonthDays[8] = 30;
>> +  MonthDays[9] = 31;
>> +  MonthDays[10] = 30;
>> +  MonthDays[11] = 31;
>> 
>>   //
>>   // Check the fields for range problems
>>   // Fat can only support from 1980
>>   //
>> --
>> 1.9.5.msysgit.1
>> 
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration
  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
  1 sibling, 1 reply; 27+ messages in thread
From: Yao, Jiewen @ 2016-12-09  0:40 UTC (permalink / raw)
  To: afish@apple.com, Kurt Kennett
  Cc: Bi, Dandan, edk2-devel@lists.01.org, Ni, Ruiyu

Hi
I found it is using "STATIC" not "CONST".

Does a compiler put "STATIC" data to READ-ONLY section?

Thank you
Yao Jiewen

From: afish@apple.com [mailto:afish@apple.com]
Sent: Friday, December 9, 2016 8:37 AM
To: Kurt Kennett <Kurt.Kennett@microsoft.com>
Cc: Yao, Jiewen <jiewen.yao@intel.com>; Bi, Dandan <dandan.bi@intel.com>; edk2-devel@lists.01.org; Ni, Ruiyu <ruiyu.ni@intel.com>
Subject: Re: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration


> On Dec 8, 2016, at 4:26 PM, Kurt Kennett <Kurt.Kennett@microsoft.com<mailto:Kurt.Kennett@microsoft.com>> wrote:
>
> Is the data 'variable'?  i.e does it ever change?
>
> A normal compiler should put this data into a section marked read-only if it is marked as const, and a loader could read-protect the region after load.
>

K2,

Did you mean write-protoect?

FYI in my example in this thread from a macOS clang compiler the constant date ends up in a const TEXT section, as the text section in general is const. That is why the compiler emitted a PC relative access. This only ever becomes an issue when hand writing assemble code for X64.

Thanks,

Andrew Fish

> K2
>
> -----Original Message-----
> From: Yao, Jiewen [mailto:jiewen.yao@intel.com]
> Sent: Thursday, December 8, 2016 3:47 PM
> To: Kurt Kennett <Kurt.Kennett@microsoft.com<mailto:Kurt.Kennett@microsoft.com>>; Bi, Dandan <dandan.bi@intel.com<mailto:dandan.bi@intel.com>>; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com<mailto:ruiyu.ni@intel.com>>
> Subject: RE: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration
>
> Agree. Maybe we can move it to be a global variable ?
>
> Thank you
> Yao Jiewen
>
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>> Kurt Kennett
>> Sent: Friday, December 9, 2016 1:28 AM
>> To: Bi, Dandan <dandan.bi@intel.com<mailto:dandan.bi@intel.com>>; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
>> Cc: Ni, Ruiyu <ruiyu.ni@intel.com<mailto:ruiyu.ni@intel.com>>
>> Subject: Re: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize
>> variable after declaration
>>
>> This seems kind of silly.
>> Why isn't this just const data?  This adds code and memory accesses
>> that are worthless and happen on every call to the function.
>>
>> K2
>>
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>> Dandan Bi
>> Sent: Thursday, December 8, 2016 2:54 AM
>> To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
>> Cc: Ruiyu Ni <ruiyu.ni@intel.com<mailto:ruiyu.ni@intel.com>>
>> Subject: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable
>> after declaration
>>
>> Cc: Ruiyu Ni <ruiyu.ni@intel.com<mailto:ruiyu.ni@intel.com>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Dandan Bi <dandan.bi@intel.com<mailto:dandan.bi@intel.com>>
>> ---
>> FatPkg/EnhancedFatDxe/Misc.c | 14 +++++++++++++-
>> 1 file changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/FatPkg/EnhancedFatDxe/Misc.c
>> b/FatPkg/EnhancedFatDxe/Misc.c index f91759c..6ad688c 100644
>> --- a/FatPkg/EnhancedFatDxe/Misc.c
>> +++ b/FatPkg/EnhancedFatDxe/Misc.c
>> @@ -696,15 +696,27 @@ Returns:
>>   TRUE                  - The time is valid.
>>   FALSE                 - The time is not valid.
>>
>> --*/
>> {
>> -  static UINT8  MonthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30,
>> 31, 30, 31 };
>> +  STATIC UINT8  MonthDays[12];
>>   UINTN         Day;
>>   BOOLEAN       ValidTime;
>>
>>   ValidTime = TRUE;
>> +  MonthDays[0] = 31;
>> +  MonthDays[1] = 28;
>> +  MonthDays[2] = 31;
>> +  MonthDays[3] = 30;
>> +  MonthDays[4] = 31;
>> +  MonthDays[5] = 30;
>> +  MonthDays[6] = 31;
>> +  MonthDays[7] = 31;
>> +  MonthDays[8] = 30;
>> +  MonthDays[9] = 31;
>> +  MonthDays[10] = 30;
>> +  MonthDays[11] = 31;
>>
>>   //
>>   // Check the fields for range problems
>>   // Fat can only support from 1980
>>   //
>> --
>> 1.9.5.msysgit.1
>>
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
>> https://lists.01.org/mailman/listinfo/edk2-devel
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
>> https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration
  2016-12-09  0:36         ` Andrew Fish
  2016-12-09  0:40           ` Yao, Jiewen
@ 2016-12-09  0:40           ` Kurt Kennett
  1 sibling, 0 replies; 27+ messages in thread
From: Kurt Kennett @ 2016-12-09  0:40 UTC (permalink / raw)
  To: afish@apple.com
  Cc: Yao, Jiewen, Bi, Dandan, edk2-devel@lists.01.org, Ni, Ruiyu

Yes.  When I said "read-protect" I mean "protect by making it read-only".  I should have said "read-only protect" or "write-protect".

K2

-----Original Message-----
From: afish@apple.com [mailto:afish@apple.com] 
Sent: Thursday, December 8, 2016 4:37 PM
To: Kurt Kennett <Kurt.Kennett@microsoft.com>
Cc: Yao, Jiewen <jiewen.yao@intel.com>; Bi, Dandan <dandan.bi@intel.com>; edk2-devel@lists.01.org; Ni, Ruiyu <ruiyu.ni@intel.com>
Subject: Re: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration


> On Dec 8, 2016, at 4:26 PM, Kurt Kennett <Kurt.Kennett@microsoft.com> wrote:
> 
> Is the data 'variable'?  i.e does it ever change?
> 
> A normal compiler should put this data into a section marked read-only if it is marked as const, and a loader could read-protect the region after load.
> 

K2,

Did you mean write-protoect? 

FYI in my example in this thread from a macOS clang compiler the constant date ends up in a const TEXT section, as the text section in general is const. That is why the compiler emitted a PC relative access. This only ever becomes an issue when hand writing assemble code for X64. 

Thanks,

Andrew Fish 

> K2
> 
> -----Original Message-----
> From: Yao, Jiewen [mailto:jiewen.yao@intel.com]
> Sent: Thursday, December 8, 2016 3:47 PM
> To: Kurt Kennett <Kurt.Kennett@microsoft.com>; Bi, Dandan 
> <dandan.bi@intel.com>; edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
> Subject: RE: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize 
> variable after declaration
> 
> Agree. Maybe we can move it to be a global variable ?
> 
> Thank you
> Yao Jiewen
> 
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf 
>> Of Kurt Kennett
>> Sent: Friday, December 9, 2016 1:28 AM
>> To: Bi, Dandan <dandan.bi@intel.com>; edk2-devel@lists.01.org
>> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
>> Subject: Re: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize 
>> variable after declaration
>> 
>> This seems kind of silly.
>> Why isn't this just const data?  This adds code and memory accesses 
>> that are worthless and happen on every call to the function.
>> 
>> K2
>> 
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf 
>> Of Dandan Bi
>> Sent: Thursday, December 8, 2016 2:54 AM
>> To: edk2-devel@lists.01.org
>> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
>> Subject: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize 
>> variable after declaration
>> 
>> 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/Misc.c | 14 +++++++++++++-
>> 1 file changed, 13 insertions(+), 1 deletion(-)
>> 
>> diff --git a/FatPkg/EnhancedFatDxe/Misc.c 
>> b/FatPkg/EnhancedFatDxe/Misc.c index f91759c..6ad688c 100644
>> --- a/FatPkg/EnhancedFatDxe/Misc.c
>> +++ b/FatPkg/EnhancedFatDxe/Misc.c
>> @@ -696,15 +696,27 @@ Returns:
>>   TRUE                  - The time is valid.
>>   FALSE                 - The time is not valid.
>> 
>> --*/
>> {
>> -  static UINT8  MonthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 
>> 31, 30, 31 };
>> +  STATIC UINT8  MonthDays[12];
>>   UINTN         Day;
>>   BOOLEAN       ValidTime;
>> 
>>   ValidTime = TRUE;
>> +  MonthDays[0] = 31;
>> +  MonthDays[1] = 28;
>> +  MonthDays[2] = 31;
>> +  MonthDays[3] = 30;
>> +  MonthDays[4] = 31;
>> +  MonthDays[5] = 30;
>> +  MonthDays[6] = 31;
>> +  MonthDays[7] = 31;
>> +  MonthDays[8] = 30;
>> +  MonthDays[9] = 31;
>> +  MonthDays[10] = 30;
>> +  MonthDays[11] = 31;
>> 
>>   //
>>   // Check the fields for range problems
>>   // Fat can only support from 1980
>>   //
>> --
>> 1.9.5.msysgit.1
>> 
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration
  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-09  0:57   ` Ni, Ruiyu
  2016-12-09  1:18     ` Bi, Dandan
  1 sibling, 1 reply; 27+ messages in thread
From: Ni, Ruiyu @ 2016-12-09  0:57 UTC (permalink / raw)
  To: Bi, Dandan, edk2-devel@lists.01.org

Dandan,
Could you please create a global array mMonthDays?
UINT8  mMonthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

Regards,
Ray

>-----Original Message-----
>From: Bi, Dandan
>Sent: Thursday, December 8, 2016 6:54 PM
>To: edk2-devel@lists.01.org
>Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
>Subject: [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration
>
>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/Misc.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
>diff --git a/FatPkg/EnhancedFatDxe/Misc.c b/FatPkg/EnhancedFatDxe/Misc.c
>index f91759c..6ad688c 100644
>--- a/FatPkg/EnhancedFatDxe/Misc.c
>+++ b/FatPkg/EnhancedFatDxe/Misc.c
>@@ -696,15 +696,27 @@ Returns:
>   TRUE                  - The time is valid.
>   FALSE                 - The time is not valid.
>
> --*/
> {
>-  static UINT8  MonthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
>+  STATIC UINT8  MonthDays[12];
>   UINTN         Day;
>   BOOLEAN       ValidTime;
>
>   ValidTime = TRUE;
>+  MonthDays[0] = 31;
>+  MonthDays[1] = 28;
>+  MonthDays[2] = 31;
>+  MonthDays[3] = 30;
>+  MonthDays[4] = 31;
>+  MonthDays[5] = 30;
>+  MonthDays[6] = 31;
>+  MonthDays[7] = 31;
>+  MonthDays[8] = 30;
>+  MonthDays[9] = 31;
>+  MonthDays[10] = 30;
>+  MonthDays[11] = 31;
>
>   //
>   // Check the fields for range problems
>   // Fat can only support from 1980
>   //
>--
>1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [patch 8/8] FatPkg: Fix format issues in dec/inf/dsc files
  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
  0 siblings, 0 replies; 27+ messages in thread
From: Ni, Ruiyu @ 2016-12-09  1:09 UTC (permalink / raw)
  To: Bi, Dandan, edk2-devel@lists.01.org

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

Regards,
Ray

>-----Original Message-----
>From: Bi, Dandan
>Sent: Thursday, December 8, 2016 6:54 PM
>To: edk2-devel@lists.01.org
>Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
>Subject: [patch 8/8] FatPkg: Fix format issues in dec/inf/dsc files
>
>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/Fat.inf | 2 +-
> FatPkg/FatPei/FatPei.inf      | 6 +++---
> FatPkg/FatPkg.dec             | 1 -
> FatPkg/FatPkg.dsc             | 3 +--
> 4 files changed, 5 insertions(+), 7 deletions(-)
>
>diff --git a/FatPkg/EnhancedFatDxe/Fat.inf b/FatPkg/EnhancedFatDxe/Fat.inf
>index 158f34c..e7044cd 100644
>--- a/FatPkg/EnhancedFatDxe/Fat.inf
>+++ b/FatPkg/EnhancedFatDxe/Fat.inf
>@@ -1,7 +1,7 @@
> ## @file
>-#  Component description file for FAT module.
>+#  Component Description File for FAT module.
> #
> #  This UEFI driver detects the FAT file system in the disk.
> #  It also produces the Simple File System protocol for the consumer to
> #  perform file and directory operations on the disk.
> #  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
>diff --git a/FatPkg/FatPei/FatPei.inf b/FatPkg/FatPei/FatPei.inf
>index 1409e28..273f72d 100644
>--- a/FatPkg/FatPei/FatPei.inf
>+++ b/FatPkg/FatPei/FatPei.inf
>@@ -59,13 +59,13 @@ [Guids]
>   gRecoveryOnFatIdeDiskGuid                   ## SOMETIMES_CONSUMES   ## UNDEFINED
>   gRecoveryOnFatFloppyDiskGuid                ## SOMETIMES_CONSUMES   ## UNDEFINED
>
>
> [Ppis]
>-  gEfiPeiVirtualBlockIoPpiGuid                  # PPI_NOTIFY SOMETIMES_CONSUMED
>-  gEfiPeiVirtualBlockIo2PpiGuid                 # PPI_NOTIFY SOMETIMES_CONSUMED
>-  gEfiPeiDeviceRecoveryModulePpiGuid            # SOMETIMES_PRODUCED
>+  gEfiPeiVirtualBlockIoPpiGuid                  ## SOMETIMES_CONSUMES PPI_NOTIFY
>+  gEfiPeiVirtualBlockIo2PpiGuid                 ## SOMETIMES_CONSUMES PPI_NOTIFY
>+  gEfiPeiDeviceRecoveryModulePpiGuid            ## SOMETIMES_PRODUCES
>
>
> [FeaturePcd]
>   gEfiMdeModulePkgTokenSpaceGuid.PcdFrameworkCompatibilitySupport         ## CONSUMES
>
>diff --git a/FatPkg/FatPkg.dec b/FatPkg/FatPkg.dec
>index e898d95..8bdddb1 100644
>--- a/FatPkg/FatPkg.dec
>+++ b/FatPkg/FatPkg.dec
>@@ -1,7 +1,6 @@
> ## @file
>-#
> #  FAT Package
> #
> #  FAT 32 Driver
> #  Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>
> #
>diff --git a/FatPkg/FatPkg.dsc b/FatPkg/FatPkg.dsc
>index d654120..841201c 100644
>--- a/FatPkg/FatPkg.dsc
>+++ b/FatPkg/FatPkg.dsc
>@@ -1,8 +1,7 @@
> ## @file
>-#
>-#  Build Binary Enhanced Fat Driver Modules
>+#  Build Binary Enhanced Fat Driver Modules.
> #
> #  This Platform file is used to generate the Binary Fat Drivers
> #  for EDK II Prime release.
> #  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
> #
>--
>1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [patch 7/8] FatPkg\EnhancedFatDxe: Add comments for functions
  2016-12-08 10:54 ` [patch 7/8] FatPkg\EnhancedFatDxe: Add comments for functions Dandan Bi
@ 2016-12-09  1:10   ` Ni, Ruiyu
  0 siblings, 0 replies; 27+ messages in thread
From: Ni, Ruiyu @ 2016-12-09  1:10 UTC (permalink / raw)
  To: Bi, Dandan, edk2-devel@lists.01.org

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

Regards,
Ray

>-----Original Message-----
>From: Bi, Dandan
>Sent: Thursday, December 8, 2016 6:54 PM
>To: edk2-devel@lists.01.org
>Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
>Subject: [patch 7/8] FatPkg\EnhancedFatDxe: Add comments for functions
>
>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/Fat.c  |  64 ++++
> FatPkg/EnhancedFatDxe/Fat.h  | 804 +++++++++++++++++++++++++++++++++++++++++++
> FatPkg/EnhancedFatDxe/Info.c |  40 +++
> 3 files changed, 908 insertions(+)
>
>diff --git a/FatPkg/EnhancedFatDxe/Fat.c b/FatPkg/EnhancedFatDxe/Fat.c
>index 2e6c089..e29c64c 100644
>--- a/FatPkg/EnhancedFatDxe/Fat.c
>+++ b/FatPkg/EnhancedFatDxe/Fat.c
>@@ -12,39 +12,103 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
> **/
>
> #include "Fat.h"
>
>+/**
>+
>+  Register Driver Binding protocol for this driver.
>+
>+  @param  ImageHandle           - Handle for the image of this driver.
>+  @param  SystemTable           - Pointer to the EFI System Table.
>+
>+  @retval EFI_SUCCESS           - Driver loaded.
>+  @return other                 - Driver not loaded.
>+
>+**/
> EFI_STATUS
> EFIAPI
> FatEntryPoint (
>   IN EFI_HANDLE         ImageHandle,
>   IN EFI_SYSTEM_TABLE   *SystemTable
>   );
>
>+/**
>+
>+  Unload function for this image. Uninstall DriverBinding protocol.
>+
>+  @param ImageHandle           - Handle for the image of this driver.
>+
>+  @retval EFI_SUCCESS           - Driver unloaded successfully.
>+  @return other                 - Driver can not unloaded.
>+
>+**/
> EFI_STATUS
> EFIAPI
> FatUnload (
>   IN EFI_HANDLE         ImageHandle
>   );
>
>+/**
>+
>+  Test to see if this driver can add a file system to ControllerHandle.
>+  ControllerHandle must support both Disk IO and Block IO protocols.
>+
>+  @param  This                  - Protocol instance pointer.
>+  @param  ControllerHandle      - Handle of device to test.
>+  @param  RemainingDevicePath   - Not used.
>+
>+  @retval EFI_SUCCESS           - This driver supports this device.
>+  @retval EFI_ALREADY_STARTED   - This driver is already running on this device.
>+  @return other                 - This driver does not support this device.
>+
>+**/
> EFI_STATUS
> EFIAPI
> FatDriverBindingSupported (
>   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
>   IN EFI_HANDLE                   Controller,
>   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
>   );
>
>+/**
>+
>+  Start this driver on ControllerHandle by opening a Block IO and Disk IO
>+  protocol, reading Device Path. Add a Simple File System protocol to
>+  ControllerHandle if the media contains a valid file system.
>+
>+  @param  This                  - Protocol instance pointer.
>+  @param  ControllerHandle      - Handle of device to bind driver to.
>+  @param  RemainingDevicePath   - Not used.
>+
>+  @retval EFI_SUCCESS           - This driver is added to DeviceHandle.
>+  @retval EFI_ALREADY_STARTED   - This driver is already running on DeviceHandle.
>+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
>+  @return other                 - This driver does not support this device.
>+
>+**/
> EFI_STATUS
> EFIAPI
> FatDriverBindingStart (
>   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
>   IN EFI_HANDLE                   Controller,
>   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
>   );
>
>+/**
>+
>+  Stop this driver on ControllerHandle.
>+
>+  @param  This                  - Protocol instance pointer.
>+  @param  ControllerHandle      - Handle of device to stop driver on.
>+  @param  NumberOfChildren      - Not used.
>+  @param  ChildHandleBuffer     - Not used.
>+
>+  @retval EFI_SUCCESS           - This driver is removed DeviceHandle.
>+  @return other                 - This driver was not removed from this device.
>+
>+**/
> EFI_STATUS
> EFIAPI
> FatDriverBindingStop (
>   IN  EFI_DRIVER_BINDING_PROTOCOL  *This,
>   IN  EFI_HANDLE                   Controller,
>diff --git a/FatPkg/EnhancedFatDxe/Fat.h b/FatPkg/EnhancedFatDxe/Fat.h
>index 9490868..8355261 100644
>--- a/FatPkg/EnhancedFatDxe/Fat.h
>+++ b/FatPkg/EnhancedFatDxe/Fat.h
>@@ -700,15 +700,54 @@ FatWriteEx (
> ;
>
> //
> // DiskCache.c
> //
>+/**
>+
>+  Initialize the disk cache according to Volume's FatType.
>+
>+  @param  Volume                - FAT file system volume.
>+
>+  @retval EFI_SUCCESS           - The disk cache is successfully initialized.
>+  @retval EFI_OUT_OF_RESOURCES  - Not enough memory to allocate disk cache.
>+
>+**/
> EFI_STATUS
> FatInitializeDiskCache (
>   IN FAT_VOLUME              *Volume
>   );
>
>+/**
>+
>+  Read BufferSize bytes from the position of Offset into Buffer,
>+  or write BufferSize bytes from Buffer into the position of Offset.
>+
>+  Base on the parameter of CACHE_DATA_TYPE, the data access will be divided into
>+  the access of FAT cache (CACHE_FAT) and the access of Data cache (CACHE_DATA):
>+
>+  1. Access of FAT cache (CACHE_FAT): Access the data in the FAT cache, if there is cache
>+     page hit, just return the cache page; else update the related cache page and return
>+     the right cache page.
>+  2. Access of Data cache (CACHE_DATA):
>+     The access data will be divided into UnderRun data, Aligned data and OverRun data;
>+     The UnderRun data and OverRun data will be accessed by the Data cache,
>+     but the Aligned data will be accessed with disk directly.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  CacheDataType         - The type of cache: CACHE_DATA or CACHE_FAT.
>+  @param  IoMode                - Indicate the type of disk access.
>+  @param  Offset                - The starting byte offset to read from.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing cache data.
>+  @param  Task                    point to task instance.
>+
>+  @retval EFI_SUCCESS           - The data was accessed correctly.
>+  @retval EFI_MEDIA_CHANGED     - The MediaId does not match the current device.
>+  @return Others                - An error occurred when accessing cache.
>+
>+**/
> EFI_STATUS
> FatAccessCache (
>   IN     FAT_VOLUME          *Volume,
>   IN     CACHE_DATA_TYPE     CacheDataType,
>   IN     IO_MODE             IoMode,
>@@ -716,40 +755,107 @@ FatAccessCache (
>   IN     UINTN               BufferSize,
>   IN OUT UINT8               *Buffer,
>   IN     FAT_TASK            *Task
>   );
>
>+/**
>+
>+  Flush all the dirty cache back, include the FAT cache and the Data cache.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  Task                    point to task instance.
>+
>+  @retval EFI_SUCCESS           - Flush all the dirty cache back successfully
>+  @return other                 - An error occurred when writing the data into the disk
>+
>+**/
> EFI_STATUS
> FatVolumeFlushCache (
>   IN FAT_VOLUME              *Volume,
>   IN FAT_TASK                *Task
>   );
>
> //
> // Flush.c
> //
>+/**
>+
>+  Flush the data associated with an open file.
>+  In this implementation, only last Mod/Access time is updated.
>+
>+  @param  OFile                 - The open file.
>+
>+  @retval EFI_SUCCESS           - The OFile is flushed successfully.
>+  @return Others                - An error occurred when flushing this OFile.
>+
>+**/
> EFI_STATUS
> FatOFileFlush (
>   IN FAT_OFILE          *OFile
>   );
>
>+/**
>+
>+  Check the references of the OFile.
>+  If the OFile (that is checked) is no longer
>+  referenced, then it is freed.
>+
>+  @param  OFile                 - The OFile to be checked.
>+
>+  @retval TRUE                  - The OFile is not referenced and freed.
>+  @retval FALSE                 - The OFile is kept.
>+
>+**/
> BOOLEAN
> FatCheckOFileRef (
>   IN FAT_OFILE          *OFile
>   );
>
>+/**
>+
>+  Set the OFile and its child OFile with the error Status
>+
>+  @param  OFile                 - The OFile whose permanent error code is to be set.
>+  @param  Status                - Error code to be set.
>+
>+**/
> VOID
> FatSetVolumeError (
>   IN FAT_OFILE          *OFile,
>   IN EFI_STATUS         Status
>   );
>
>+/**
>+
>+  Close the open file instance.
>+
>+  @param  IFile                 - Open file instance.
>+
>+  @retval EFI_SUCCESS           - Closed the file successfully.
>+
>+**/
> EFI_STATUS
> FatIFileClose (
>   FAT_IFILE             *IFile
>   );
>
>+/**
>+
>+  Set error status for a specific OFile, reference checking the volume.
>+  If volume is already marked as invalid, and all resources are freed
>+  after reference checking, the file system protocol is uninstalled and
>+  the volume structure is freed.
>+
>+  @param  Volume                - the Volume that is to be reference checked and unlocked.
>+  @param  OFile                 - the OFile whose permanent error code is to be set.
>+  @param  EfiStatus             - error code to be set.
>+  @param  Task                    point to task instance.
>+
>+  @retval EFI_SUCCESS           - Clean up the volume successfully.
>+  @return Others                - Cleaning up of the volume is failed.
>+
>+**/
> EFI_STATUS
> FatCleanupVolume (
>   IN FAT_VOLUME         *Volume,
>   IN FAT_OFILE          *OFile,
>   IN EFI_STATUS         EfiStatus,
>@@ -757,443 +863,1141 @@ FatCleanupVolume (
>   );
>
> //
> // FileSpace.c
> //
>+/**
>+
>+  Shrink the end of the open file base on the file size.
>+
>+  @param  OFile                 - The open file.
>+
>+  @retval EFI_SUCCESS           - Shrinked sucessfully.
>+  @retval EFI_VOLUME_CORRUPTED  - There are errors in the file's clusters.
>+
>+**/
> EFI_STATUS
> FatShrinkEof (
>   IN FAT_OFILE          *OFile
>   );
>
>+/**
>+
>+  Grow the end of the open file base on the NewSizeInBytes.
>+
>+  @param  OFile                 - The open file.
>+  @param  NewSizeInBytes        - The new size in bytes of the open file.
>+
>+  @retval EFI_SUCCESS           - The file is grown sucessfully.
>+  @retval EFI_UNSUPPORTED       - The file size is larger than 4GB.
>+  @retval EFI_VOLUME_CORRUPTED  - There are errors in the files' clusters.
>+  @retval EFI_VOLUME_FULL       - The volume is full and can not grow the file.
>+
>+**/
> EFI_STATUS
> FatGrowEof (
>   IN FAT_OFILE          *OFile,
>   IN UINT64             NewSizeInBytes
>   );
>
>+/**
>+
>+  Get the size of directory of the open file.
>+
>+  @param  Volume                - The File System Volume.
>+  @param  Cluster               - The Starting cluster.
>+
>+  @return The physical size of the file starting at the input cluster, if there is error in the
>+  cluster chain, the return value is 0.
>+
>+**/
> UINTN
> FatPhysicalDirSize (
>   IN FAT_VOLUME         *Volume,
>   IN UINTN              Cluster
>   );
>
>+/**
>+
>+  Get the physical size of a file on the disk.
>+
>+  @param  Volume                - The file system volume.
>+  @param  RealSize              - The real size of a file.
>+
>+  @return The physical size of a file on the disk.
>+
>+**/
> UINT64
> FatPhysicalFileSize (
>   IN FAT_VOLUME         *Volume,
>   IN UINTN              RealSize
>   );
>
>+/**
>+
>+  Seek OFile to requested position, and calculate the number of
>+  consecutive clusters from the position in the file
>+
>+  @param  OFile                 - The open file.
>+  @param  Position              - The file's position which will be accessed.
>+  @param  PosLimit              - The maximum length current reading/writing may access
>+
>+  @retval EFI_SUCCESS           - Set the info successfully.
>+  @retval EFI_VOLUME_CORRUPTED  - Cluster chain corrupt.
>+
>+**/
> EFI_STATUS
> FatOFilePosition (
>   IN FAT_OFILE            *OFile,
>   IN UINTN                Position,
>   IN UINTN                PosLimit
>   );
>
>+/**
>+
>+  Update the free cluster info of FatInfoSector of the volume.
>+
>+  @param  Volume                - FAT file system volume.
>+
>+**/
> VOID
> FatComputeFreeInfo (
>   IN FAT_VOLUME         *Volume
>   );
>
> //
> // Init.c
> //
>+/**
>+
>+  Allocates volume structure, detects FAT file system, installs protocol,
>+  and initialize cache.
>+
>+  @param  Handle                - The handle of parent device.
>+  @param  DiskIo                - The DiskIo of parent device.
>+  @param  DiskIo2               - The DiskIo2 of parent device.
>+  @param  BlockIo               - The BlockIo of parent devicel
>+
>+  @retval EFI_SUCCESS           - Allocate a new volume successfully.
>+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
>+  @return Others                - Allocating a new volume failed.
>+
>+**/
> EFI_STATUS
> FatAllocateVolume (
>   IN  EFI_HANDLE                     Handle,
>   IN  EFI_DISK_IO_PROTOCOL           *DiskIo,
>   IN  EFI_DISK_IO2_PROTOCOL          *DiskIo2,
>   IN  EFI_BLOCK_IO_PROTOCOL          *BlockIo
>   );
>
>+/**
>+
>+  Detects FAT file system on Disk and set relevant fields of Volume.
>+
>+  @param Volume                - The volume structure.
>+
>+  @retval EFI_SUCCESS           - The Fat File System is detected successfully
>+  @retval EFI_UNSUPPORTED       - The volume is not FAT file system.
>+  @retval EFI_VOLUME_CORRUPTED  - The volume is corrupted.
>+
>+**/
> EFI_STATUS
> FatOpenDevice (
>   IN OUT FAT_VOLUME     *Volume
>   );
>
>+/**
>+
>+  Called by FatDriverBindingStop(), Abandon the volume.
>+
>+  @param  Volume                - The volume to be abandoned.
>+
>+  @retval EFI_SUCCESS           - Abandoned the volume successfully.
>+  @return Others                - Can not uninstall the protocol interfaces.
>+
>+**/
> EFI_STATUS
> FatAbandonVolume (
>   IN FAT_VOLUME         *Volume
>   );
>
> //
> // Misc.c
> //
>+/**
>+
>+  Create the task
>+
>+  @param  IFile                 - The instance of the open file.
>+  @param  Token                 - A pointer to the token associated with the transaction.
>+
>+  @return FAT_TASK *            - Return the task instance.
>+
>+**/
> FAT_TASK *
> FatCreateTask (
>   FAT_IFILE           *IFile,
>   EFI_FILE_IO_TOKEN   *Token
>   );
>
>+/**
>+
>+  Destroy the task.
>+
>+  @param  Task                  - The task to be destroyed.
>+
>+**/
> VOID
> FatDestroyTask (
>   FAT_TASK            *Task
>   );
>
>+/**
>+
>+  Wait all non-blocking requests complete.
>+
>+  @param  IFile                 - The instance of the open file.
>+
>+**/
> VOID
> FatWaitNonblockingTask (
>   FAT_IFILE           *IFile
>   );
>
>+/**
>+
>+  Remove the subtask from subtask list.
>+
>+  @param  Subtask               - The subtask to be removed.
>+
>+  @return LIST_ENTRY *          - The next node in the list.
>+
>+**/
> LIST_ENTRY *
> FatDestroySubtask (
>   FAT_SUBTASK         *Subtask
>   );
>
>+/**
>+
>+  Execute the task.
>+
>+  @param  IFile                 - The instance of the open file.
>+  @param  Task                  - The task to be executed.
>+
>+  @retval EFI_SUCCESS           - The task was executed sucessfully.
>+  @return other                 - An error occurred when executing the task.
>+
>+**/
> EFI_STATUS
> FatQueueTask (
>   IN FAT_IFILE        *IFile,
>   IN FAT_TASK         *Task
>   );
>
>+/**
>+
>+  Set the volume as dirty or not.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  IoMode                - The access mode.
>+  @param  DirtyValue            - Set the volume as dirty or not.
>+
>+  @retval EFI_SUCCESS           - Set the new FAT entry value sucessfully.
>+  @return other                 - An error occurred when operation the FAT entries.
>+
>+**/
> EFI_STATUS
> FatAccessVolumeDirty (
>   IN FAT_VOLUME         *Volume,
>   IN IO_MODE            IoMode,
>   IN VOID               *DirtyValue
>   );
>
>+/**
>+
>+  General disk access function.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  IoMode                - The access mode (disk read/write or cache access).
>+  @param  Offset                - The starting byte offset to read from.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing read data.
>+  @param  Task                    point to task instance.
>+
>+  @retval EFI_SUCCESS           - The operation is performed successfully.
>+  @retval EFI_VOLUME_CORRUPTED  - The accesss is
>+  @return Others                - The status of read/write the disk
>+
>+**/
> EFI_STATUS
> FatDiskIo (
>   IN FAT_VOLUME         *Volume,
>   IN IO_MODE            IoMode,
>   IN UINT64             Offset,
>   IN UINTN              BufferSize,
>   IN OUT VOID           *Buffer,
>   IN FAT_TASK           *Task
>   );
>
>+/**
>+
>+  Lock the volume.
>+
>+**/
> VOID
> FatAcquireLock (
>   VOID
>   );
>
>+/**
>+
>+  Unlock the volume.
>+
>+**/
> VOID
> FatReleaseLock (
>   VOID
>   );
>
>+/**
>+
>+  Lock the volume.
>+  If the lock is already in the acquired state, then EFI_ACCESS_DENIED is returned.
>+  Otherwise, EFI_SUCCESS is returned.
>+
>+  @retval EFI_SUCCESS           - The volume is locked.
>+  @retval EFI_ACCESS_DENIED     - The volume could not be locked because it is already locked.
>+
>+**/
> EFI_STATUS
> FatAcquireLockOrFail (
>   VOID
>   );
>
>+/**
>+
>+  Free directory entry.
>+
>+  @param  DirEnt                - The directory entry to be freed.
>+
>+**/
> VOID
> FatFreeDirEnt (
>   IN FAT_DIRENT         *DirEnt
>   );
>
>+/**
>+
>+  Free volume structure (including the contents of directory cache and disk cache).
>+
>+  @param  Volume                - The volume structure to be freed.
>+
>+**/
> VOID
> FatFreeVolume (
>   IN FAT_VOLUME         *Volume
>   );
>
>+/**
>+
>+  Translate EFI time to FAT time.
>+
>+  @param  ETime                 - The time of EFI_TIME.
>+  @param  FTime                 - The time of FAT_DATE_TIME.
>+
>+**/
> VOID
> FatEfiTimeToFatTime (
>   IN EFI_TIME           *ETime,
>   OUT FAT_DATE_TIME     *FTime
>   );
>
>+/**
>+
>+  Translate Fat time to EFI time.
>+
>+  @param  FTime                 - The time of FAT_DATE_TIME.
>+  @param  ETime                 - The time of EFI_TIME..
>+
>+**/
> VOID
> FatFatTimeToEfiTime (
>   IN FAT_DATE_TIME      *FTime,
>   OUT EFI_TIME          *ETime
>   );
>
>+/**
>+
>+  Get Current FAT time.
>+
>+  @param  FatTime               - Current FAT time.
>+
>+**/
> VOID
> FatGetCurrentFatTime (
>   OUT FAT_DATE_TIME     *FatTime
>   );
>
>+/**
>+
>+  Check whether a time is valid.
>+
>+  @param  Time                  - The time of EFI_TIME.
>+
>+  @retval TRUE                  - The time is valid.
>+  @retval FALSE                 - The time is not valid.
>+
>+**/
> BOOLEAN
> FatIsValidTime (
>   IN EFI_TIME           *Time
>   );
>
> //
> // UnicodeCollation.c
> //
>+/**
>+  Initialize Unicode Collation support.
>+
>+  It tries to locate Unicode Collation 2 protocol and matches it with current
>+  platform language code. If for any reason the first attempt fails, it then tries to
>+  use Unicode Collation Protocol.
>+
>+  @param  AgentHandle          The handle used to open Unicode Collation (2) protocol.
>+
>+  @retval EFI_SUCCESS          The Unicode Collation (2) protocol has been successfully located.
>+  @retval Others               The Unicode Collation (2) protocol has not been located.
>+
>+**/
> EFI_STATUS
> InitializeUnicodeCollationSupport (
>   IN EFI_HANDLE    AgentHandle
>   );
>
>+/**
>+  Convert FAT string to unicode string.
>+
>+  @param  FatSize               The size of FAT string.
>+  @param  Fat                   The FAT string.
>+  @param  String                The unicode string.
>+
>+  @return None.
>+
>+**/
> VOID
> FatFatToStr (
>   IN UINTN              FatSize,
>   IN CHAR8              *Fat,
>   OUT CHAR16            *String
>   );
>
>+/**
>+  Convert unicode string to Fat string.
>+
>+  @param  String                The unicode string.
>+  @param  FatSize               The size of the FAT string.
>+  @param  Fat                   The FAT string.
>+
>+  @retval TRUE                  Convert successfully.
>+  @retval FALSE                 Convert error.
>+
>+**/
> BOOLEAN
> FatStrToFat (
>   IN  CHAR16            *String,
>   IN  UINTN             FatSize,
>   OUT CHAR8             *Fat
>   );
>
>+/**
>+  Lowercase a string
>+
>+  @param  Str                   The string which will be lower-cased.
>+
>+**/
> VOID
> FatStrLwr (
>   IN CHAR16             *Str
>   );
>
>+/**
>+  Uppercase a string.
>+
>+  @param  Str                   The string which will be upper-cased.
>+
>+**/
> VOID
> FatStrUpr (
>   IN CHAR16             *Str
>   );
>
>+/**
>+  Performs a case-insensitive comparison of two Null-terminated Unicode strings.
>+
>+  @param  Str1                   A pointer to a Null-terminated Unicode string.
>+  @param  Str2                   A pointer to a Null-terminated Unicode string.
>+
>+  @retval 0                    S1 is equivalent to S2.
>+  @retval >0                   S1 is lexically greater than S2.
>+  @retval <0                   S1 is lexically less than S2.
>+**/
> INTN
> FatStriCmp (
>   IN CHAR16             *Str1,
>   IN CHAR16             *Str2
>   );
>
> //
> // Open.c
> //
>+
>+/**
>+
>+  Open a file for a file name relative to an existing OFile.
>+  The IFile of the newly opened file is passed out.
>+
>+  @param  OFile                 - The file that serves as a starting reference point.
>+  @param  NewIFile              - The newly generated IFile instance.
>+  @param  FileName              - The file name relative to the OFile.
>+  @param  OpenMode              - Open mode.
>+  @param  Attributes            - Attributes to set if the file is created.
>+
>+
>+  @retval EFI_SUCCESS           - Open the file successfully.
>+  @retval EFI_INVALID_PARAMETER - The open mode is conflict with the attributes
>+                          or the file name is not valid.
>+  @retval EFI_NOT_FOUND         - Conficts between dir intention and attribute.
>+  @retval EFI_WRITE_PROTECTED   - Can't open for write if the volume is read only.
>+  @retval EFI_ACCESS_DENIED     - If the file's attribute is read only, and the
>+                          open is for read-write fail it.
>+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
>+
>+**/
> EFI_STATUS
> FatOFileOpen (
>   IN FAT_OFILE          *OFile,
>   OUT FAT_IFILE         **NewIFile,
>   IN CHAR16             *FileName,
>   IN UINT64             OpenMode,
>   IN UINT8              Attributes
>   );
>
>+/**
>+
>+  Create an Open instance for the existing OFile.
>+  The IFile of the newly opened file is passed out.
>+
>+  @param  OFile                 - The file that serves as a starting reference point.
>+  @param  PtrIFile              - The newly generated IFile instance.
>+
>+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory for the IFile
>+  @retval EFI_SUCCESS           - Create the new IFile for the OFile successfully
>+
>+**/
> EFI_STATUS
> FatAllocateIFile (
>   IN FAT_OFILE          *OFile,
>   OUT FAT_IFILE         **PtrIFile
>   );
>
> //
> // OpenVolume.c
> //
>+/**
>+
>+  Implements Simple File System Protocol interface function OpenVolume().
>+
>+  @param  This                  - Calling context.
>+  @param  File                  - the Root Directory of the volume.
>+
>+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
>+  @retval EFI_VOLUME_CORRUPTED  - The FAT type is error.
>+  @retval EFI_SUCCESS           - Open the volume successfully.
>+
>+**/
> EFI_STATUS
> EFIAPI
> FatOpenVolume (
>   IN  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *This,
>   OUT EFI_FILE_PROTOCOL               **File
>   );
>
> //
> // ReadWrite.c
> //
>+/**
>+
>+  This function reads data from a file or writes data to a file.
>+  It uses OFile->PosRem to determine how much data can be accessed in one time.
>+
>+  @param  OFile                 - The open file.
>+  @param  IoMode                - Indicate whether the access mode is reading or writing.
>+  @param  Position              - The position where data will be accessed.
>+  @param  DataBufferSize        - Size of Buffer.
>+  @param  UserBuffer            - Buffer containing data.
>+  @param  Task                    point to task instance.
>+
>+  @retval EFI_SUCCESS           - Access the data successfully.
>+  @return other                 - An error occurred when operating on the disk.
>+
>+**/
> EFI_STATUS
> FatAccessOFile (
>   IN FAT_OFILE          *OFile,
>   IN IO_MODE            IoMode,
>   IN UINTN              Position,
>   IN UINTN              *DataBufferSize,
>   IN UINT8              *UserBuffer,
>   IN FAT_TASK           *Task
>   );
>
>+/**
>+
>+  Expand OFile by appending zero bytes at the end of OFile.
>+
>+  @param  OFile                 - The open file.
>+  @param  ExpandedSize          - The number of zero bytes appended at the end of the file.
>+
>+  @retval EFI_SUCCESS           - The file is expanded successfully.
>+  @return other                 - An error occurred when expanding file.
>+
>+**/
> EFI_STATUS
> FatExpandOFile (
>   IN FAT_OFILE          *OFile,
>   IN UINT64             ExpandedSize
>   );
>
>+/**
>+
>+  Write zero pool from the WritePos to the end of OFile.
>+
>+  @param  OFile                 - The open file to write zero pool.
>+  @param  WritePos              - The number of zero bytes written.
>+
>+  @retval EFI_SUCCESS           - Write the zero pool successfully.
>+  @retval EFI_OUT_OF_RESOURCES  - Not enough memory to perform the operation.
>+  @return other                 - An error occurred when writing disk.
>+
>+**/
> EFI_STATUS
> FatWriteZeroPool (
>   IN FAT_OFILE          *OFile,
>   IN UINTN              WritePos
>   );
>
>+/**
>+
>+  Truncate the OFile to smaller file size.
>+
>+  @param  OFile                 - The open file.
>+  @param  TruncatedSize         - The new file size.
>+
>+  @retval EFI_SUCCESS           - The file is truncated successfully.
>+  @return other                 - An error occurred when truncating file.
>+
>+**/
> EFI_STATUS
> FatTruncateOFile (
>   IN FAT_OFILE          *OFile,
>   IN UINTN              TruncatedSize
>   );
>
> //
> // DirectoryManage.c
> //
>+/**
>+
>+  Set the OFile's current directory cursor to the list head.
>+
>+  @param OFile                 - The directory OFile whose directory cursor is reset.
>+
>+**/
> VOID
> FatResetODirCursor (
>   IN FAT_OFILE          *OFile
>   );
>
>+/**
>+
>+  Set the directory's cursor to the next and get the next directory entry.
>+
>+  @param  OFile                 - The parent OFile.
>+  @param PtrDirEnt             - The next directory entry.
>+
>+  @retval EFI_SUCCESS           - We get the next directory entry successfully.
>+  @return other                 - An error occurred when get next directory entry.
>+
>+**/
> EFI_STATUS
> FatGetNextDirEnt (
>   IN  FAT_OFILE         *OFile,
>   OUT FAT_DIRENT        **PtrDirEnt
>   );
>
>+/**
>+
>+  Remove this directory entry node from the list of directory entries and hash table.
>+
>+  @param  OFile                - The parent OFile.
>+  @param  DirEnt               - The directory entry to be removed.
>+
>+  @retval EFI_SUCCESS          - The directory entry is successfully removed.
>+  @return other                - An error occurred when removing the directory entry.
>+
>+**/
> EFI_STATUS
> FatRemoveDirEnt (
>   IN FAT_OFILE          *OFile,
>   IN FAT_DIRENT         *DirEnt
>   );
>
>+/**
>+
>+  Save the directory entry to disk.
>+
>+  @param  OFile                 - The parent OFile which needs to update.
>+  @param  DirEnt                - The directory entry to be saved.
>+
>+  @retval EFI_SUCCESS           - Store the directory entry successfully.
>+  @return other                 - An error occurred when writing the directory entry.
>+
>+**/
> EFI_STATUS
> FatStoreDirEnt (
>   IN FAT_OFILE          *OFile,
>   IN FAT_DIRENT         *DirEnt
>   );
>
>+/**
>+
>+  Create a directory entry in the parent OFile.
>+
>+  @param  OFile                 - The parent OFile.
>+  @param  FileName              - The filename of the newly-created directory entry.
>+  @param  Attributes            - The attribute of the newly-created directory entry.
>+  @param  PtrDirEnt             - The pointer to the newly-created directory entry.
>+
>+  @retval EFI_SUCCESS           - The directory entry is successfully created.
>+  @retval EFI_OUT_OF_RESOURCES  - Not enough memory to create the directory entry.
>+  @return other                 - An error occurred when creating the directory entry.
>+
>+**/
> EFI_STATUS
> FatCreateDirEnt (
>   IN  FAT_OFILE         *OFile,
>   IN  CHAR16            *FileName,
>   IN  UINT8             Attributes,
>   OUT FAT_DIRENT        **PtrDirEnt
>   );
>
>+/**
>+
>+  Determine whether the directory entry is "." or ".." entry.
>+
>+  @param  DirEnt               - The corresponding directory entry.
>+
>+  @retval TRUE                 - The directory entry is "." or ".." directory entry
>+  @retval FALSE                - The directory entry is not "." or ".." directory entry
>+
>+**/
> BOOLEAN
> FatIsDotDirEnt (
>   IN FAT_DIRENT         *DirEnt
>   );
>
>+/**
>+
>+  Set the OFile's cluster and size info in its directory entry.
>+
>+  @param  OFile                 - The corresponding OFile.
>+
>+**/
> VOID
> FatUpdateDirEntClusterSizeInfo (
>   IN FAT_OFILE          *OFile
>   );
>
>+/**
>+
>+  Copy all the information of DirEnt2 to DirEnt1 except for 8.3 name.
>+
>+  @param  DirEnt1               - The destination directory entry.
>+  @param  DirEnt2               - The source directory entry.
>+
>+**/
> VOID
> FatCloneDirEnt (
>   IN  FAT_DIRENT        *DirEnt1,
>   IN  FAT_DIRENT        *DirEnt2
>   );
>
>+/**
>+
>+  Get the directory entry's info into Buffer.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  DirEnt                - The corresponding directory entry.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing file info.
>+
>+  @retval EFI_SUCCESS           - Get the file info successfully.
>+  @retval EFI_BUFFER_TOO_SMALL  - The buffer is too small.
>+
>+**/
> EFI_STATUS
> FatGetDirEntInfo (
>   IN FAT_VOLUME         *Volume,
>   IN FAT_DIRENT         *DirEnt,
>   IN OUT UINTN          *BufferSize,
>   OUT VOID              *Buffer
>   );
>
>+/**
>+
>+  Open the directory entry to get the OFile.
>+
>+  @param  Parent                - The parent OFile.
>+  @param  DirEnt                - The directory entry to be opened.
>+
>+  @retval EFI_SUCCESS           - The directory entry is successfully opened.
>+  @retval EFI_OUT_OF_RESOURCES  - not enough memory to allocate a new OFile.
>+  @return other                 - An error occurred when opening the directory entry.
>+
>+**/
> EFI_STATUS
> FatOpenDirEnt (
>   IN FAT_OFILE          *OFile,
>   IN FAT_DIRENT         *DirEnt
>   );
>
>+/**
>+
>+  Create "." and ".." directory entries in the newly-created parent OFile.
>+
>+  @param  OFile                 - The parent OFile.
>+
>+  @retval EFI_SUCCESS           - The dot directory entries are successfully created.
>+  @return other                 - An error occurred when creating the directory entry.
>+
>+**/
> EFI_STATUS
> FatCreateDotDirEnts (
>   IN FAT_OFILE          *OFile
>   );
>
>+/**
>+
>+  Close the directory entry and free the OFile.
>+
>+  @param  DirEnt               - The directory entry to be closed.
>+
>+**/
> VOID
> FatCloseDirEnt (
>   IN FAT_DIRENT         *DirEnt
>   );
>
>+/**
>+
>+  Traverse filename and open all OFiles that can be opened.
>+  Update filename pointer to the component that can't be opened.
>+  If more than one name component remains, returns an error;
>+  otherwise, return the remaining name component so that the caller might choose to create it.
>+
>+  @param  PtrOFile              - As input, the reference OFile; as output, the located OFile.
>+  @param  FileName              - The file name relevant to the OFile.
>+  @param  Attributes            - The attribute of the destination OFile.
>+  @param  NewFileName           - The remaining file name.
>+
>+  @retval EFI_NOT_FOUND         - The file name can't be opened and there is more than one
>+                          components within the name left (this means the name can
>+                          not be created either).
>+  @retval EFI_INVALID_PARAMETER - The parameter is not valid.
>+  @retval EFI_SUCCESS           - Open the file successfully.
>+  @return other                 - An error occured when locating the OFile.
>+
>+**/
> EFI_STATUS
> FatLocateOFile (
>   IN OUT FAT_OFILE      **PtrOFile,
>   IN     CHAR16         *FileName,
>   IN     UINT8          Attributes,
>      OUT CHAR16         *NewFileName
>   );
>
>+/**
>+
>+  Get the directory entry for the volume.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  Name                  - The file name of the volume.
>+
>+  @retval EFI_SUCCESS           - Update the volume with the directory entry sucessfully.
>+  @return others                - An error occurred when getting volume label.
>+
>+**/
> EFI_STATUS
> FatGetVolumeEntry (
>   IN FAT_VOLUME         *Volume,
>   IN CHAR16             *Name
>   );
>
>+/**
>+
>+  Set the relevant directory entry into disk for the volume.
>+
>+  @param  Volume              - FAT file system volume.
>+  @param  Name                - The new file name of the volume.
>+
>+  @retval EFI_SUCCESS         - Update the Volume sucessfully.
>+  @retval EFI_UNSUPPORTED     - The input label is not a valid volume label.
>+  @return other               - An error occurred when setting volume label.
>+
>+**/
> EFI_STATUS
> FatSetVolumeEntry (
>   IN FAT_VOLUME         *Volume,
>   IN CHAR16             *Name
>   );
>
> //
> // Hash.c
> //
>+/**
>+
>+  Search the long name hash table for the directory entry.
>+
>+  @param  ODir                  - The directory to be searched.
>+  @param  LongNameString        - The long name string to search.
>+
>+  @return The previous long name hash node of the directory entry.
>+
>+**/
> FAT_DIRENT **
> FatLongNameHashSearch (
>   IN FAT_ODIR           *ODir,
>   IN CHAR16             *LongNameString
>   );
>
>+/**
>+
>+  Search the short name hash table for the directory entry.
>+
>+  @param  ODir                  - The directory to be searched.
>+  @param  ShortNameString       - The short name string to search.
>+
>+  @return The previous short name hash node of the directory entry.
>+
>+**/
> FAT_DIRENT **
> FatShortNameHashSearch (
>   IN FAT_ODIR           *ODir,
>   IN CHAR8              *ShortNameString
>   );
>
>+/**
>+
>+  Insert directory entry to hash table.
>+
>+  @param  ODir                  - The parent directory.
>+  @param  DirEnt                - The directory entry node.
>+
>+**/
> VOID
> FatInsertToHashTable (
>   IN FAT_ODIR           *ODir,
>   IN FAT_DIRENT         *DirEnt
>   );
>
>+/**
>+
>+  Delete directory entry from hash table.
>+
>+  @param  ODir                  - The parent directory.
>+  @param  DirEnt                - The directory entry node.
>+
>+**/
> VOID
> FatDeleteFromHashTable (
>   IN FAT_ODIR           *ODir,
>   IN FAT_DIRENT         *DirEnt
>   );
>
> //
> // FileName.c
> //
>+/**
>+
>+  This function checks whether the input FileName is a valid 8.3 short name.
>+  If the input FileName is a valid 8.3, the output is the 8.3 short name;
>+  otherwise, the output is the base tag of 8.3 short name.
>+
>+  @param  FileName              - The input unicode filename.
>+  @param  File8Dot3Name         - The output ascii 8.3 short name or base tag of 8.3 short name.
>+
>+  @retval TRUE                  - The input unicode filename is a valid 8.3 short name.
>+  @retval FALSE                 - The input unicode filename is not a valid 8.3 short name.
>+
>+**/
> BOOLEAN
> FatCheckIs8Dot3Name (
>   IN CHAR16             *FileName,
>   OUT CHAR8             *File8Dot3Name
>   );
>
>+/**
>+
>+  This function generates 8Dot3 name from user specified name for a newly created file.
>+
>+  @param  Parent                - The parent directory.
>+  @param  DirEnt                - The directory entry whose 8Dot3Name needs to be generated.
>+
>+**/
> VOID
> FatCreate8Dot3Name (
>   IN FAT_OFILE          *Parent,
>   IN FAT_DIRENT         *DirEnt
>   );
>
>+/**
>+
>+  Convert the ascii fat name to the unicode string and strip trailing spaces,
>+  and if necessary, convert the unicode string to lower case.
>+
>+  @param  FatName               - The Char8 string needs to be converted.
>+  @param  Len                   - The length of the fat name.
>+  @param  LowerCase             - Indicate whether to convert the string to lower case.
>+  @param  Str                   - The result of the convertion.
>+
>+**/
> VOID
> FatNameToStr (
>   IN CHAR8              *FatName,
>   IN UINTN              Len,
>   IN UINTN              LowerCase,
>   IN CHAR16             *Str
>   );
>
>+/**
>+
>+  Set the caseflag value for the directory entry.
>+
>+  @param DirEnt                - The logical directory entry whose caseflag value is to be set.
>+
>+**/
> VOID
> FatSetCaseFlag (
>   IN FAT_DIRENT         *DirEnt
>   );
>
>+/**
>+
>+  Convert the 8.3 ASCII fat name to cased Unicode string according to case flag.
>+
>+  @param  DirEnt                - The corresponding directory entry.
>+  @param  FileString            - The output Unicode file name.
>+  @param  FileStringMax           The max length of FileString.
>+
>+**/
> VOID
> FatGetFileNameViaCaseFlag (
>   IN     FAT_DIRENT     *DirEnt,
>   IN OUT CHAR16         *FileString,
>   IN     UINTN          FileStringMax
>   );
>
>+/**
>+
>+  Get the Check sum for a short name.
>+
>+  @param  ShortNameString       - The short name for a file.
>+
>+  @retval Sum                   - UINT8 checksum.
>+
>+**/
> UINT8
> FatCheckSum (
>   IN CHAR8              *ShortNameString
>   );
>
>+/**
>+
>+  Takes Path as input, returns the next name component
>+  in Name, and returns the position after Name (e.g., the
>+  start of the next name component)
>+
>+  @param  Path                  - The path of one file.
>+  @param  Name                  - The next name component in Path.
>+
>+  The position after Name in the Path
>+
>+**/
> CHAR16*
> FatGetNextNameComponent (
>   IN  CHAR16            *Path,
>   OUT CHAR16            *Name
>   );
>
>+/**
>+
>+  Check whether the IFileName is valid long file name. If the IFileName is a valid
>+  long file name, then we trim the possible leading blanks and leading/trailing dots.
>+  the trimmed filename is stored in OutputFileName
>+
>+  @param  InputFileName         - The input file name.
>+  @param  OutputFileName        - The output file name.
>+
>+  @retval TRUE                  - The InputFileName is a valid long file name.
>+  @retval FALSE                 - The InputFileName is not a valid long file name.
>+
>+**/
> BOOLEAN
> FatFileNameIsValid (
>   IN  CHAR16  *InputFileName,
>   OUT CHAR16  *OutputFileName
>   );
>
> //
> // DirectoryCache.c
> //
>+/**
>+
>+  Discard the directory structure when an OFile will be freed.
>+  Volume will cache this directory if the OFile does not represent a deleted file.
>+
>+  @param  OFile                 - The OFile whose directory structure is to be discarded.
>+
>+**/
> VOID
> FatDiscardODir (
>   IN FAT_OFILE    *OFile
>   );
>
>+/**
>+
>+  Request the directory structure when an OFile is newly generated.
>+  If the directory structure is cached by volume, then just return this directory;
>+  Otherwise, allocate a new one for OFile.
>+
>+  @param  OFile                 - The OFile which requests directory structure.
>+
>+**/
> VOID
> FatRequestODir (
>   IN FAT_OFILE    *OFile
>   );
>
>+/**
>+
>+  Clean up all the cached directory structures when the volume is going to be abandoned.
>+
>+  @param  Volume                - FAT file system volume.
>+
>+**/
> VOID
> FatCleanupODirCache (
>   IN FAT_VOLUME   *Volume
>   );
>
>diff --git a/FatPkg/EnhancedFatDxe/Info.c b/FatPkg/EnhancedFatDxe/Info.c
>index 1a7f828..50b840b 100644
>--- a/FatPkg/EnhancedFatDxe/Info.c
>+++ b/FatPkg/EnhancedFatDxe/Info.c
>@@ -14,24 +14,64 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
> **/
>
> #include "Fat.h"
>
>+/**
>+
>+  Get the volume's info into Buffer.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing volume info.
>+
>+  @retval EFI_SUCCESS           - Get the volume info successfully.
>+  @retval EFI_BUFFER_TOO_SMALL  - The buffer is too small.
>+
>+**/
> EFI_STATUS
> FatGetVolumeInfo (
>   IN FAT_VOLUME       *Volume,
>   IN OUT UINTN        *BufferSize,
>   OUT VOID            *Buffer
>   );
>
>+/**
>+
>+  Set the volume's info.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing the new volume info.
>+
>+  @retval EFI_SUCCESS           - Set the volume info successfully.
>+  @retval EFI_BAD_BUFFER_SIZE   - The buffer size is error.
>+  @retval EFI_WRITE_PROTECTED   - The volume is read only.
>+  @return other                 - An error occurred when operation the disk.
>+
>+**/
> EFI_STATUS
> FatSetVolumeInfo (
>   IN FAT_VOLUME       *Volume,
>   IN UINTN            BufferSize,
>   IN VOID            *Buffer
>   );
>
>+/**
>+
>+  Set or Get the some types info of the file into Buffer.
>+
>+  @param  IsSet      - TRUE:The access is set, else is get
>+  @param  FHand      - The handle of file
>+  @param  Type       - The type of the info
>+  @param  BufferSize - Size of Buffer
>+  @param  Buffer     - Buffer containing volume info
>+
>+  @retval EFI_SUCCESS       - Get the info successfully
>+  @retval EFI_DEVICE_ERROR  - Can not find the OFile for the file
>+
>+**/
> EFI_STATUS
> FatSetOrGetInfo (
>   IN BOOLEAN              IsSet,
>   IN EFI_FILE_PROTOCOL    *FHand,
>   IN EFI_GUID             *Type,
>--
>1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [patch 6/8] FatPkg\EnhancedFatDxe: Make the comments align with EDKII coding style
  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
  0 siblings, 0 replies; 27+ messages in thread
From: Ni, Ruiyu @ 2016-12-09  1:10 UTC (permalink / raw)
  To: Bi, Dandan, edk2-devel@lists.01.org

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

Regards,
Ray

>-----Original Message-----
>From: Bi, Dandan
>Sent: Thursday, December 8, 2016 6:54 PM
>To: edk2-devel@lists.01.org
>Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
>Subject: [patch 6/8] FatPkg\EnhancedFatDxe: Make the comments align with EDKII coding style
>
>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/ComponentName.c    |  10 +-
> FatPkg/EnhancedFatDxe/Data.c             |  16 +-
> FatPkg/EnhancedFatDxe/Debug.c            |  34 +-
> FatPkg/EnhancedFatDxe/Delete.c           |  35 +-
> FatPkg/EnhancedFatDxe/DirectoryCache.c   | 120 ++---
> FatPkg/EnhancedFatDxe/DirectoryManage.c  | 726 ++++++++++++-------------------
> FatPkg/EnhancedFatDxe/DiskCache.c        | 257 +++++------
> FatPkg/EnhancedFatDxe/Fat.c              | 169 +++----
> FatPkg/EnhancedFatDxe/Fat.h              | 394 +++++++----------
> FatPkg/EnhancedFatDxe/FatFileSystem.h    |  15 +-
> FatPkg/EnhancedFatDxe/FileName.c         | 272 +++++-------
> FatPkg/EnhancedFatDxe/FileSpace.c        | 334 ++++++--------
> FatPkg/EnhancedFatDxe/Flush.c            | 246 ++++-------
> FatPkg/EnhancedFatDxe/Hash.c             | 158 +++----
> FatPkg/EnhancedFatDxe/Info.c             | 320 ++++++--------
> FatPkg/EnhancedFatDxe/Init.c             |  95 ++--
> FatPkg/EnhancedFatDxe/Misc.c             | 402 ++++++-----------
> FatPkg/EnhancedFatDxe/Open.c             | 172 +++-----
> FatPkg/EnhancedFatDxe/OpenVolume.c       |  40 +-
> FatPkg/EnhancedFatDxe/ReadWrite.c        | 392 +++++++----------
> FatPkg/EnhancedFatDxe/UnicodeCollation.c |   6 +-
> 21 files changed, 1565 insertions(+), 2648 deletions(-)
>
>diff --git a/FatPkg/EnhancedFatDxe/ComponentName.c b/FatPkg/EnhancedFatDxe/ComponentName.c
>index af3f9e6..ce1c975 100644
>--- a/FatPkg/EnhancedFatDxe/ComponentName.c
>+++ b/FatPkg/EnhancedFatDxe/ComponentName.c
>@@ -1,6 +1,6 @@
>-/*++
>+/** @file
>
> Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
>@@ -8,17 +8,11 @@ http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>
>-Module Name:
>-
>-  ComponentName.c
>-
>-Abstract:
>-
>---*/
>+**/
>
> #include "Fat.h"
>
> //
> // EFI Component Name Functions
>diff --git a/FatPkg/EnhancedFatDxe/Data.c b/FatPkg/EnhancedFatDxe/Data.c
>index b20cc45..56a265e 100644
>--- a/FatPkg/EnhancedFatDxe/Data.c
>+++ b/FatPkg/EnhancedFatDxe/Data.c
>@@ -1,28 +1,18 @@
>-/*++
>+/** @file
>+  Global data in the FAT Filesystem driver.
>
> Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
> http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>-
>-Module Name:
>-
>-  Data.c
>-
>-Abstract:
>-
>-  Global data in the FAT Filesystem driver
>-
>-Revision History
>-
>---*/
>+**/
>
> #include "Fat.h"
>
> //
> // Globals
>diff --git a/FatPkg/EnhancedFatDxe/Debug.c b/FatPkg/EnhancedFatDxe/Debug.c
>index 7c0dc20..ad23786 100644
>--- a/FatPkg/EnhancedFatDxe/Debug.c
>+++ b/FatPkg/EnhancedFatDxe/Debug.c
>@@ -1,50 +1,32 @@
>-/*++
>+/** @file
>+  Debug functions for fat driver
>
> Copyright (c) 2005, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
> http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>+**/
>
>-Module Name:
>-
>-  debug.c
>-
>-Abstract:
>-
>-  Debug functions for fat driver
>+#include "Fat.h"
>
>-Revision History
>+/**
>
>---*/
>+  Dump all the FAT Entry of the FAT table in the volume.
>
>-#include "Fat.h"
>+  @param  Volume - The volume whose FAT info will be dumped
>
>+**/
> VOID
> FatDumpFatTable (
>   IN FAT_VOLUME   *Volume
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Dump all the FAT Entry of the FAT table in the volume
>-
>-Arguments:
>-
>-  Volume - The volume whose FAT info will be dumped
>-
>-Returns:
>-
>-  None
>-
>---*/
> {
>   UINTN   EntryValue;
>   UINTN   MaxIndex;
>   UINTN   Index;
>   CHAR16  *Pointer;
>diff --git a/FatPkg/EnhancedFatDxe/Delete.c b/FatPkg/EnhancedFatDxe/Delete.c
>index e5103a8..9837565 100644
>--- a/FatPkg/EnhancedFatDxe/Delete.c
>+++ b/FatPkg/EnhancedFatDxe/Delete.c
>@@ -1,6 +1,7 @@
>-/*++
>+/** @file
>+  Function that deletes a file.
>
> Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
>@@ -8,45 +9,29 @@ http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>
>-Module Name:
>+**/
>
>-  delete.c
>-
>-Abstract:
>+#include "Fat.h"
>
>-  Function that deletes a file
>+/**
>
>-Revision History
>+  Deletes the file & Closes the file handle.
>
>---*/
>+  @param  FHand                    - Handle to the file to delete.
>
>-#include "Fat.h"
>+  @retval EFI_SUCCESS              - Delete the file successfully.
>+  @retval EFI_WARN_DELETE_FAILURE  - Fail to delete the file.
>
>+**/
> EFI_STATUS
> EFIAPI
> FatDelete (
>   IN EFI_FILE_PROTOCOL  *FHand
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Deletes the file & Closes the file handle.
>-
>-Arguments:
>-
>-  FHand                    - Handle to the file to delete.
>-
>-Returns:
>-
>-  EFI_SUCCESS              - Delete the file successfully.
>-  EFI_WARN_DELETE_FAILURE  - Fail to delete the file.
>-
>---*/
> {
>   FAT_IFILE   *IFile;
>   FAT_OFILE   *OFile;
>   FAT_DIRENT  *DirEnt;
>   EFI_STATUS  Status;
>diff --git a/FatPkg/EnhancedFatDxe/DirectoryCache.c b/FatPkg/EnhancedFatDxe/DirectoryCache.c
>index 568b291..30de86a 100644
>--- a/FatPkg/EnhancedFatDxe/DirectoryCache.c
>+++ b/FatPkg/EnhancedFatDxe/DirectoryCache.c
>@@ -1,6 +1,7 @@
>-/*++
>+/** @file
>+  Functions for directory cache operation.
>
> Copyright (c) 2005, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
>@@ -8,44 +9,26 @@ http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>
>-Module Name:
>+**/
>
>-  DirectoryCache.c
>-
>-Abstract:
>-
>-  Functions for directory cache operation
>+#include "Fat.h"
>
>-Revision History
>+/**
>
>---*/
>+  Free the directory structure and release the memory.
>
>-#include "Fat.h"
>+  @param  ODir                  - The directory to be freed.
>
>+**/
> STATIC
> VOID
> FatFreeODir (
>   IN FAT_ODIR    *ODir
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Free the directory structure and release the memory.
>-
>-Arguments:
>-
>-  ODir                  - The directory to be freed.
>-
>-Returns:
>-
>-  None.
>-
>---*/
> {
>   FAT_DIRENT  *DirEnt;
>
>   //
>   // Release Directory Entry Nodes
>@@ -61,30 +44,22 @@ Returns:
>   }
>
>   FreePool (ODir);
> }
>
>+/**
>+
>+  Allocate the directory structure.
>+
>+  @param  OFile                   - The corresponding OFile.
>+
>+**/
> STATIC
> FAT_ODIR *
> FatAllocateODir (
>   IN FAT_OFILE   *OFile
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Allocate the directory structure.
>-
>-Arguments:
>-
>-  OFile                   - The corresponding OFile.
>-
>-Returns:
>-
>-  None.
>-
>---*/
> {
>   FAT_ODIR  *ODir;
>
>   ODir = AllocateZeroPool (sizeof (FAT_ODIR));
>   if (ODir != NULL) {
>@@ -97,30 +72,22 @@ Returns:
>   }
>
>   return ODir;
> }
>
>-VOID
>-FatDiscardODir (
>-  IN FAT_OFILE    *OFile
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Discard the directory structure when an OFile will be freed.
>   Volume will cache this directory if the OFile does not represent a deleted file.
>
>-Arguments:
>+  @param  OFile                 - The OFile whose directory structure is to be discarded.
>
>-  OFile                 - The OFile whose directory structure is to be discarded.
>-
>-Returns:
>-
>-  None.
>-
>---*/
>+**/
>+VOID
>+FatDiscardODir (
>+  IN FAT_OFILE    *OFile
>+  )
> {
>   FAT_ODIR    *ODir;
>   FAT_VOLUME  *Volume;
>
>   Volume  = OFile->Volume;
>@@ -152,31 +119,24 @@ Returns:
>   if (ODir != NULL) {
>     FatFreeODir (ODir);
>   }
> }
>
>-VOID
>-FatRequestODir (
>-  IN FAT_OFILE    *OFile
>-  )
>-/*++
>+/**
>
>-Routine Description:
>
>   Request the directory structure when an OFile is newly generated.
>   If the directory structure is cached by volume, then just return this directory;
>   Otherwise, allocate a new one for OFile.
>
>-Arguments:
>-
>-  OFile                 - The OFile which requests directory structure.
>+  @param  OFile                 - The OFile which requests directory structure.
>
>-Returns:
>-
>-  None.
>-
>---*/
>+**/
>+VOID
>+FatRequestODir (
>+  IN FAT_OFILE    *OFile
>+  )
> {
>   UINTN           DirCacheTag;
>   FAT_VOLUME      *Volume;
>   FAT_ODIR        *ODir;
>   FAT_ODIR        *CurrentODir;
>@@ -206,29 +166,21 @@ Returns:
>   }
>
>   OFile->ODir = ODir;
> }
>
>-VOID
>-FatCleanupODirCache (
>-  IN FAT_VOLUME         *Volume
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Clean up all the cached directory structures when the volume is going to be abandoned.
>
>-Arguments:
>+  @param  Volume                - FAT file system volume.
>
>-  Volume                - FAT file system volume.
>-
>-Returns:
>-
>-  None.
>-
>---*/
>+**/
>+VOID
>+FatCleanupODirCache (
>+  IN FAT_VOLUME         *Volume
>+  )
> {
>   FAT_ODIR  *ODir;
>   while (Volume->DirCacheCount > 0) {
>     ODir = ODIR_FROM_DIRCACHELINK (Volume->DirCacheList.BackLink);
>     RemoveEntryList (&ODir->DirCacheLink);
>diff --git a/FatPkg/EnhancedFatDxe/DirectoryManage.c b/FatPkg/EnhancedFatDxe/DirectoryManage.c
>index 149119d..fe6fcc9 100644
>--- a/FatPkg/EnhancedFatDxe/DirectoryManage.c
>+++ b/FatPkg/EnhancedFatDxe/DirectoryManage.c
>@@ -1,58 +1,42 @@
>-/*++
>+/** @file
>+  Functions for performing directory entry io.
>
> Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
> http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>+**/
>
>-Module Name:
>-
>-  DirectoryManage.c
>-
>-Abstract:
>+#include "Fat.h"
>
>-  Functions for performing directory entry io
>+/**
>
>-Revision History
>+  Get a directory entry from disk for the Ofile.
>
>---*/
>+  @param  Parent                - The parent of the OFile which need to update.
>+  @param  IoMode                - Indicate whether to read directory entry or write directroy entry.
>+  @param  EntryPos              - The position of the directory entry to be accessed.
>+  @param  Entry                 - The directory entry read or written.
>
>-#include "Fat.h"
>+  @retval EFI_SUCCESS           - Access the directory entry sucessfully.
>+  @return other                 - An error occurred when reading the directory entry.
>
>+**/
> STATIC
> EFI_STATUS
> FatAccessEntry (
>   IN     FAT_OFILE            *Parent,
>   IN     IO_MODE              IoMode,
>   IN     UINTN                EntryPos,
>   IN OUT VOID                 *Entry
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get a directory entry from disk for the Ofile.
>-
>-Arguments:
>-
>-  Parent                - The parent of the OFile which need to update.
>-  IoMode                - Indicate whether to read directory entry or write directroy entry.
>-  EntryPos              - The position of the directory entry to be accessed.
>-  Entry                 - The directory entry read or written.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Access the directory entry sucessfully.
>-  other                 - An error occurred when reading the directory entry.
>-
>---*/
> {
>   UINTN Position;
>   UINTN BufferSize;
>
>   Position = EntryPos * sizeof (FAT_DIRECTORY_ENTRY);
>@@ -68,32 +52,26 @@ Returns:
>
>   BufferSize = sizeof (FAT_DIRECTORY_ENTRY);
>   return FatAccessOFile (Parent, IoMode, Position, &BufferSize, Entry, NULL);
> }
>
>-EFI_STATUS
>-FatStoreDirEnt (
>-  IN FAT_OFILE            *OFile,
>-  IN FAT_DIRENT           *DirEnt
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Save the directory entry to disk.
>
>-Arguments:
>-
>-  OFile                 - The parent OFile which needs to update.
>-  DirEnt                - The directory entry to be saved.
>-
>-Returns:
>+  @param  OFile                 - The parent OFile which needs to update.
>+  @param  DirEnt                - The directory entry to be saved.
>
>-  EFI_SUCCESS           - Store the directory entry successfully.
>-  other                 - An error occurred when writing the directory entry.
>+  @retval EFI_SUCCESS           - Store the directory entry successfully.
>+  @return other                 - An error occurred when writing the directory entry.
>
>---*/
>+**/
>+EFI_STATUS
>+FatStoreDirEnt (
>+  IN FAT_OFILE            *OFile,
>+  IN FAT_DIRENT           *DirEnt
>+  )
> {
>   EFI_STATUS        Status;
>   FAT_DIRECTORY_LFN LfnEntry;
>   UINTN             EntryPos;
>   CHAR16            *LfnBufferPointer;
>@@ -155,116 +133,86 @@ Returns:
>   }
>
>   return EFI_SUCCESS;
> }
>
>-BOOLEAN
>-FatIsDotDirEnt (
>-  IN FAT_DIRENT  *DirEnt
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Determine whether the directory entry is "." or ".." entry.
>
>-Arguments:
>+  @param  DirEnt               - The corresponding directory entry.
>
>-  DirEnt               - The corresponding directory entry.
>+  @retval TRUE                 - The directory entry is "." or ".." directory entry
>+  @retval FALSE                - The directory entry is not "." or ".." directory entry
>
>-Returns:
>-
>-  TRUE                 - The directory entry is "." or ".." directory entry
>-  FALSE                - The directory entry is not "." or ".." directory entry
>-
>---*/
>+**/
>+BOOLEAN
>+FatIsDotDirEnt (
>+  IN FAT_DIRENT  *DirEnt
>+  )
> {
>   CHAR16  *FileString;
>   FileString = DirEnt->FileString;
>   if (StrCmp (FileString, L".") == 0 || StrCmp (FileString, L"..") == 0) {
>     return TRUE;
>   }
>
>   return FALSE;
> }
>
>+/**
>+
>+  Set the OFile's cluster info in its directory entry.
>+
>+  @param  OFile                 - The corresponding OFile.
>+
>+**/
> STATIC
> VOID
> FatSetDirEntCluster (
>   IN FAT_OFILE    *OFile
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Set the OFile's cluster info in its directory entry.
>-
>-Arguments:
>-
>-  OFile                 - The corresponding OFile.
>-
>-Returns:
>-
>-  None.
>-
>---*/
> {
>   UINTN       Cluster;
>   FAT_DIRENT  *DirEnt;
>
>   DirEnt                        = OFile->DirEnt;
>   Cluster                       = OFile->FileCluster;
>   DirEnt->Entry.FileClusterHigh = (UINT16) (Cluster >> 16);
>   DirEnt->Entry.FileCluster     = (UINT16) Cluster;
> }
>
>-VOID
>-FatUpdateDirEntClusterSizeInfo (
>-  IN FAT_OFILE    *OFile
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Set the OFile's cluster and size info in its directory entry.
>
>-Arguments:
>-
>-  OFile                 - The corresponding OFile.
>-
>-Returns:
>-
>-  None.
>+  @param  OFile                 - The corresponding OFile.
>
>---*/
>+**/
>+VOID
>+FatUpdateDirEntClusterSizeInfo (
>+  IN FAT_OFILE    *OFile
>+  )
> {
>   ASSERT (OFile->ODir == NULL);
>   OFile->DirEnt->Entry.FileSize = (UINT32) OFile->FileSize;
>   FatSetDirEntCluster (OFile);
> }
>
>+/**
>+
>+  Copy all the information of DirEnt2 to DirEnt1 except for 8.3 name.
>+
>+  @param  DirEnt1               - The destination directory entry.
>+  @param  DirEnt2               - The source directory entry.
>+
>+**/
> VOID
> FatCloneDirEnt (
>   IN  FAT_DIRENT          *DirEnt1,
>   IN  FAT_DIRENT          *DirEnt2
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Copy all the information of DirEnt2 to DirEnt1 except for 8.3 name.
>-
>-Arguments:
>-
>-  DirEnt1               - The destination directory entry.
>-  DirEnt2               - The source directory entry.
>-
>-Returns:
>-
>-  None.
>-
>---*/
> {
>   UINT8 *Entry1;
>   UINT8 *Entry2;
>   Entry1  = (UINT8 *) &DirEnt1->Entry;
>   Entry2  = (UINT8 *) &DirEnt2->Entry;
>@@ -273,32 +221,24 @@ Returns:
>     Entry2 + FAT_ENTRY_INFO_OFFSET,
>     sizeof (FAT_DIRECTORY_ENTRY) - FAT_ENTRY_INFO_OFFSET
>     );
> }
>
>+/**
>+
>+  Get the LFN for the directory entry.
>+
>+  @param  Parent                - The parent directory.
>+  @param  DirEnt                - The directory entry to get LFN.
>+
>+**/
> STATIC
> VOID
> FatLoadLongNameEntry (
>   IN FAT_OFILE           *Parent,
>   IN FAT_DIRENT          *DirEnt
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get the LFN for the directory entry.
>-
>-Arguments:
>-
>-  Parent                - The parent directory.
>-  DirEnt                - The directory entry to get LFN.
>-
>-Returns:
>-
>-  None.
>-
>---*/
> {
>   CHAR16            LfnBuffer[MAX_LFN_ENTRIES * LFN_CHAR_TOTAL + 1];
>   CHAR16            *LfnBufferPointer;
>   CHAR8             *File8Dot3Name;
>   UINTN             EntryPos;
>@@ -365,64 +305,50 @@ Returns:
>   }
>
>   DirEnt->FileString = AllocateCopyPool (StrSize (LfnBuffer), LfnBuffer);
> }
>
>+/**
>+
>+  Add this directory entry node to the list of directory entries and hash table.
>+
>+  @param  ODir                  - The parent OFile which needs to be updated.
>+  @param  DirEnt                - The directory entry to be added.
>+
>+**/
> STATIC
> VOID
> FatAddDirEnt (
>   IN FAT_ODIR             *ODir,
>   IN FAT_DIRENT           *DirEnt
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Add this directory entry node to the list of directory entries and hash table.
>-
>-Arguments:
>-
>-  ODir                  - The parent OFile which needs to be updated.
>-  DirEnt                - The directory entry to be added.
>-
>-Returns:
>-
>-  None.
>-
>---*/
> {
>   if (DirEnt->Link.BackLink == NULL) {
>     DirEnt->Link.BackLink = &ODir->ChildList;
>   }
>   InsertTailList (DirEnt->Link.BackLink, &DirEnt->Link);
>   FatInsertToHashTable (ODir, DirEnt);
> }
>
>+/**
>+
>+  Load from disk the next directory entry at current end of directory position.
>+
>+  @param  OFile                 - The parent OFile.
>+  @param  PtrDirEnt             - The directory entry that is loaded.
>+
>+  @retval EFI_SUCCESS           - Load the directory entry successfully.
>+  @retval EFI_OUT_OF_RESOURCES  - Out of resource.
>+  @return other                 - An error occurred when reading the directory entries.
>+
>+**/
> STATIC
> EFI_STATUS
> FatLoadNextDirEnt (
>   IN  FAT_OFILE           *OFile,
>   OUT FAT_DIRENT          **PtrDirEnt
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Load from disk the next directory entry at current end of directory position
>-
>-Arguments:
>-
>-  OFile                 - The parent OFile.
>-  PtrDirEnt             - The directory entry that is loaded.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Load the directory entry successfully.
>-  EFI_OUT_OF_RESOURCES  - Out of resource.
>-  other                 - An error occurred when reading the directory entries.
>-
>---*/
> {
>   EFI_STATUS          Status;
>   FAT_DIRENT          *DirEnt;
>   FAT_ODIR            *ODir;
>   FAT_DIRECTORY_ENTRY Entry;
>@@ -503,36 +429,30 @@ Returns:
> Done:
>   FatFreeDirEnt (DirEnt);
>   return Status;
> }
>
>+/**
>+
>+  Get the directory entry's info into Buffer.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  DirEnt                - The corresponding directory entry.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing file info.
>+
>+  @retval EFI_SUCCESS           - Get the file info successfully.
>+  @retval EFI_BUFFER_TOO_SMALL  - The buffer is too small.
>+
>+**/
> EFI_STATUS
> FatGetDirEntInfo (
>   IN     FAT_VOLUME         *Volume,
>   IN     FAT_DIRENT         *DirEnt,
>   IN OUT UINTN              *BufferSize,
>      OUT VOID               *Buffer
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get the directory entry's info into Buffer.
>-
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>-  DirEnt                - The corresponding directory entry.
>-  BufferSize            - Size of Buffer.
>-  Buffer                - Buffer containing file info.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Get the file info successfully.
>-  EFI_BUFFER_TOO_SMALL  - The buffer is too small.
>-
>---*/
> {
>   UINTN               Size;
>   UINTN               NameSize;
>   UINTN               ResultSize;
>   UINTN               Cluster;
>@@ -573,35 +493,29 @@ Returns:
>
>   *BufferSize = ResultSize;
>   return Status;
> }
>
>+/**
>+
>+  Search the directory for the directory entry whose filename is FileNameString.
>+
>+  @param  OFile                 - The parent OFile whose directory is to be searched.
>+  @param  FileNameString        - The filename to be searched.
>+  @param  PtrDirEnt             - pointer to the directory entry if found.
>+
>+  @retval EFI_SUCCESS           - Find the directory entry or not found.
>+  @return other                 - An error occurred when reading the directory entries.
>+
>+**/
> STATIC
> EFI_STATUS
> FatSearchODir (
>   IN  FAT_OFILE      *OFile,
>   IN  CHAR16         *FileNameString,
>   OUT FAT_DIRENT     **PtrDirEnt
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Search the directory for the directory entry whose filename is FileNameString.
>-
>-Arguments:
>-
>-  OFile                 - The parent OFile whose directory is to be searched.
>-  FileNameString        - The filename to be searched.
>-  PtrDirEnt             - pointer to the directory entry if found.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Find the directory entry or not found.
>-  other                 - An error occurred when reading the directory entries.
>-
>---*/
> {
>   BOOLEAN     PossibleShortName;
>   CHAR8       File8Dot3Name[FAT_NAME_LEN];
>   FAT_ODIR    *ODir;
>   FAT_DIRENT  *DirEnt;
>@@ -645,60 +559,46 @@ Returns:
>
>   *PtrDirEnt = DirEnt;
>   return EFI_SUCCESS;
> }
>
>-VOID
>-FatResetODirCursor (
>-  IN FAT_OFILE    *OFile
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Set the OFile's current directory cursor to the list head.
>
>-Arguments:
>+  @param OFile                 - The directory OFile whose directory cursor is reset.
>
>-  OFile                 - The directory OFile whose directory cursor is reset.
>-
>-Returns:
>-
>-  None.
>-
>---*/
>+**/
>+VOID
>+FatResetODirCursor (
>+  IN FAT_OFILE    *OFile
>+  )
> {
>   FAT_ODIR  *ODir;
>
>   ODir = OFile->ODir;
>   ASSERT (ODir != NULL);
>   ODir->CurrentCursor = &(ODir->ChildList);
>   ODir->CurrentPos    = 0;
> }
>
>-EFI_STATUS
>-FatGetNextDirEnt (
>-  IN  FAT_OFILE     *OFile,
>-  OUT FAT_DIRENT    **PtrDirEnt
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Set the directory's cursor to the next and get the next directory entry.
>
>-Arguments:
>-
>-  OFile                 - The parent OFile.
>-  PtrDirEnt             - The next directory entry.
>-
>-Returns:
>+  @param  OFile                 - The parent OFile.
>+  @param PtrDirEnt             - The next directory entry.
>
>-  EFI_SUCCESS           - We get the next directory entry successfully.
>-  other                 - An error occurred when get next directory entry.
>+  @retval EFI_SUCCESS           - We get the next directory entry successfully.
>+  @return other                 - An error occurred when get next directory entry.
>
>---*/
>+**/
>+EFI_STATUS
>+FatGetNextDirEnt (
>+  IN  FAT_OFILE     *OFile,
>+  OUT FAT_DIRENT    **PtrDirEnt
>+  )
> {
>   EFI_STATUS  Status;
>   FAT_DIRENT  *DirEnt;
>   FAT_ODIR    *ODir;
>
>@@ -733,32 +633,24 @@ Returns:
>
>   *PtrDirEnt = DirEnt;
>   return EFI_SUCCESS;
> }
>
>+/**
>+
>+  Set the directory entry count according to the filename.
>+
>+  @param  OFile                 - The corresponding OFile.
>+  @param  DirEnt                - The directory entry to be set.
>+
>+**/
> STATIC
> VOID
> FatSetEntryCount (
>   IN FAT_OFILE    *OFile,
>   IN FAT_DIRENT   *DirEnt
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Set the directory entry count according to the filename.
>-
>-Arguments:
>-
>-  OFile                 - The corresponding OFile.
>-  DirEnt                - The directory entry to be set.
>-
>-Returns:
>-
>-  None.
>-
>---*/
> {
>   CHAR16  *FileString;
>   CHAR8   *File8Dot3Name;
>
>   //
>@@ -798,58 +690,46 @@ Returns:
>       DirEnt->EntryCount = (UINT8)(LFN_ENTRY_NUMBER (StrLen (FileString)) + DirEnt->EntryCount);
>     }
>   }
> }
>
>+/**
>+
>+  Append a zero cluster to the current OFile.
>+
>+  @param  OFile        - The directory OFile which needs to be updated.
>+
>+  @retval EFI_SUCCESS  - Append a zero cluster to the OFile successfully.
>+  @return other        - An error occurred when appending the zero cluster.
>+
>+**/
> STATIC
> EFI_STATUS
> FatExpandODir (
>   IN FAT_OFILE  *OFile
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Append a zero cluster to the current OFile.
>+{
>+  return FatExpandOFile (OFile, OFile->FileSize + OFile->Volume->ClusterSize);
>+}
>
>-Arguments:
>+/**
>
>-  OFile        - The directory OFile which needs to be updated.
>+  Search the Root OFile for the possible volume label.
>
>-Returns:
>+  @param  Root                  - The Root OFile.
>+  @param  DirEnt                - The returned directory entry of volume label.
>
>-  EFI_SUCCESS  - Append a zero cluster to the OFile successfully.
>-  other        - An error occurred when appending the zero cluster.
>-
>---*/
>-{
>-  return FatExpandOFile (OFile, OFile->FileSize + OFile->Volume->ClusterSize);
>-}
>+  @retval EFI_SUCCESS           - The search process is completed successfully.
>+  @return other                 - An error occurred when searching volume label.
>
>+**/
> STATIC
> EFI_STATUS
> FatSeekVolumeId (
>   IN  FAT_OFILE            *Root,
>   OUT FAT_DIRENT           *DirEnt
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Search the Root OFile for the possible volume label.
>-
>-Arguments:
>-
>-  Root                  - The Root OFile.
>-  DirEnt                - The returned directory entry of volume label.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - The search process is completed successfully.
>-  other                 - An error occurred when searching volume label.
>-
>---*/
> {
>   EFI_STATUS          Status;
>   UINTN               EntryPos;
>   FAT_DIRECTORY_ENTRY *Entry;
>
>@@ -872,37 +752,31 @@ Returns:
>     EntryPos++;
>   } while (Entry->FileName[0] != EMPTY_ENTRY_MARK);
>   return EFI_SUCCESS;
> }
>
>-STATIC
>-EFI_STATUS
>-FatFirstFitInsertDirEnt (
>-  IN FAT_OFILE    *OFile,
>-  IN FAT_DIRENT   *DirEnt
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Use First Fit Algorithm to insert directory entry.
>   Only this function will erase "E5" entries in a directory.
>   In view of safest recovery, this function will only be triggered
>   when maximum directory entry number has reached.
>
>-Arguments:
>-
>-  OFile                 - The corresponding OFile.
>-  DirEnt                - The directory entry to be inserted.
>+  @param  OFile                 - The corresponding OFile.
>+  @param  DirEnt                - The directory entry to be inserted.
>
>-Returns:
>+  @retval EFI_SUCCESS           - The directory entry has been successfully inserted.
>+  @retval EFI_VOLUME_FULL       - The directory can not hold more directory entries.
>+  @return Others                - Some error occurred when inserting new directory entries.
>
>-  EFI_SUCCESS           - The directory entry has been successfully inserted.
>-  EFI_VOLUME_FULL       - The directory can not hold more directory entries.
>-  Others                - Some error occurred when inserting new directory entries.
>-
>---*/
>+**/
>+STATIC
>+EFI_STATUS
>+FatFirstFitInsertDirEnt (
>+  IN FAT_OFILE    *OFile,
>+  IN FAT_DIRENT   *DirEnt
>+  )
> {
>   EFI_STATUS      Status;
>   FAT_ODIR        *ODir;
>   LIST_ENTRY      *CurrentEntry;
>   FAT_DIRENT      *CurrentDirEnt;
>@@ -954,34 +828,28 @@ Done:
>   DirEnt->EntryPos   = (UINT16) NewEntryPos;
>   DirEnt->Link.BackLink = CurrentEntry;
>   return EFI_SUCCESS;
> }
>
>+/**
>+
>+  Find the new directory entry position for the directory entry.
>+
>+  @param  OFile                 - The corresponding OFile.
>+  @param  DirEnt                - The directory entry whose new position is to be set.
>+
>+  @retval EFI_SUCCESS           - The new directory entry position is successfully found.
>+  @retval EFI_VOLUME_FULL       - The directory has reach its maximum capacity.
>+  @return other                 - An error occurred when reading the directory entry.
>+
>+**/
> STATIC
> EFI_STATUS
> FatNewEntryPos (
>   IN FAT_OFILE    *OFile,
>   IN FAT_DIRENT   *DirEnt
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Find the new directory entry position for the directory entry.
>-
>-Arguments:
>-
>-  OFile                 - The corresponding OFile.
>-  DirEnt                - The directory entry whose new position is to be set.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - The new directory entry position is successfully found.
>-  EFI_VOLUME_FULL       - The directory has reach its maximum capacity.
>-  other                 - An error occurred when reading the directory entry.
>-
>---*/
> {
>   EFI_STATUS  Status;
>   FAT_ODIR    *ODir;
>   FAT_DIRENT  *TempDirEnt;
>   UINT32      NewEndPos;
>@@ -1025,32 +893,26 @@ Returns:
>   ODir->CurrentEndPos = NewEndPos;
>   DirEnt->EntryPos = (UINT16) (ODir->CurrentEndPos - 1);
>   return EFI_SUCCESS;
> }
>
>-EFI_STATUS
>-FatGetVolumeEntry (
>-  IN FAT_VOLUME           *Volume,
>-  IN CHAR16               *Name
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Get the directory entry for the volume.
>
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>-  Name                  - The file name of the volume.
>-
>-Returns:
>+  @param  Volume                - FAT file system volume.
>+  @param  Name                  - The file name of the volume.
>
>-  EFI_SUCCESS           - Update the volume with the directory entry sucessfully.
>-  others                - An error occurred when getting volume label.
>+  @retval EFI_SUCCESS           - Update the volume with the directory entry sucessfully.
>+  @return others                - An error occurred when getting volume label.
>
>---*/
>+**/
>+EFI_STATUS
>+FatGetVolumeEntry (
>+  IN FAT_VOLUME           *Volume,
>+  IN CHAR16               *Name
>+  )
> {
>   EFI_STATUS  Status;
>   FAT_DIRENT  LabelDirEnt;
>
>   *Name   = 0;
>@@ -1062,33 +924,27 @@ Returns:
>   }
>
>   return Status;
> }
>
>-EFI_STATUS
>-FatSetVolumeEntry (
>-  IN FAT_VOLUME           *Volume,
>-  IN CHAR16               *Name
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Set the relevant directory entry into disk for the volume.
>
>-Arguments:
>-
>-  Volume              - FAT file system volume.
>-  Name                - The new file name of the volume.
>-
>-Returns:
>+  @param  Volume              - FAT file system volume.
>+  @param  Name                - The new file name of the volume.
>
>-  EFI_SUCCESS         - Update the Volume sucessfully.
>-  EFI_UNSUPPORTED     - The input label is not a valid volume label.
>-  other               - An error occurred when setting volume label.
>+  @retval EFI_SUCCESS         - Update the Volume sucessfully.
>+  @retval EFI_UNSUPPORTED     - The input label is not a valid volume label.
>+  @return other               - An error occurred when setting volume label.
>
>---*/
>+**/
>+EFI_STATUS
>+FatSetVolumeEntry (
>+  IN FAT_VOLUME           *Volume,
>+  IN CHAR16               *Name
>+  )
> {
>   EFI_STATUS  Status;
>   FAT_DIRENT  LabelDirEnt;
>   FAT_OFILE   *Root;
>
>@@ -1119,30 +975,24 @@ Returns:
>
>   FatGetCurrentFatTime (&LabelDirEnt.Entry.FileModificationTime);
>   return FatStoreDirEnt (Root, &LabelDirEnt);
> }
>
>-EFI_STATUS
>-FatCreateDotDirEnts (
>-  IN FAT_OFILE          *OFile
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Create "." and ".." directory entries in the newly-created parent OFile.
>
>-Arguments:
>-
>-  OFile                 - The parent OFile.
>+  @param  OFile                 - The parent OFile.
>
>-Returns:
>+  @retval EFI_SUCCESS           - The dot directory entries are successfully created.
>+  @return other                 - An error occurred when creating the directory entry.
>
>-  EFI_SUCCESS           - The dot directory entries are successfully created.
>-  other                 - An error occurred when creating the directory entry.
>-
>---*/
>+**/
>+EFI_STATUS
>+FatCreateDotDirEnts (
>+  IN FAT_OFILE          *OFile
>+  )
> {
>   EFI_STATUS  Status;
>   FAT_DIRENT  *DirEnt;
>
>   Status = FatExpandODir (OFile);
>@@ -1163,37 +1013,31 @@ Returns:
>   //
>   Status = FatCreateDirEnt (OFile, L"..", FAT_ATTRIBUTE_DIRECTORY, &DirEnt);
>   return Status;
> }
>
>+/**
>+
>+  Create a directory entry in the parent OFile.
>+
>+  @param  OFile                 - The parent OFile.
>+  @param  FileName              - The filename of the newly-created directory entry.
>+  @param  Attributes            - The attribute of the newly-created directory entry.
>+  @param  PtrDirEnt             - The pointer to the newly-created directory entry.
>+
>+  @retval EFI_SUCCESS           - The directory entry is successfully created.
>+  @retval EFI_OUT_OF_RESOURCES  - Not enough memory to create the directory entry.
>+  @return other                 - An error occurred when creating the directory entry.
>+
>+**/
> EFI_STATUS
> FatCreateDirEnt (
>   IN  FAT_OFILE         *OFile,
>   IN  CHAR16            *FileName,
>   IN  UINT8             Attributes,
>   OUT FAT_DIRENT        **PtrDirEnt
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Create a directory entry in the parent OFile.
>-
>-Arguments:
>-
>-  OFile                 - The parent OFile.
>-  FileName              - The filename of the newly-created directory entry.
>-  Attributes            - The attribute of the newly-created directory entry.
>-  PtrDirEnt             - The pointer to the newly-created directory entry.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - The directory entry is successfully created.
>-  EFI_OUT_OF_RESOURCES  - Not enough memory to create the directory entry.
>-  other                 - An error occurred when creating the directory entry.
>-
>---*/
> {
>   FAT_DIRENT  *DirEnt;
>   FAT_ODIR    *ODir;
>   EFI_STATUS  Status;
>
>@@ -1232,32 +1076,26 @@ Returns:
> Done:
>   FatFreeDirEnt (DirEnt);
>   return Status;
> }
>
>-EFI_STATUS
>-FatRemoveDirEnt (
>-  IN FAT_OFILE    *OFile,
>-  IN FAT_DIRENT   *DirEnt
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Remove this directory entry node from the list of directory entries and hash table.
>
>-Arguments:
>-
>-  OFile                - The parent OFile.
>-  DirEnt               - The directory entry to be removed.
>+  @param  OFile                - The parent OFile.
>+  @param  DirEnt               - The directory entry to be removed.
>
>-Returns:
>+  @retval EFI_SUCCESS          - The directory entry is successfully removed.
>+  @return other                - An error occurred when removing the directory entry.
>
>-  EFI_SUCCESS          - The directory entry is successfully removed.
>-  other                - An error occurred when removing the directory entry.
>-
>---*/
>+**/
>+EFI_STATUS
>+FatRemoveDirEnt (
>+  IN FAT_OFILE    *OFile,
>+  IN FAT_DIRENT   *DirEnt
>+  )
> {
>   FAT_ODIR  *ODir;
>
>   ODir = OFile->ODir;
>   if (ODir->CurrentCursor == &DirEnt->Link) {
>@@ -1277,33 +1115,27 @@ Returns:
>   DirEnt->Entry.FileName[0] = DELETE_ENTRY_MARK;
>   DirEnt->Invalid           = TRUE;
>   return FatStoreDirEnt (OFile, DirEnt);
> }
>
>-EFI_STATUS
>-FatOpenDirEnt (
>-  IN FAT_OFILE         *Parent,
>-  IN FAT_DIRENT        *DirEnt
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Open the directory entry to get the OFile.
>
>-Arguments:
>+  @param  Parent                - The parent OFile.
>+  @param  DirEnt                - The directory entry to be opened.
>
>-  OFile                 - The parent OFile.
>-  DirEnt                - The directory entry to be opened.
>+  @retval EFI_SUCCESS           - The directory entry is successfully opened.
>+  @retval EFI_OUT_OF_RESOURCES  - not enough memory to allocate a new OFile.
>+  @return other                 - An error occurred when opening the directory entry.
>
>-Returns:
>-
>-  EFI_SUCCESS           - The directory entry is successfully opened.
>-  EFI_OUT_OF_RESOURCES  - not enough memory to allocate a new OFile.
>-  other                 - An error occurred when opening the directory entry.
>-
>---*/
>+**/
>+EFI_STATUS
>+FatOpenDirEnt (
>+  IN FAT_OFILE         *Parent,
>+  IN FAT_DIRENT        *DirEnt
>+  )
> {
>   FAT_OFILE   *OFile;
>   FAT_VOLUME  *Volume;
>
>   if (DirEnt->OFile == NULL) {
>@@ -1362,30 +1194,21 @@ Returns:
>   }
>
>   return EFI_SUCCESS;
> }
>
>-VOID
>-FatCloseDirEnt (
>-  IN FAT_DIRENT        *DirEnt
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Close the directory entry and free the OFile.
>
>-Arguments:
>-
>-  DirEnt               - The directory entry to be closed.
>-
>-Returns:
>-
>-  EFI_SUCCESS          - The directory entry is successfully opened.
>-  Other                - An error occurred when opening the directory entry.
>+  @param  DirEnt               - The directory entry to be closed.
>
>---*/
>+**/
>+VOID
>+FatCloseDirEnt (
>+  IN FAT_DIRENT        *DirEnt
>+  )
> {
>   FAT_OFILE   *OFile;
>   FAT_VOLUME  *Volume;
>
>   OFile   = DirEnt->OFile;
>@@ -1410,42 +1233,37 @@ Returns:
>     //
>     FatFreeDirEnt (DirEnt);
>   }
> }
>
>-EFI_STATUS
>-FatLocateOFile (
>-  IN OUT FAT_OFILE        **PtrOFile,
>-  IN     CHAR16           *FileName,
>-  IN     UINT8            Attributes,
>-     OUT CHAR16           *NewFileName
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Traverse filename and open all OFiles that can be opened.
>   Update filename pointer to the component that can't be opened.
>   If more than one name component remains, returns an error;
>   otherwise, return the remaining name component so that the caller might choose to create it.
>
>-Arguments:
>-  PtrOFile              - As input, the reference OFile; as output, the located OFile.
>-  FileName              - The file name relevant to the OFile.
>-  Attributes            - The attribute of the destination OFile.
>-  NewFileName           - The remaining file name.
>-
>-Returns:
>+  @param  PtrOFile              - As input, the reference OFile; as output, the located OFile.
>+  @param  FileName              - The file name relevant to the OFile.
>+  @param  Attributes            - The attribute of the destination OFile.
>+  @param  NewFileName           - The remaining file name.
>
>-  EFI_NOT_FOUND         - The file name can't be opened and there is more than one
>+  @retval EFI_NOT_FOUND         - The file name can't be opened and there is more than one
>                           components within the name left (this means the name can
>                           not be created either).
>-  EFI_INVALID_PARAMETER - The parameter is not valid.
>-  EFI_SUCCESS           - Open the file successfully.
>-  other                 - An error occured when locating the OFile.
>+  @retval EFI_INVALID_PARAMETER - The parameter is not valid.
>+  @retval EFI_SUCCESS           - Open the file successfully.
>+  @return other                 - An error occured when locating the OFile.
>
>---*/
>+**/
>+EFI_STATUS
>+FatLocateOFile (
>+  IN OUT FAT_OFILE        **PtrOFile,
>+  IN     CHAR16           *FileName,
>+  IN     UINT8            Attributes,
>+     OUT CHAR16           *NewFileName
>+  )
> {
>   EFI_STATUS  Status;
>   FAT_VOLUME  *Volume;
>   CHAR16      ComponentName[EFI_PATH_STRING_LENGTH];
>   UINTN       FileNameLen;
>diff --git a/FatPkg/EnhancedFatDxe/DiskCache.c b/FatPkg/EnhancedFatDxe/DiskCache.c
>index 7f1fcf4..63f9c00 100644
>--- a/FatPkg/EnhancedFatDxe/DiskCache.c
>+++ b/FatPkg/EnhancedFatDxe/DiskCache.c
>@@ -1,67 +1,49 @@
>-/*++
>+/** @file
>+  Cache implementation for EFI FAT File system driver.
>
> Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
> http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>+**/
>
>-Module Name:
>-
>-  DiskCache.c
>+#include "Fat.h"
>
>-Abstract:
>+/**
>
>-  Cache implementation for EFI FAT File system driver
>+  This function is used by the Data Cache.
>
>-Revision History
>+  When this function is called by write command, all entries in this range
>+  are older than the contents in disk, so they are invalid; just mark them invalid.
>
>---*/
>+  When this function is called by read command, if any entry in this range
>+  is dirty, it means that the relative info directly readed from media is older than
>+  than the info in the cache; So need to update the relative info in the Buffer.
>
>-#include "Fat.h"
>+  @param  Volume                - FAT file system volume.
>+  @param  IoMode                - This function is called by read command or write command
>+  @param  StartPageNo           - First PageNo to be checked in the cache.
>+  @param  EndPageNo             - Last PageNo to be checked in the cache.
>+  @param  Buffer                - The user buffer need to update. Only when doing the read command
>+                          and there is dirty cache in the cache range, this parameter will be used.
>
>+**/
> STATIC
> VOID
> FatFlushDataCacheRange (
>   IN  FAT_VOLUME         *Volume,
>   IN  IO_MODE            IoMode,
>   IN  UINTN              StartPageNo,
>   IN  UINTN              EndPageNo,
>   OUT UINT8              *Buffer
>   )
>-/*++
>-
>-Routine Description:
>-
>-  This function is used by the Data Cache.
>-
>-  When this function is called by write command, all entries in this range
>-  are older than the contents in disk, so they are invalid; just mark them invalid.
>-
>-  When this function is called by read command, if any entry in this range
>-  is dirty, it means that the relative info directly readed from media is older than
>-  than the info in the cache; So need to update the relative info in the Buffer.
>-
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>-  IoMode                - This function is called by read command or write command
>-  StartPageNo           - First PageNo to be checked in the cache.
>-  EndPageNo             - Last PageNo to be checked in the cache.
>-  Buffer                - The user buffer need to update. Only when doing the read command
>-                          and there is dirty cache in the cache range, this parameter will be used.
>-
>-Returns:
>-
>-  None.
>-
>---*/
> {
>   UINTN       PageNo;
>   UINTN       GroupNo;
>   UINTN       GroupMask;
>   UINTN       PageSize;
>@@ -101,38 +83,33 @@ Returns:
>       }
>     }
>   }
> }
>
>+/**
>+
>+  Exchange the cache page with the image on the disk
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  DataType              - Indicate the cache type.
>+  @param  IoMode                - Indicate whether to load this page from disk or store this page to disk.
>+  @param  CacheTag              - The Cache Tag for the current cache page.
>+  @param  Task                    point to task instance.
>+
>+  @retval EFI_SUCCESS           - Cache page exchanged successfully.
>+  @return Others                - An error occurred when exchanging cache page.
>+
>+**/
> STATIC
> EFI_STATUS
> FatExchangeCachePage (
>   IN FAT_VOLUME         *Volume,
>   IN CACHE_DATA_TYPE    DataType,
>   IN IO_MODE            IoMode,
>   IN CACHE_TAG          *CacheTag,
>   IN FAT_TASK           *Task
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Exchange the cache page with the image on the disk
>-
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>-  DataType              - Indicate the cache type.
>-  IoMode                - Indicate whether to load this page from disk or store this page to disk.
>-  CacheTag              - The Cache Tag for the current cache page.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Cache page exchanged successfully.
>-  Others                - An error occurred when exchanging cache page.
>-
>---*/
> {
>   EFI_STATUS  Status;
>   UINTN       GroupNo;
>   UINTN       PageNo;
>   UINTN       WriteCount;
>@@ -179,37 +156,31 @@ Returns:
>   CacheTag->Dirty     = FALSE;
>   CacheTag->RealSize  = RealSize;
>   return EFI_SUCCESS;
> }
>
>+/**
>+
>+  Get one cache page by specified PageNo.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  CacheDataType         - The cache type: CACHE_FAT or CACHE_DATA.
>+  @param  PageNo                - PageNo to match with the cache.
>+  @param  CacheTag              - The Cache Tag for the current cache page.
>+
>+  @retval EFI_SUCCESS           - Get the cache page successfully.
>+  @return other                 - An error occurred when accessing data.
>+
>+**/
> STATIC
> EFI_STATUS
> FatGetCachePage (
>   IN FAT_VOLUME         *Volume,
>   IN CACHE_DATA_TYPE    CacheDataType,
>   IN UINTN              PageNo,
>   IN CACHE_TAG          *CacheTag
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get one cache page by specified PageNo.
>-
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>-  CacheDataType         - The cache type: CACHE_FAT or CACHE_DATA.
>-  PageNo                - PageNo to match with the cache.
>-  CacheTag              - The Cache Tag for the current cache page.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Get the cache page successfully.
>-  other                 - An error occurred when accessing data.
>-
>---*/
> {
>   EFI_STATUS  Status;
>   UINTN       OldPageNo;
>
>   OldPageNo = CacheTag->PageNo;
>@@ -236,10 +207,27 @@ Returns:
>   Status            = FatExchangeCachePage (Volume, CacheDataType, ReadDisk, CacheTag, NULL);
>
>   return Status;
> }
>
>+/**
>+
>+  Read Length bytes from the position of Offset into Buffer, or
>+  write Length bytes from Buffer into the position of Offset.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  CacheDataType         - The type of cache: CACHE_DATA or CACHE_FAT.
>+  @param  IoMode                - Indicate the type of disk access.
>+  @param  PageNo                - The number of unaligned cache page.
>+  @param  Offset                - The starting byte of cache page.
>+  @param  Length                - The number of bytes that is read or written
>+  @param  Buffer                - Buffer containing cache data.
>+
>+  @retval EFI_SUCCESS           - The data was accessed correctly.
>+  @return Others                - An error occurred when accessing unaligned cache page.
>+
>+**/
> STATIC
> EFI_STATUS
> FatAccessUnalignedCachePage (
>   IN     FAT_VOLUME        *Volume,
>   IN     CACHE_DATA_TYPE   CacheDataType,
>@@ -247,32 +235,10 @@ FatAccessUnalignedCachePage (
>   IN     UINTN             PageNo,
>   IN     UINTN             Offset,
>   IN     UINTN             Length,
>   IN OUT VOID              *Buffer
>   )
>-/*++
>-Routine Description:
>-
>-  Read Length bytes from the position of Offset into Buffer, or
>-  write Length bytes from Buffer into the position of Offset.
>-
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>-  CacheDataType         - The type of cache: CACHE_DATA or CACHE_FAT.
>-  IoMode                - Indicate the type of disk access.
>-  PageNo                - The number of unaligned cache page.
>-  Offset                - The starting byte of cache page.
>-  Length                - The number of bytes that is read or written
>-  Buffer                - Buffer containing cache data.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - The data was accessed correctly.
>-  Others                - An error occurred when accessing unaligned cache page.
>-
>---*/
> {
>   EFI_STATUS  Status;
>   VOID        *Source;
>   VOID        *Destination;
>   DISK_CACHE  *DiskCache;
>@@ -297,22 +263,11 @@ Returns:
>   }
>
>   return Status;
> }
>
>-EFI_STATUS
>-FatAccessCache (
>-  IN     FAT_VOLUME         *Volume,
>-  IN     CACHE_DATA_TYPE    CacheDataType,
>-  IN     IO_MODE            IoMode,
>-  IN     UINT64             Offset,
>-  IN     UINTN              BufferSize,
>-  IN OUT UINT8              *Buffer,
>-  IN     FAT_TASK           *Task
>-  )
>-/*++
>-Routine Description:
>+/**
>
>   Read BufferSize bytes from the position of Offset into Buffer,
>   or write BufferSize bytes from Buffer into the position of Offset.
>
>   Base on the parameter of CACHE_DATA_TYPE, the data access will be divided into
>@@ -324,26 +279,33 @@ Routine Description:
>   2. Access of Data cache (CACHE_DATA):
>      The access data will be divided into UnderRun data, Aligned data and OverRun data;
>      The UnderRun data and OverRun data will be accessed by the Data cache,
>      but the Aligned data will be accessed with disk directly.
>
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>-  CacheDataType         - The type of cache: CACHE_DATA or CACHE_FAT.
>-  IoMode                - Indicate the type of disk access.
>-  Offset                - The starting byte offset to read from.
>-  BufferSize            - Size of Buffer.
>-  Buffer                - Buffer containing cache data.
>+  @param  Volume                - FAT file system volume.
>+  @param  CacheDataType         - The type of cache: CACHE_DATA or CACHE_FAT.
>+  @param  IoMode                - Indicate the type of disk access.
>+  @param  Offset                - The starting byte offset to read from.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing cache data.
>+  @param  Task                    point to task instance.
>
>-Returns:
>+  @retval EFI_SUCCESS           - The data was accessed correctly.
>+  @retval EFI_MEDIA_CHANGED     - The MediaId does not match the current device.
>+  @return Others                - An error occurred when accessing cache.
>
>-  EFI_SUCCESS           - The data was accessed correctly.
>-  EFI_MEDIA_CHANGED     - The MediaId does not match the current device.
>-  Others                - An error occurred when accessing cache.
>-
>---*/
>+**/
>+EFI_STATUS
>+FatAccessCache (
>+  IN     FAT_VOLUME         *Volume,
>+  IN     CACHE_DATA_TYPE    CacheDataType,
>+  IN     IO_MODE            IoMode,
>+  IN     UINT64             Offset,
>+  IN     UINTN              BufferSize,
>+  IN OUT UINT8              *Buffer,
>+  IN     FAT_TASK           *Task
>+  )
> {
>   EFI_STATUS  Status;
>   UINTN       PageSize;
>   UINTN       UnderRun;
>   UINTN       OverRun;
>@@ -419,31 +381,26 @@ Returns:
>   }
>
>   return Status;
> }
>
>-EFI_STATUS
>-FatVolumeFlushCache (
>-  IN FAT_VOLUME         *Volume,
>-  IN FAT_TASK           *Task
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Flush all the dirty cache back, include the FAT cache and the Data cache.
>
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>+  @param  Volume                - FAT file system volume.
>+  @param  Task                    point to task instance.
>
>-Returns:
>+  @retval EFI_SUCCESS           - Flush all the dirty cache back successfully
>+  @return other                 - An error occurred when writing the data into the disk
>
>-  EFI_SUCCESS           - Flush all the dirty cache back successfully
>-  other                 - An error occurred when writing the data into the disk
>-
>---*/
>+**/
>+EFI_STATUS
>+FatVolumeFlushCache (
>+  IN FAT_VOLUME         *Volume,
>+  IN FAT_TASK           *Task
>+  )
> {
>   EFI_STATUS      Status;
>   CACHE_DATA_TYPE CacheDataType;
>   UINTN           GroupIndex;
>   UINTN           GroupMask;
>@@ -478,30 +435,24 @@ Returns:
>   //
>   Status = Volume->BlockIo->FlushBlocks (Volume->BlockIo);
>   return Status;
> }
>
>-EFI_STATUS
>-FatInitializeDiskCache (
>-  IN FAT_VOLUME         *Volume
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Initialize the disk cache according to Volume's FatType.
>
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>+  @param  Volume                - FAT file system volume.
>
>-Returns:
>+  @retval EFI_SUCCESS           - The disk cache is successfully initialized.
>+  @retval EFI_OUT_OF_RESOURCES  - Not enough memory to allocate disk cache.
>
>-  EFI_SUCCESS           - The disk cache is successfully initialized.
>-  EFI_OUT_OF_RESOURCES  - Not enough memory to allocate disk cache.
>-
>---*/
>+**/
>+EFI_STATUS
>+FatInitializeDiskCache (
>+  IN FAT_VOLUME         *Volume
>+  )
> {
>   DISK_CACHE  *DiskCache;
>   UINTN       FatCacheGroupCount;
>   UINTN       DataCacheSize;
>   UINTN       FatCacheSize;
>diff --git a/FatPkg/EnhancedFatDxe/Fat.c b/FatPkg/EnhancedFatDxe/Fat.c
>index 2080005..2e6c089 100644
>--- a/FatPkg/EnhancedFatDxe/Fat.c
>+++ b/FatPkg/EnhancedFatDxe/Fat.c
>@@ -1,26 +1,18 @@
>-/*++
>+/** @file
>+  Fat File System driver routines that support EFI driver model.
>
> Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
> http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>-
>-Module Name:
>-
>-  Fat.c
>-
>-Abstract:
>-
>-  Fat File System driver routines that support EFI driver model
>-
>---*/
>+**/
>
> #include "Fat.h"
>
> EFI_STATUS
> EFIAPI
>@@ -70,33 +62,27 @@ EFI_DRIVER_BINDING_PROTOCOL gFatDriverBinding = {
>   0xa,
>   NULL,
>   NULL
> };
>
>+/**
>+
>+  Register Driver Binding protocol for this driver.
>+
>+  @param  ImageHandle           - Handle for the image of this driver.
>+  @param  SystemTable           - Pointer to the EFI System Table.
>+
>+  @retval EFI_SUCCESS           - Driver loaded.
>+  @return other                 - Driver not loaded.
>+
>+**/
> EFI_STATUS
> EFIAPI
> FatEntryPoint (
>   IN EFI_HANDLE         ImageHandle,
>   IN EFI_SYSTEM_TABLE   *SystemTable
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Register Driver Binding protocol for this driver.
>-
>-Arguments:
>-
>-  ImageHandle           - Handle for the image of this driver.
>-  SystemTable           - Pointer to the EFI System Table.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Driver loaded.
>-  other                 - Driver not loaded.
>-
>---*/
> {
>   EFI_STATUS                Status;
>
>   //
>   // Initialize the EFI Driver Library
>@@ -112,31 +98,25 @@ Returns:
>   ASSERT_EFI_ERROR (Status);
>
>   return Status;
> }
>
>-EFI_STATUS
>-EFIAPI
>-FatUnload (
>-  IN EFI_HANDLE  ImageHandle
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Unload function for this image. Uninstall DriverBinding protocol.
>
>-Arguments:
>+  @param ImageHandle           - Handle for the image of this driver.
>
>-  ImageHandle           - Handle for the image of this driver.
>+  @retval EFI_SUCCESS           - Driver unloaded successfully.
>+  @return other                 - Driver can not unloaded.
>
>-Returns:
>-
>-  EFI_SUCCESS           - Driver unloaded successfully.
>-  other                 - Driver can not unloaded.
>-
>---*/
>+**/
>+EFI_STATUS
>+EFIAPI
>+FatUnload (
>+  IN EFI_HANDLE  ImageHandle
>+  )
> {
>   EFI_STATUS  Status;
>   EFI_HANDLE  *DeviceHandleBuffer;
>   UINTN       DeviceHandleCount;
>   UINTN       Index;
>@@ -222,37 +202,31 @@ Returns:
>   }
>
>   return Status;
> }
>
>+/**
>+
>+  Test to see if this driver can add a file system to ControllerHandle.
>+  ControllerHandle must support both Disk IO and Block IO protocols.
>+
>+  @param  This                  - Protocol instance pointer.
>+  @param  ControllerHandle      - Handle of device to test.
>+  @param  RemainingDevicePath   - Not used.
>+
>+  @retval EFI_SUCCESS           - This driver supports this device.
>+  @retval EFI_ALREADY_STARTED   - This driver is already running on this device.
>+  @return other                 - This driver does not support this device.
>+
>+**/
> EFI_STATUS
> EFIAPI
> FatDriverBindingSupported (
>   IN EFI_DRIVER_BINDING_PROTOCOL  *This,
>   IN EFI_HANDLE                   ControllerHandle,
>   IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Test to see if this driver can add a file system to ControllerHandle.
>-  ControllerHandle must support both Disk IO and Block IO protocols.
>-
>-Arguments:
>-
>-  This                  - Protocol instance pointer.
>-  ControllerHandle      - Handle of device to test.
>-  RemainingDevicePath   - Not used.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - This driver supports this device.
>-  EFI_ALREADY_STARTED   - This driver is already running on this device.
>-  other                 - This driver does not support this device.
>-
>---*/
> {
>   EFI_STATUS            Status;
>   EFI_DISK_IO_PROTOCOL  *DiskIo;
>
>   //
>@@ -293,39 +267,33 @@ Returns:
>                   );
>
>   return Status;
> }
>
>-EFI_STATUS
>-EFIAPI
>-FatDriverBindingStart (
>-  IN EFI_DRIVER_BINDING_PROTOCOL  *This,
>-  IN EFI_HANDLE                   ControllerHandle,
>-  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Start this driver on ControllerHandle by opening a Block IO and Disk IO
>   protocol, reading Device Path. Add a Simple File System protocol to
>   ControllerHandle if the media contains a valid file system.
>
>-Arguments:
>-
>-  This                  - Protocol instance pointer.
>-  ControllerHandle      - Handle of device to bind driver to.
>-  RemainingDevicePath   - Not used.
>+  @param  This                  - Protocol instance pointer.
>+  @param  ControllerHandle      - Handle of device to bind driver to.
>+  @param  RemainingDevicePath   - Not used.
>
>-Returns:
>+  @retval EFI_SUCCESS           - This driver is added to DeviceHandle.
>+  @retval EFI_ALREADY_STARTED   - This driver is already running on DeviceHandle.
>+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
>+  @return other                 - This driver does not support this device.
>
>-  EFI_SUCCESS           - This driver is added to DeviceHandle.
>-  EFI_ALREADY_STARTED   - This driver is already running on DeviceHandle.
>-  EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
>-  other                 - This driver does not support this device.
>-
>---*/
>+**/
>+EFI_STATUS
>+EFIAPI
>+FatDriverBindingStart (
>+  IN EFI_DRIVER_BINDING_PROTOCOL  *This,
>+  IN EFI_HANDLE                   ControllerHandle,
>+  IN EFI_DEVICE_PATH_PROTOCOL     *RemainingDevicePath
>+  )
> {
>   EFI_STATUS            Status;
>   EFI_BLOCK_IO_PROTOCOL *BlockIo;
>   EFI_DISK_IO_PROTOCOL  *DiskIo;
>   EFI_DISK_IO2_PROTOCOL *DiskIo2;
>@@ -428,34 +396,31 @@ Exit:
>     FatReleaseLock ();
>   }
>   return Status;
> }
>
>+/**
>+
>+  Stop this driver on ControllerHandle.
>+
>+  @param  This                  - Protocol instance pointer.
>+  @param  ControllerHandle      - Handle of device to stop driver on.
>+  @param  NumberOfChildren      - Not used.
>+  @param  ChildHandleBuffer     - Not used.
>+
>+  @retval EFI_SUCCESS           - This driver is removed DeviceHandle.
>+  @return other                 - This driver was not removed from this device.
>+
>+**/
> EFI_STATUS
> EFIAPI
> FatDriverBindingStop (
>   IN  EFI_DRIVER_BINDING_PROTOCOL   *This,
>   IN  EFI_HANDLE                    ControllerHandle,
>   IN  UINTN                         NumberOfChildren,
>   IN  EFI_HANDLE                    *ChildHandleBuffer
>   )
>-/*++
>-
>-Routine Description:
>-  Stop this driver on ControllerHandle.
>-
>-Arguments:
>-  This                  - Protocol instance pointer.
>-  ControllerHandle      - Handle of device to stop driver on.
>-  NumberOfChildren      - Not used.
>-  ChildHandleBuffer     - Not used.
>-
>-Returns:
>-  EFI_SUCCESS           - This driver is removed DeviceHandle.
>-  other                 - This driver was not removed from this device.
>-
>---*/
> {
>   EFI_STATUS                      Status;
>   EFI_SIMPLE_FILE_SYSTEM_PROTOCOL *FileSystem;
>   FAT_VOLUME                      *Volume;
>   EFI_DISK_IO2_PROTOCOL           *DiskIo2;
>diff --git a/FatPkg/EnhancedFatDxe/Fat.h b/FatPkg/EnhancedFatDxe/Fat.h
>index f49acee..9490868 100644
>--- a/FatPkg/EnhancedFatDxe/Fat.h
>+++ b/FatPkg/EnhancedFatDxe/Fat.h
>@@ -1,28 +1,18 @@
>-/*++
>+/** @file
>+  Main header file for EFI FAT file system driver.
>
> Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
> http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>-
>-Module Name:
>-
>-  Fat.h
>-
>-Abstract:
>-
>-  Main header file for EFI FAT file system driver
>-
>-Revision History
>-
>---*/
>+**/
>
> #ifndef _FAT_H_
> #define _FAT_H_
>
> #include <Uefi.h>
>@@ -394,401 +384,321 @@ struct _FAT_VOLUME {
> };
>
> //
> // Function Prototypes
> //
>+
>+/**
>+
>+  Implements Open() of Simple File System Protocol.
>+
>+  @param  FHand                 - File handle of the file serves as a starting reference point.
>+  @param  NewHandle             - Handle of the file that is newly opened.
>+  @param  FileName              - File name relative to FHand.
>+  @param  OpenMode              - Open mode.
>+  @param  Attributes            - Attributes to set if the file is created.
>+
>+
>+  @retval EFI_INVALID_PARAMETER - The FileName is NULL or the file string is empty.
>+                          The OpenMode is not supported.
>+                          The Attributes is not the valid attributes.
>+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory for file string.
>+  @retval EFI_SUCCESS           - Open the file successfully.
>+  @return Others                - The status of open file.
>+
>+**/
> EFI_STATUS
> EFIAPI
> FatOpen (
>   IN  EFI_FILE_PROTOCOL *FHand,
>   OUT EFI_FILE_PROTOCOL **NewHandle,
>   IN  CHAR16            *FileName,
>   IN  UINT64            OpenMode,
>   IN  UINT64            Attributes
>   )
>-/*++
>-Routine Description:
>-
>-  Implements Open() of Simple File System Protocol.
>+;
>
>-Arguments:
>+/**
>
>-  FHand                 - File handle of the file serves as a starting reference point.
>-  NewHandle             - Handle of the file that is newly opened.
>-  FileName              - File name relative to FHand.
>-  OpenMode              - Open mode.
>-  Attributes            - Attributes to set if the file is created.
>+  Implements OpenEx() of Simple File System Protocol.
>
>-Returns:
>+  @param  FHand                 - File handle of the file serves as a starting reference point.
>+  @param  NewHandle             - Handle of the file that is newly opened.
>+  @param  FileName              - File name relative to FHand.
>+  @param  OpenMode              - Open mode.
>+  @param  Attributes            - Attributes to set if the file is created.
>+  @param  Token                 - A pointer to the token associated with the transaction.
>
>-  EFI_INVALID_PARAMETER - The FileName is NULL or the file string is empty.
>+  @retval EFI_INVALID_PARAMETER - The FileName is NULL or the file string is empty.
>                           The OpenMode is not supported.
>                           The Attributes is not the valid attributes.
>-  EFI_OUT_OF_RESOURCES  - Can not allocate the memory for file string.
>-  EFI_SUCCESS           - Open the file successfully.
>-  Others                - The status of open file.
>-
>---*/
>-;
>+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory for file string.
>+  @retval EFI_SUCCESS           - Open the file successfully.
>+  @return Others                - The status of open file.
>
>+**/
> EFI_STATUS
> EFIAPI
> FatOpenEx (
>   IN  EFI_FILE_PROTOCOL       *FHand,
>   OUT EFI_FILE_PROTOCOL       **NewHandle,
>   IN  CHAR16                  *FileName,
>   IN  UINT64                  OpenMode,
>   IN  UINT64                  Attributes,
>   IN OUT EFI_FILE_IO_TOKEN    *Token
>   )
>-/*++
>-Routine Description:
>-
>-  Implements OpenEx() of Simple File System Protocol.
>-
>-Arguments:
>+;
>
>-  FHand                 - File handle of the file serves as a starting reference point.
>-  NewHandle             - Handle of the file that is newly opened.
>-  FileName              - File name relative to FHand.
>-  OpenMode              - Open mode.
>-  Attributes            - Attributes to set if the file is created.
>-  Token                 - A pointer to the token associated with the transaction.
>+/**
>
>-Returns:
>+  Get the file's position of the file
>
>-  EFI_INVALID_PARAMETER - The FileName is NULL or the file string is empty.
>-                          The OpenMode is not supported.
>-                          The Attributes is not the valid attributes.
>-  EFI_OUT_OF_RESOURCES  - Can not allocate the memory for file string.
>-  EFI_SUCCESS           - Open the file successfully.
>-  Others                - The status of open file.
>+  @param  FHand                 - The handle of file.
>+  @param  Position              - The file's position of the file.
>
>---*/
>-;
>+  @retval EFI_SUCCESS           - Get the info successfully.
>+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>+  @retval EFI_UNSUPPORTED       - The open file is not a file.
>
>+**/
> EFI_STATUS
> EFIAPI
> FatGetPosition (
>   IN  EFI_FILE_PROTOCOL *FHand,
>   OUT UINT64            *Position
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get the file's position of the file
>-
>-Arguments:
>+;
>
>-  FHand                 - The handle of file.
>-  Position              - The file's position of the file.
>+/**
>
>-Returns:
>+  Get the some types info of the file into Buffer
>
>-  EFI_SUCCESS           - Get the info successfully.
>-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>-  EFI_UNSUPPORTED       - The open file is not a file.
>+  @param  FHand                 - The handle of file.
>+  @param  Type                  - The type of the info.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing volume info.
>
>---*/
>-;
>+  @retval EFI_SUCCESS           - Get the info successfully.
>+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>
>+**/
> EFI_STATUS
> EFIAPI
> FatGetInfo (
>   IN     EFI_FILE_PROTOCOL      *FHand,
>   IN     EFI_GUID               *Type,
>   IN OUT UINTN                  *BufferSize,
>      OUT VOID                   *Buffer
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get the some types info of the file into Buffer
>-
>-Arguments:
>+;
>
>-  FHand                 - The handle of file.
>-  Type                  - The type of the info.
>-  BufferSize            - Size of Buffer.
>-  Buffer                - Buffer containing volume info.
>+/**
>
>-Returns:
>+  Set the some types info of the file into Buffer.
>
>-  EFI_SUCCESS           - Get the info successfully.
>-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>+  @param  FHand                 - The handle of file.
>+  @param  Type                  - The type of the info.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing volume info.
>
>---*/
>-;
>+  @retval EFI_SUCCESS           - Set the info successfully.
>+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>
>+**/
> EFI_STATUS
> EFIAPI
> FatSetInfo (
>   IN EFI_FILE_PROTOCOL  *FHand,
>   IN EFI_GUID           *Type,
>   IN UINTN              BufferSize,
>   IN VOID               *Buffer
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Set the some types info of the file into Buffer
>-
>-Arguments:
>+;
>
>-  FHand                 - The handle of file.
>-  Type                  - The type of the info.
>-  BufferSize            - Size of Buffer.
>-  Buffer                - Buffer containing volume info.
>+/**
>
>-Returns:
>+  Flushes all data associated with the file handle.
>
>-  EFI_SUCCESS           - Set the info successfully.
>-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>+  @param  FHand                 - Handle to file to flush
>
>---*/
>-;
>+  @retval EFI_SUCCESS           - Flushed the file successfully
>+  @retval EFI_WRITE_PROTECTED   - The volume is read only
>+  @retval EFI_ACCESS_DENIED     - The volume is not read only
>+                          but the file is read only
>+  @return Others                - Flushing of the file is failed
>
>+**/
> EFI_STATUS
> EFIAPI
> FatFlush (
>   IN EFI_FILE_PROTOCOL  *FHand
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Flushes all data associated with the file handle
>-
>-Arguments:
>+;
>
>-  FHand                 - Handle to file to flush
>+/**
>
>-Returns:
>+  Flushes all data associated with the file handle.
>
>-  EFI_SUCCESS           - Flushed the file successfully
>-  EFI_WRITE_PROTECTED   - The volume is read only
>-  EFI_ACCESS_DENIED     - The volume is not read only
>-                          but the file is read only
>-  Others                - Flushing of the file is failed
>+  @param  FHand                 - Handle to file to flush.
>+  @param  Token                 - A pointer to the token associated with the transaction.
>
>---*/
>-;
>+  @retval EFI_SUCCESS           - Flushed the file successfully.
>+  @retval EFI_WRITE_PROTECTED   - The volume is read only.
>+  @retval EFI_ACCESS_DENIED     - The file is read only.
>+  @return Others                - Flushing of the file failed.
>
>+**/
> EFI_STATUS
> EFIAPI
> FatFlushEx (
>   IN EFI_FILE_PROTOCOL  *FHand,
>   IN EFI_FILE_IO_TOKEN  *Token
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Flushes all data associated with the file handle.
>-
>-Arguments:
>+;
>
>-  FHand                 - Handle to file to flush.
>-  Token                 - A pointer to the token associated with the transaction.
>+/**
>
>-Returns:
>+  Flushes & Closes the file handle.
>
>-  EFI_SUCCESS           - Flushed the file successfully.
>-  EFI_WRITE_PROTECTED   - The volume is read only.
>-  EFI_ACCESS_DENIED     - The file is read only.
>-  Others                - Flushing of the file failed.
>+  @param  FHand                 - Handle to the file to delete.
>
>---*/
>-;
>+  @retval EFI_SUCCESS           - Closed the file successfully.
>
>+**/
> EFI_STATUS
> EFIAPI
> FatClose (
>   IN EFI_FILE_PROTOCOL  *FHand
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Flushes & Closes the file handle.
>-
>-Arguments:
>+;
>
>-  FHand                 - Handle to the file to delete.
>+/**
>
>-Returns:
>+  Deletes the file & Closes the file handle.
>
>-  EFI_SUCCESS           - Closed the file successfully.
>+  @param  FHand                    - Handle to the file to delete.
>
>---*/
>-;
>+  @retval EFI_SUCCESS              - Delete the file successfully.
>+  @retval EFI_WARN_DELETE_FAILURE  - Fail to delete the file.
>
>+**/
> EFI_STATUS
> EFIAPI
> FatDelete (
>   IN EFI_FILE_PROTOCOL  *FHand
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Deletes the file & Closes the file handle.
>-
>-Arguments:
>+;
>
>-  FHand                    - Handle to the file to delete.
>+/**
>
>-Returns:
>+  Set the file's position of the file.
>
>-  EFI_SUCCESS              - Delete the file successfully.
>-  EFI_WARN_DELETE_FAILURE  - Fail to delete the file.
>+  @param  FHand                 - The handle of file
>+  @param  Position              - The file's position of the file
>
>---*/
>-;
>+  @retval EFI_SUCCESS           - Set the info successfully
>+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file
>+  @retval EFI_UNSUPPORTED       - Set a directory with a not-zero position
>
>+**/
> EFI_STATUS
> EFIAPI
> FatSetPosition (
>   IN EFI_FILE_PROTOCOL  *FHand,
>   IN UINT64             Position
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Set the file's position of the file
>+;
>
>-Arguments:
>+/**
>
>-  FHand                 - The handle of file
>-  Position              - The file's position of the file
>+  Get the file info.
>
>-Returns:
>+  @param FHand                 - The handle of the file.
>+  @param BufferSize            - Size of Buffer.
>+  @param Buffer                - Buffer containing read data.
>
>-  EFI_SUCCESS           - Set the info successfully
>-  EFI_DEVICE_ERROR      - Can not find the OFile for the file
>-  EFI_UNSUPPORTED       - Set a directory with a not-zero position
>-
>---*/
>-;
>+  @retval EFI_SUCCESS           - Get the file info successfully.
>+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>+  @retval EFI_VOLUME_CORRUPTED  - The file type of open file is error.
>+  @return other                 - An error occurred when operation the disk.
>
>+**/
> EFI_STATUS
> EFIAPI
> FatRead (
>   IN     EFI_FILE_PROTOCOL    *FHand,
>   IN OUT UINTN                *BufferSize,
>      OUT VOID                 *Buffer
>   )
>-/*++
>+;
>
>-Routine Description:
>+/**
>
>   Get the file info.
>
>-Arguments:
>-
>-  FHand                 - The handle of the file.
>-  BufferSize            - Size of Buffer.
>-  Buffer                - Buffer containing read data.
>+  @param FHand                 - The handle of the file.
>+  @param Token                 - A pointer to the token associated with the transaction.
>
>-Returns:
>-
>-  EFI_SUCCESS           - Get the file info successfully.
>-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>-  EFI_VOLUME_CORRUPTED  - The file type of open file is error.
>-  other                 - An error occurred when operation the disk.
>-
>---*/
>-;
>+  @retval EFI_SUCCESS           - Get the file info successfully.
>+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>+  @retval EFI_VOLUME_CORRUPTED  - The file type of open file is error.
>+  @return other                 - An error occurred when operation the disk.
>
>+**/
> EFI_STATUS
> EFIAPI
> FatReadEx (
>   IN     EFI_FILE_PROTOCOL  *FHand,
>   IN OUT EFI_FILE_IO_TOKEN  *Token
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get the file info.
>-
>-Arguments:
>+;
>
>-  FHand                 - The handle of the file.
>-  Token                 - A pointer to the token associated with the transaction.
>+/**
>
>-Returns:
>+  Set the file info.
>
>-  EFI_SUCCESS           - Get the file info successfully.
>-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>-  EFI_VOLUME_CORRUPTED  - The file type of open file is error.
>-  other                 - An error occurred when operation the disk.
>+  @param  FHand                 - The handle of the file.
>+  @param  BufferSize            - Size of Buffer.
>+  @param Buffer                - Buffer containing write data.
>
>---*/
>-;
>+  @retval EFI_SUCCESS           - Set the file info successfully.
>+  @retval EFI_WRITE_PROTECTED   - The disk is write protected.
>+  @retval EFI_ACCESS_DENIED     - The file is read-only.
>+  @retval EFI_DEVICE_ERROR      - The OFile is not valid.
>+  @retval EFI_UNSUPPORTED       - The open file is not a file.
>+                        - The writing file size is larger than 4GB.
>+  @return other                 - An error occurred when operation the disk.
>
>+**/
> EFI_STATUS
> EFIAPI
> FatWrite (
>   IN     EFI_FILE_PROTOCOL      *FHand,
>   IN OUT UINTN                  *BufferSize,
>   IN     VOID                   *Buffer
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Set the file info.
>+;
>
>-Arguments:
>+/**
>
>-  FHand                 - The handle of the file.
>-  BufferSize            - Size of Buffer.
>-  Buffer                - Buffer containing write data.
>+  Get the file info.
>
>-Returns:
>+  @param  FHand                 - The handle of the file.
>+  @param  Token                 - A pointer to the token associated with the transaction.
>
>-  EFI_SUCCESS           - Set the file info successfully.
>-  EFI_WRITE_PROTECTED   - The disk is write protected.
>-  EFI_ACCESS_DENIED     - The file is read-only.
>-  EFI_DEVICE_ERROR      - The OFile is not valid.
>-  EFI_UNSUPPORTED       - The open file is not a file.
>-                        - The writing file size is larger than 4GB.
>-  other                 - An error occurred when operation the disk.
>-
>---*/
>-;
>+  @retval EFI_SUCCESS           - Get the file info successfully.
>+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>+  @retval EFI_VOLUME_CORRUPTED  - The file type of open file is error.
>+  @return other                 - An error occurred when operation the disk.
>
>+**/
> EFI_STATUS
> EFIAPI
> FatWriteEx (
>   IN     EFI_FILE_PROTOCOL  *FHand,
>   IN OUT EFI_FILE_IO_TOKEN  *Token
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get the file info.
>-
>-Arguments:
>-
>-  FHand                 - The handle of the file.
>-  Token                 - A pointer to the token associated with the transaction.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Get the file info successfully.
>-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>-  EFI_VOLUME_CORRUPTED  - The file type of open file is error.
>-  other                 - An error occurred when operation the disk.
>-
>---*/
> ;
>
> //
> // DiskCache.c
> //
>diff --git a/FatPkg/EnhancedFatDxe/FatFileSystem.h b/FatPkg/EnhancedFatDxe/FatFileSystem.h
>index 3f89a34..a4d4405 100644
>--- a/FatPkg/EnhancedFatDxe/FatFileSystem.h
>+++ b/FatPkg/EnhancedFatDxe/FatFileSystem.h
>@@ -1,6 +1,7 @@
>-/*++
>+/** @file
>+  Definitions for on-disk FAT structures.
>
> Copyright (c) 2005, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
>@@ -8,21 +9,11 @@ http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>
>-Module Name:
>-
>-  FatFileSystem.h
>-
>-Abstract:
>-
>-  Definitions for on-disk FAT structures
>-
>-Revision History
>-
>---*/
>+**/
>
> #ifndef _FATFILESYSTEM_H_
> #define _FATFILESYSTEM_H_
>
> #pragma pack(1)
>diff --git a/FatPkg/EnhancedFatDxe/FileName.c b/FatPkg/EnhancedFatDxe/FileName.c
>index f393aa6..8aa3745 100644
>--- a/FatPkg/EnhancedFatDxe/FileName.c
>+++ b/FatPkg/EnhancedFatDxe/FileName.c
>@@ -1,55 +1,39 @@
>-/*++
>+/** @file
>+  Functions for manipulating file names.
>
> Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
> http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>+**/
>
>-Module Name:
>-
>-  FileName.c
>-
>-Abstract:
>+#include "Fat.h"
>
>-  Functions for manipulating file names
>+/**
>
>-Revision History
>+  This function checks whether the input FileName is a valid 8.3 short name.
>+  If the input FileName is a valid 8.3, the output is the 8.3 short name;
>+  otherwise, the output is the base tag of 8.3 short name.
>
>---*/
>+  @param  FileName              - The input unicode filename.
>+  @param  File8Dot3Name         - The output ascii 8.3 short name or base tag of 8.3 short name.
>
>-#include "Fat.h"
>+  @retval TRUE                  - The input unicode filename is a valid 8.3 short name.
>+  @retval FALSE                 - The input unicode filename is not a valid 8.3 short name.
>
>+**/
> BOOLEAN
> FatCheckIs8Dot3Name (
>   IN  CHAR16    *FileName,
>   OUT CHAR8     *File8Dot3Name
>   )
>-/*++
>-
>-Routine Description:
>-
>-  This function checks whether the input FileName is a valid 8.3 short name.
>-  If the input FileName is a valid 8.3, the output is the 8.3 short name;
>-  otherwise, the output is the base tag of 8.3 short name.
>-
>-Arguments:
>-
>-  FileName              - The input unicode filename.
>-  File8Dot3Name         - The output ascii 8.3 short name or base tag of 8.3 short name.
>-
>-Returns:
>-
>-  TRUE                  - The input unicode filename is a valid 8.3 short name.
>-  FALSE                 - The input unicode filename is not a valid 8.3 short name.
>-
>---*/
> {
>   BOOLEAN PossibleShortName;
>   CHAR16  *TempName;
>   CHAR16  *ExtendName;
>   CHAR16  *SeparateDot;
>@@ -116,66 +100,52 @@ Returns:
>   }
>
>   return PossibleShortName;
> }
>
>-STATIC
>-UINTN
>-FatTrimAsciiTrailingBlanks (
>-  IN CHAR8        *Name,
>-  IN UINTN        Len
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Trim the trailing blanks of fat name.
>
>-Arguments:
>-
>-  Name                  - The Char8 string needs to be trimed.
>-  Len                   - The length of the fat name.
>-
>-Returns:
>+  @param  Name                  - The Char8 string needs to be trimed.
>+  @param  Len                   - The length of the fat name.
>
>   The real length of the fat name after the trailing blanks are trimmed.
>
>---*/
>+**/
>+STATIC
>+UINTN
>+FatTrimAsciiTrailingBlanks (
>+  IN CHAR8        *Name,
>+  IN UINTN        Len
>+  )
> {
>   while (Len > 0 && Name[Len - 1] == ' ') {
>     Len--;
>   }
>
>   return Len;
> }
>
>+/**
>+
>+  Convert the ascii fat name to the unicode string and strip trailing spaces,
>+  and if necessary, convert the unicode string to lower case.
>+
>+  @param  FatName               - The Char8 string needs to be converted.
>+  @param  Len                   - The length of the fat name.
>+  @param  LowerCase             - Indicate whether to convert the string to lower case.
>+  @param  Str                   - The result of the convertion.
>+
>+**/
> VOID
> FatNameToStr (
>   IN  CHAR8            *FatName,
>   IN  UINTN            Len,
>   IN  UINTN            LowerCase,
>   OUT CHAR16           *Str
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Convert the ascii fat name to the unicode string and strip trailing spaces,
>-  and if necessary, convert the unicode string to lower case.
>-
>-Arguments:
>-
>-  FatName               - The Char8 string needs to be converted.
>-  Len                   - The length of the fat name.
>-  LowerCase             - Indicate whether to convert the string to lower case.
>-  Str                   - The result of the convertion.
>-
>-Returns:
>-
>-  None.
>-
>---*/
> {
>   //
>   // First, trim the trailing blanks
>   //
>   Len = FatTrimAsciiTrailingBlanks (FatName, Len);
>@@ -190,31 +160,23 @@ Returns:
>   if (LowerCase != 0) {
>     FatStrLwr (Str);
>   }
> }
>
>+/**
>+
>+  This function generates 8Dot3 name from user specified name for a newly created file.
>+
>+  @param  Parent                - The parent directory.
>+  @param  DirEnt                - The directory entry whose 8Dot3Name needs to be generated.
>+
>+**/
> VOID
> FatCreate8Dot3Name (
>   IN FAT_OFILE    *Parent,
>   IN FAT_DIRENT   *DirEnt
>   )
>-/*++
>-
>-Routine Description:
>-
>-  This function generates 8Dot3 name from user specified name for a newly created file.
>-
>-Arguments:
>-
>-  Parent                - The parent directory.
>-  DirEnt                - The directory entry whose 8Dot3Name needs to be generated.
>-
>-Returns:
>-
>-  None.
>-
>---*/
> {
>   CHAR8 *ShortName;
>   CHAR8 *ShortNameChar;
>   UINTN BaseTagLen;
>   UINTN Index;
>@@ -273,33 +235,27 @@ Returns:
>       *ShortNameChar    = '1';
>     }
>   }
> }
>
>-STATIC
>-UINT8
>-FatCheckNameCase (
>-  IN CHAR16           *Str,
>-  IN UINT8            InCaseFlag
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Check the string is lower case or upper case
>   and it is used by fatname to dir entry count
>
>-Arguments:
>-
>-  Str                   - The string which needs to be checked.
>-  InCaseFlag            - The input case flag which is returned when the string is lower case.
>+  @param Str                   - The string which needs to be checked.
>+  @param InCaseFlag            - The input case flag which is returned when the string is lower case.
>
>-Returns:
>+  @retval OutCaseFlag           - The output case flag.
>
>-  OutCaseFlag           - The output case flag.
>-
>---*/
>+**/
>+STATIC
>+UINT8
>+FatCheckNameCase (
>+  IN CHAR16           *Str,
>+  IN UINT8            InCaseFlag
>+  )
> {
>   CHAR16  Buffer[FAT_MAIN_NAME_LEN + 1 + FAT_EXTEND_NAME_LEN + 1];
>   UINT8   OutCaseFlag;
>
>   //
>@@ -326,29 +282,21 @@ Returns:
>   }
>
>   return OutCaseFlag;
> }
>
>-VOID
>-FatSetCaseFlag (
>-  IN FAT_DIRENT   *DirEnt
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Set the caseflag value for the directory entry.
>
>-Arguments:
>-
>-  DirEnt                - The logical directory entry whose caseflag value is to be set.
>-
>-Returns:
>-
>-  None.
>+  @param DirEnt                - The logical directory entry whose caseflag value is to be set.
>
>---*/
>+**/
>+VOID
>+FatSetCaseFlag (
>+  IN FAT_DIRENT   *DirEnt
>+  )
> {
>   CHAR16  LfnBuffer[FAT_MAIN_NAME_LEN + 1 + FAT_EXTEND_NAME_LEN + 1];
>   CHAR16  *TempCharPtr;
>   CHAR16  *ExtendName;
>   CHAR16  *FileNameCharPtr;
>@@ -387,32 +335,25 @@ Returns:
>     DirEnt->Entry.CaseFlag = 0;
>     DirEnt->EntryCount++;
>   }
> }
>
>+/**
>+
>+  Convert the 8.3 ASCII fat name to cased Unicode string according to case flag.
>+
>+  @param  DirEnt                - The corresponding directory entry.
>+  @param  FileString            - The output Unicode file name.
>+  @param  FileStringMax           The max length of FileString.
>+
>+**/
> VOID
> FatGetFileNameViaCaseFlag (
>   IN     FAT_DIRENT   *DirEnt,
>   IN OUT CHAR16       *FileString,
>   IN     UINTN        FileStringMax
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Convert the 8.3 ASCII fat name to cased Unicode string according to case flag.
>-
>-Arguments:
>-
>-  DirEnt                - The corresponding directory entry.
>-  FileString            - The output Unicode file name.
>-
>-Returns:
>-
>-  None.
>-
>---*/
> {
>   UINT8   CaseFlag;
>   CHAR8   *File8Dot3Name;
>   CHAR16  TempExt[1 + FAT_EXTEND_NAME_LEN + 1];
>   //
>@@ -427,29 +368,23 @@ Returns:
>     TempExt[0] = L'.';
>     StrCatS (FileString, FileStringMax, TempExt);
>   }
> }
>
>-UINT8
>-FatCheckSum (
>-  IN CHAR8  *ShortNameString
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Get the Check sum for a short name.
>
>-Arguments:
>+  @param  ShortNameString       - The short name for a file.
>
>-  ShortNameString       - The short name for a file.
>+  @retval Sum                   - UINT8 checksum.
>
>-Returns:
>-
>-  Sum                   - UINT8 checksum.
>-
>---*/
>+**/
>+UINT8
>+FatCheckSum (
>+  IN CHAR8  *ShortNameString
>+  )
> {
>   UINTN ShortNameLen;
>   UINT8 Sum;
>   Sum = 0;
>   for (ShortNameLen = FAT_NAME_LEN; ShortNameLen != 0; ShortNameLen--) {
>@@ -457,33 +392,27 @@ Returns:
>   }
>
>   return Sum;
> }
>
>-CHAR16 *
>-FatGetNextNameComponent (
>-  IN  CHAR16      *Path,
>-  OUT CHAR16      *Name
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Takes Path as input, returns the next name component
>   in Name, and returns the position after Name (e.g., the
>   start of the next name component)
>
>-Arguments:
>-
>-  Path                  - The path of one file.
>-  Name                  - The next name component in Path.
>-
>-Returns:
>+  @param  Path                  - The path of one file.
>+  @param  Name                  - The next name component in Path.
>
>   The position after Name in the Path
>
>---*/
>+**/
>+CHAR16 *
>+FatGetNextNameComponent (
>+  IN  CHAR16      *Path,
>+  OUT CHAR16      *Name
>+  )
> {
>   while (*Path != 0 && *Path != PATH_NAME_SEPARATOR) {
>     *Name++ = *Path++;
>   }
>   *Name = 0;
>@@ -495,35 +424,28 @@ Returns:
>   }
>
>   return Path;
> }
>
>-BOOLEAN
>-FatFileNameIsValid (
>-  IN  CHAR16  *InputFileName,
>-  OUT CHAR16  *OutputFileName
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Check whether the IFileName is valid long file name. If the IFileName is a valid
>   long file name, then we trim the possible leading blanks and leading/trailing dots.
>   the trimmed filename is stored in OutputFileName
>
>-Arguments:
>+  @param  InputFileName         - The input file name.
>+  @param  OutputFileName        - The output file name.
>
>-  InputFileName         - The input file name.
>-  OutputFileName        - The output file name.
>+  @retval TRUE                  - The InputFileName is a valid long file name.
>+  @retval FALSE                 - The InputFileName is not a valid long file name.
>
>-
>-Returns:
>-
>-  TRUE                  - The InputFileName is a valid long file name.
>-  FALSE                 - The InputFileName is not a valid long file name.
>-
>---*/
>+**/
>+BOOLEAN
>+FatFileNameIsValid (
>+  IN  CHAR16  *InputFileName,
>+  OUT CHAR16  *OutputFileName
>+  )
> {
>   CHAR16  *TempNamePointer;
>   CHAR16  TempChar;
>   //
>   // Trim Leading blanks
>diff --git a/FatPkg/EnhancedFatDxe/FileSpace.c b/FatPkg/EnhancedFatDxe/FileSpace.c
>index db44a33..1254cd6 100644
>--- a/FatPkg/EnhancedFatDxe/FileSpace.c
>+++ b/FatPkg/EnhancedFatDxe/FileSpace.c
>@@ -1,6 +1,7 @@
>-/*++
>+/** @file
>+  Routines dealing with disk spaces and FAT table entries.
>
> Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
>@@ -8,47 +9,32 @@ http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>
>-Module Name:
>
>-  FileSpace.c
>+**/
>
>-Abstract:
>+#include "Fat.h"
>
>-  Routines dealing with disk spaces and FAT table entries
>
>-Revision History
>+/**
>
>---*/
>+  Get the FAT entry of the volume, which is identified with the Index.
>
>-#include "Fat.h"
>+  @param  Volume                - FAT file system volume.
>+  @param  Index                 - The index of the FAT entry of the volume.
>
>+  @return The buffer of the FAT entry
>
>+**/
> STATIC
> VOID *
> FatLoadFatEntry (
>   IN FAT_VOLUME       *Volume,
>   IN UINTN            Index
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get the FAT entry of the volume, which is identified with the Index.
>-
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>-  Index                 - The index of the FAT entry of the volume.
>-
>-Returns:
>-
>-  The buffer of the FAT entry
>-
>---*/
> {
>   UINTN       Pos;
>   EFI_STATUS  Status;
>
>   if (Index > (Volume->MaxCluster + 1)) {
>@@ -87,32 +73,26 @@ Returns:
>   }
>
>   return &Volume->FatEntryBuffer;
> }
>
>+/**
>+
>+  Get the FAT entry value of the volume, which is identified with the Index.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  Index                 - The index of the FAT entry of the volume.
>+
>+  @return  The value of the FAT entry.
>+
>+**/
> STATIC
> UINTN
> FatGetFatEntry (
>   IN FAT_VOLUME       *Volume,
>   IN UINTN            Index
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get the FAT entry value of the volume, which is identified with the Index.
>-
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>-  Index                 - The index of the FAT entry of the volume.
>-
>-Returns:
>-
>-  The value of the FAT entry.
>-
>---*/
> {
>   VOID    *Pos;
>   UINT8   *En12;
>   UINT16  *En16;
>   UINT32  *En32;
>@@ -145,36 +125,30 @@ Returns:
>   }
>
>   return Accum;
> }
>
>+/**
>+
>+  Set the FAT entry value of the volume, which is identified with the Index.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  Index                 - The index of the FAT entry of the volume.
>+  @param  Value                 - The new value of the FAT entry.
>+
>+  @retval EFI_SUCCESS           - Set the new FAT entry value sucessfully.
>+  @retval EFI_VOLUME_CORRUPTED  - The FAT type of the volume is error.
>+  @return other                 - An error occurred when operation the FAT entries.
>+
>+**/
> STATIC
> EFI_STATUS
> FatSetFatEntry (
>   IN FAT_VOLUME       *Volume,
>   IN UINTN            Index,
>   IN UINTN            Value
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Set the FAT entry value of the volume, which is identified with the Index.
>-
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>-  Index                 - The index of the FAT entry of the volume.
>-  Value                 - The new value of the FAT entry.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Set the new FAT entry value sucessfully.
>-  EFI_VOLUME_CORRUPTED  - The FAT type of the volume is error.
>-  other                 - An error occurred when operation the FAT entries.
>-
>---*/
> {
>   VOID        *Pos;
>   UINT8       *En12;
>   UINT16      *En16;
>   UINT32      *En32;
>@@ -251,33 +225,27 @@ Returns:
>              NULL
>              );
>   return Status;
> }
>
>+/**
>+
>+  Free the cluster clain.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  Cluster               - The first cluster of cluster chain.
>+
>+  @retval EFI_SUCCESS           - The cluster chain is freed successfully.
>+  @retval EFI_VOLUME_CORRUPTED  - There are errors in the file's clusters.
>+
>+**/
> STATIC
> EFI_STATUS
> FatFreeClusters (
>   IN FAT_VOLUME           *Volume,
>   IN UINTN                Cluster
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Free the cluster clain.
>-
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>-  Cluster               - The first cluster of cluster chain.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - The cluster chain is freed successfully.
>-  EFI_VOLUME_CORRUPTED  - There are errors in the file's clusters.
>-
>---*/
> {
>   UINTN LastCluster;
>
>   while (!FAT_END_OF_FAT_CHAIN (Cluster)) {
>     if (Cluster == FAT_CLUSTER_FREE || Cluster >= FAT_CLUSTER_SPECIAL) {
>@@ -292,30 +260,24 @@ Returns:
>   }
>
>   return EFI_SUCCESS;
> }
>
>-STATIC
>-UINTN
>-FatAllocateCluster (
>-  IN FAT_VOLUME   *Volume
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Allocate a free cluster and return the cluster index.
>
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>+  @param  Volume                - FAT file system volume.
>
>-Returns:
>+  @return The index of the free cluster
>
>-  The index of the free cluster
>-
>---*/
>+**/
>+STATIC
>+UINTN
>+FatAllocateCluster (
>+  IN FAT_VOLUME   *Volume
>+  )
> {
>   UINTN Cluster;
>
>   //
>   // Start looking at FatFreePos for the next unallocated cluster
>@@ -352,32 +314,26 @@ Returns:
>   Cluster = Volume->FatInfoSector.FreeInfo.NextCluster;
>   Volume->FatInfoSector.FreeInfo.NextCluster += 1;
>   return Cluster;
> }
>
>+/**
>+
>+  Count the number of clusters given a size.
>+
>+  @param  Volume                - The file system volume.
>+  @param  Size                  - The size in bytes.
>+
>+  @return The number of the clusters.
>+
>+**/
> STATIC
> UINTN
> FatSizeToClusters (
>   IN FAT_VOLUME       *Volume,
>   IN UINTN            Size
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Count the number of clusters given a size
>-
>-Arguments:
>-
>-  Volume                - The file system volume.
>-  Size                  - The size in bytes.
>-
>-Returns:
>-
>-  The number of the clusters.
>-
>---*/
> {
>   UINTN Clusters;
>
>   Clusters = Size >> Volume->ClusterAlignment;
>   if ((Size & (Volume->ClusterSize - 1)) > 0) {
>@@ -385,30 +341,24 @@ Returns:
>   }
>
>   return Clusters;
> }
>
>-EFI_STATUS
>-FatShrinkEof (
>-  IN FAT_OFILE            *OFile
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Shrink the end of the open file base on the file size.
>
>-Arguments:
>-
>-  OFile                 - The open file.
>+  @param  OFile                 - The open file.
>
>-Returns:
>+  @retval EFI_SUCCESS           - Shrinked sucessfully.
>+  @retval EFI_VOLUME_CORRUPTED  - There are errors in the file's clusters.
>
>-  EFI_SUCCESS           - Shrinked sucessfully.
>-  EFI_VOLUME_CORRUPTED  - There are errors in the file's clusters.
>-
>---*/
>+**/
>+EFI_STATUS
>+FatShrinkEof (
>+  IN FAT_OFILE            *OFile
>+  )
> {
>   FAT_VOLUME  *Volume;
>   UINTN       NewSize;
>   UINTN       CurSize;
>   UINTN       Cluster;
>@@ -463,34 +413,28 @@ Returns:
>   // Free the remaining cluster chain
>   //
>   return FatFreeClusters (Volume, Cluster);
> }
>
>-EFI_STATUS
>-FatGrowEof (
>-  IN FAT_OFILE            *OFile,
>-  IN UINT64               NewSizeInBytes
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Grow the end of the open file base on the NewSizeInBytes.
>
>-Arguments:
>-
>-  OFile                 - The open file.
>-  NewSizeInBytes        - The new size in bytes of the open file.
>+  @param  OFile                 - The open file.
>+  @param  NewSizeInBytes        - The new size in bytes of the open file.
>
>-Returns:
>+  @retval EFI_SUCCESS           - The file is grown sucessfully.
>+  @retval EFI_UNSUPPORTED       - The file size is larger than 4GB.
>+  @retval EFI_VOLUME_CORRUPTED  - There are errors in the files' clusters.
>+  @retval EFI_VOLUME_FULL       - The volume is full and can not grow the file.
>
>-  EFI_SUCCESS           - The file is grown sucessfully.
>-  EFI_UNSUPPORTED       - The file size is larger than 4GB.
>-  EFI_VOLUME_CORRUPTED  - There are errors in the files' clusters.
>-  EFI_VOLUME_FULL       - The volume is full and can not grow the file.
>-
>---*/
>+**/
>+EFI_STATUS
>+FatGrowEof (
>+  IN FAT_OFILE            *OFile,
>+  IN UINT64               NewSizeInBytes
>+  )
> {
>   FAT_VOLUME  *Volume;
>   EFI_STATUS  Status;
>   UINTN       Cluster;
>   UINTN       CurSize;
>@@ -589,35 +533,29 @@ Returns:
> Done:
>   FatShrinkEof (OFile);
>   return Status;
> }
>
>-EFI_STATUS
>-FatOFilePosition (
>-  IN FAT_OFILE            *OFile,
>-  IN UINTN                Position,
>-  IN UINTN                PosLimit
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Seek OFile to requested position, and calculate the number of
>   consecutive clusters from the position in the file
>
>-Arguments:
>-
>-  OFile                 - The open file.
>-  Position              - The file's position which will be accessed.
>-  PosLimit              - The maximum length current reading/writing may access
>+  @param  OFile                 - The open file.
>+  @param  Position              - The file's position which will be accessed.
>+  @param  PosLimit              - The maximum length current reading/writing may access
>
>-Returns:
>+  @retval EFI_SUCCESS           - Set the info successfully.
>+  @retval EFI_VOLUME_CORRUPTED  - Cluster chain corrupt.
>
>-  EFI_SUCCESS           - Set the info successfully.
>-  EFI_VOLUME_CORRUPTED  - Cluster chain corrupt.
>-
>---*/
>+**/
>+EFI_STATUS
>+FatOFilePosition (
>+  IN FAT_OFILE            *OFile,
>+  IN UINTN                Position,
>+  IN UINTN                PosLimit
>+  )
> {
>   FAT_VOLUME  *Volume;
>   UINTN       ClusterSize;
>   UINTN       Cluster;
>   UINTN       StartPos;
>@@ -689,32 +627,26 @@ Returns:
>
>   OFile->PosRem = Run;
>   return EFI_SUCCESS;
> }
>
>-UINTN
>-FatPhysicalDirSize (
>-  IN FAT_VOLUME            *Volume,
>-  IN UINTN                 Cluster
>-  )
>-/*++
>-
>-Routine Description:
>-
>- Get the size of directory of the open file
>+/**
>
>-Arguments:
>+  Get the size of directory of the open file.
>
>-  Volume                - The File System Volume.
>-  Cluster               - The Starting cluster.
>+  @param  Volume                - The File System Volume.
>+  @param  Cluster               - The Starting cluster.
>
>-Returns:
>-
>-  The physical size of the file starting at the input cluster, if there is error in the
>+  @return The physical size of the file starting at the input cluster, if there is error in the
>   cluster chain, the return value is 0.
>
>---*/
>+**/
>+UINTN
>+FatPhysicalDirSize (
>+  IN FAT_VOLUME            *Volume,
>+  IN UINTN                 Cluster
>+  )
> {
>   UINTN Size;
>   ASSERT_VOLUME_LOCKED (Volume);
>   //
>   // Run the cluster chain for the OFile
>@@ -740,58 +672,44 @@ Returns:
>   }
>
>   return Size;
> }
>
>+/**
>+
>+  Get the physical size of a file on the disk.
>+
>+  @param  Volume                - The file system volume.
>+  @param  RealSize              - The real size of a file.
>+
>+  @return The physical size of a file on the disk.
>+
>+**/
> UINT64
> FatPhysicalFileSize (
>   IN FAT_VOLUME            *Volume,
>   IN UINTN                 RealSize
>   )
>-/*++
>-
>-Routine Description:
>-
>- Get the physical size of a file on the disk.
>-
>-Arguments:
>-
>-  Volume                - The file system volume.
>-  RealSize              - The real size of a file.
>-
>-Returns:
>-
>-  The physical size of a file on the disk.
>-
>---*/
> {
>   UINTN   ClusterSizeMask;
>   UINT64  PhysicalSize;
>   ClusterSizeMask = Volume->ClusterSize - 1;
>   PhysicalSize    = (RealSize + ClusterSizeMask) & (~((UINT64) ClusterSizeMask));
>   return PhysicalSize;
> }
>
>-VOID
>-FatComputeFreeInfo (
>-  IN FAT_VOLUME *Volume
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Update the free cluster info of FatInfoSector of the volume.
>
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>-
>-Returns:
>-
>-  None.
>+  @param  Volume                - FAT file system volume.
>
>---*/
>+**/
>+VOID
>+FatComputeFreeInfo (
>+  IN FAT_VOLUME *Volume
>+  )
> {
>   UINTN Index;
>
>   //
>   // If we don't have valid info, compute it now
>diff --git a/FatPkg/EnhancedFatDxe/Flush.c b/FatPkg/EnhancedFatDxe/Flush.c
>index 172f202..9cb0d9a 100644
>--- a/FatPkg/EnhancedFatDxe/Flush.c
>+++ b/FatPkg/EnhancedFatDxe/Flush.c
>@@ -1,6 +1,7 @@
>-/*++
>+/** @file
>+  Routines that check references and flush OFiles
>
> Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
>@@ -8,49 +9,33 @@ http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>
>-Module Name:
>-
>-  flush.c
>+**/
>
>-Abstract:
>+#include "Fat.h"
>
>-  Routines that check references and flush OFiles
>+/**
>
>-Revision History
>+  Flushes all data associated with the file handle.
>
>---*/
>+  @param  FHand                 - Handle to file to flush.
>+  @param  Token                 - A pointer to the token associated with the transaction.
>
>-#include "Fat.h"
>+  @retval EFI_SUCCESS           - Flushed the file successfully.
>+  @retval EFI_WRITE_PROTECTED   - The volume is read only.
>+  @retval EFI_ACCESS_DENIED     - The file is read only.
>+  @return Others                - Flushing of the file failed.
>
>+**/
> EFI_STATUS
> EFIAPI
> FatFlushEx (
>   IN EFI_FILE_PROTOCOL  *FHand,
>   IN EFI_FILE_IO_TOKEN  *Token
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Flushes all data associated with the file handle.
>-
>-Arguments:
>-
>-  FHand                 - Handle to file to flush.
>-  Token                 - A pointer to the token associated with the transaction.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Flushed the file successfully.
>-  EFI_WRITE_PROTECTED   - The volume is read only.
>-  EFI_ACCESS_DENIED     - The file is read only.
>-  Others                - Flushing of the file failed.
>-
>---*/
> {
>   FAT_IFILE   *IFile;
>   FAT_OFILE   *OFile;
>   FAT_VOLUME  *Volume;
>   EFI_STATUS  Status;
>@@ -111,57 +96,45 @@ Returns:
>   }
>
>   return Status;
> }
>
>-EFI_STATUS
>-EFIAPI
>-FatFlush (
>-  IN EFI_FILE_PROTOCOL  *FHand
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Flushes all data associated with the file handle.
>
>-Arguments:
>-
>-  FHand                 - Handle to file to flush.
>-
>-Returns:
>+  @param  FHand                 - Handle to file to flush.
>
>-  EFI_SUCCESS           - Flushed the file successfully.
>-  EFI_WRITE_PROTECTED   - The volume is read only.
>-  EFI_ACCESS_DENIED     - The file is read only.
>-  Others                - Flushing of the file failed.
>-
>---*/
>-{
>-  return FatFlushEx (FHand, NULL);
>-}
>+  @retval EFI_SUCCESS           - Flushed the file successfully.
>+  @retval EFI_WRITE_PROTECTED   - The volume is read only.
>+  @retval EFI_ACCESS_DENIED     - The file is read only.
>+  @return Others                - Flushing of the file failed.
>
>+**/
> EFI_STATUS
> EFIAPI
>-FatClose (
>+FatFlush (
>   IN EFI_FILE_PROTOCOL  *FHand
>   )
>-/*++
>+{
>+  return FatFlushEx (FHand, NULL);
>+}
>
>-Routine Description:
>+/**
>
>   Flushes & Closes the file handle.
>
>-Arguments:
>-
>-  FHand                 - Handle to the file to delete.
>-
>-Returns:
>+  @param  FHand                 - Handle to the file to delete.
>
>-  EFI_SUCCESS           - Closed the file successfully.
>+  @retval EFI_SUCCESS           - Closed the file successfully.
>
>---*/
>+**/
>+EFI_STATUS
>+EFIAPI
>+FatClose (
>+  IN EFI_FILE_PROTOCOL  *FHand
>+  )
> {
>   FAT_IFILE   *IFile;
>   FAT_OFILE   *OFile;
>   FAT_VOLUME  *Volume;
>
>@@ -189,29 +162,23 @@ Returns:
>   // Close always succeed
>   //
>   return EFI_SUCCESS;
> }
>
>-EFI_STATUS
>-FatIFileClose (
>-  FAT_IFILE           *IFile
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Close the open file instance.
>
>-Arguments:
>+  @param  IFile                 - Open file instance.
>
>-  IFile                 - Open file instance.
>+  @retval EFI_SUCCESS           - Closed the file successfully.
>
>-Returns:
>-
>-  EFI_SUCCESS           - Closed the file successfully.
>-
>---*/
>+**/
>+EFI_STATUS
>+FatIFileClose (
>+  FAT_IFILE           *IFile
>+  )
> {
>   FAT_OFILE   *OFile;
>   FAT_VOLUME  *Volume;
>
>   OFile   = IFile->OFile;
>@@ -237,31 +204,25 @@ Returns:
>   //
>   FreePool (IFile);
>   return EFI_SUCCESS;
> }
>
>-EFI_STATUS
>-FatOFileFlush (
>-  IN FAT_OFILE    *OFile
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Flush the data associated with an open file.
>   In this implementation, only last Mod/Access time is updated.
>
>-Arguments:
>+  @param  OFile                 - The open file.
>
>-  OFile                 - The open file.
>+  @retval EFI_SUCCESS           - The OFile is flushed successfully.
>+  @return Others                - An error occurred when flushing this OFile.
>
>-Returns:
>-
>-  EFI_SUCCESS           - The OFile is flushed successfully.
>-  Others                - An error occurred when flushing this OFile.
>-
>---*/
>+**/
>+EFI_STATUS
>+FatOFileFlush (
>+  IN FAT_OFILE    *OFile
>+  )
> {
>   EFI_STATUS    Status;
>   FAT_OFILE     *Parent;
>   FAT_DIRENT    *DirEnt;
>   FAT_DATE_TIME FatNow;
>@@ -316,32 +277,26 @@ Returns:
>     OFile = Parent;
>   } while (OFile != NULL);
>   return EFI_SUCCESS;
> }
>
>-BOOLEAN
>-FatCheckOFileRef (
>-  IN FAT_OFILE   *OFile
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Check the references of the OFile.
>   If the OFile (that is checked) is no longer
>   referenced, then it is freed.
>
>-Arguments:
>+  @param  OFile                 - The OFile to be checked.
>
>-  OFile                 - The OFile to be checked.
>+  @retval TRUE                  - The OFile is not referenced and freed.
>+  @retval FALSE                 - The OFile is kept.
>
>-Returns:
>-
>-  TRUE                  - The OFile is not referenced and freed.
>-  FALSE                 - The OFile is kept.
>-
>---*/
>+**/
>+BOOLEAN
>+FatCheckOFileRef (
>+  IN FAT_OFILE   *OFile
>+  )
> {
>   //
>   // If the OFile is on the check ref list, remove it
>   //
>   if (OFile->CheckLink.ForwardLink != NULL) {
>@@ -364,33 +319,25 @@ Returns:
>   //
>   FatCloseDirEnt (OFile->DirEnt);
>   return TRUE;
> }
>
>-STATIC
>-VOID
>-FatCheckVolumeRef (
>-  IN FAT_VOLUME   *Volume
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Check the references of all open files on the volume.
>   Any open file (that is checked) that is no longer
>   referenced, is freed - and it's parent open file
>   is then referenced checked.
>
>-Arguments:
>-
>-  Volume                - The volume to check the pending open file list.
>-
>-Returns:
>+  @param  Volume                - The volume to check the pending open file list.
>
>-  None
>-
>---*/
>+**/
>+STATIC
>+VOID
>+FatCheckVolumeRef (
>+  IN FAT_VOLUME   *Volume
>+  )
> {
>   FAT_OFILE *OFile;
>   FAT_OFILE *Parent;
>
>   //
>@@ -412,38 +359,33 @@ Returns:
>       }
>     }
>   }
> }
>
>-EFI_STATUS
>-FatCleanupVolume (
>-  IN FAT_VOLUME       *Volume,
>-  IN FAT_OFILE        *OFile,
>-  IN EFI_STATUS       EfiStatus,
>-  IN FAT_TASK         *Task
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Set error status for a specific OFile, reference checking the volume.
>   If volume is already marked as invalid, and all resources are freed
>   after reference checking, the file system protocol is uninstalled and
>   the volume structure is freed.
>
>-Arguments:
>+  @param  Volume                - the Volume that is to be reference checked and unlocked.
>+  @param  OFile                 - the OFile whose permanent error code is to be set.
>+  @param  EfiStatus             - error code to be set.
>+  @param  Task                    point to task instance.
>
>-  Volume                - the Volume that is to be reference checked and unlocked.
>-  OFile                 - the OFile whose permanent error code is to be set.
>-  EfiStatus             - error code to be set.
>+  @retval EFI_SUCCESS           - Clean up the volume successfully.
>+  @return Others                - Cleaning up of the volume is failed.
>
>-Returns:
>-
>-  EFI_SUCCESS           - Clean up the volume successfully.
>-  Others                - Cleaning up of the volume is failed.
>-
>---*/
>+**/
>+EFI_STATUS
>+FatCleanupVolume (
>+  IN FAT_VOLUME       *Volume,
>+  IN FAT_OFILE        *OFile,
>+  IN EFI_STATUS       EfiStatus,
>+  IN FAT_TASK         *Task
>+  )
> {
>   EFI_STATUS  Status;
>   //
>   // Flag the OFile
>   //
>@@ -497,31 +439,23 @@ Returns:
>   }
>
>   return EfiStatus;
> }
>
>+/**
>+
>+  Set the OFile and its child OFile with the error Status
>+
>+  @param  OFile                 - The OFile whose permanent error code is to be set.
>+  @param  Status                - Error code to be set.
>+
>+**/
> VOID
> FatSetVolumeError (
>   IN FAT_OFILE            *OFile,
>   IN EFI_STATUS           Status
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Set the OFile and its child OFile with the error Status
>-
>-Arguments:
>-
>-  OFile                 - The OFile whose permanent error code is to be set.
>-  Status                - Error code to be set.
>-
>-Returns:
>-
>-  None
>-
>---*/
> {
>   LIST_ENTRY      *Link;
>   FAT_OFILE       *ChildOFile;
>
>   //
>diff --git a/FatPkg/EnhancedFatDxe/Hash.c b/FatPkg/EnhancedFatDxe/Hash.c
>index f827368..5a9bbda 100644
>--- a/FatPkg/EnhancedFatDxe/Hash.c
>+++ b/FatPkg/EnhancedFatDxe/Hash.c
>@@ -1,51 +1,35 @@
>-/*++
>+/** @file
>+  Hash table operations.
>
> Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
> http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>+**/
>
>-Module Name:
>-
>-  Hash.c
>-
>-Abstract:
>+#include "Fat.h"
>
>-  Hash table operations
>+/**
>
>-Revision History
>+  Get hash value for long name.
>
>---*/
>+  @param  LongNameString        - The long name string to be hashed.
>
>-#include "Fat.h"
>+  @return HashValue.
>
>+**/
> STATIC
> UINT32
> FatHashLongName (
>   IN CHAR16   *LongNameString
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get hash value for long name.
>-
>-Arguments:
>-
>-  LongNameString        - The long name string to be hashed.
>-
>-Returns:
>-
>-  HashValue.
>-
>---*/
> {
>   UINT32  HashValue;
>   CHAR16  UpCasedLongFileName[EFI_PATH_STRING_LENGTH];
>   StrnCpyS (
>     UpCasedLongFileName,
>@@ -56,57 +40,45 @@ Returns:
>   FatStrUpr (UpCasedLongFileName);
>   gBS->CalculateCrc32 (UpCasedLongFileName, StrSize (UpCasedLongFileName), &HashValue);
>   return (HashValue & HASH_TABLE_MASK);
> }
>
>-STATIC
>-UINT32
>-FatHashShortName (
>-  IN CHAR8   *ShortNameString
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Get hash value for short name.
>
>-Arguments:
>+  @param  ShortNameString       - The short name string to be hashed.
>
>-  ShortNameString       - The short name string to be hashed.
>+  @return HashValue
>
>-Returns:
>-
>-  HashValue
>-
>---*/
>+**/
>+STATIC
>+UINT32
>+FatHashShortName (
>+  IN CHAR8   *ShortNameString
>+  )
> {
>   UINT32  HashValue;
>   gBS->CalculateCrc32 (ShortNameString, FAT_NAME_LEN, &HashValue);
>   return (HashValue & HASH_TABLE_MASK);
> }
>
>-FAT_DIRENT **
>-FatLongNameHashSearch (
>-  IN FAT_ODIR       *ODir,
>-  IN CHAR16         *LongNameString
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Search the long name hash table for the directory entry.
>
>-Arguments:
>-
>-  ODir                  - The directory to be searched.
>-  LongNameString        - The long name string to search.
>-
>-Returns:
>+  @param  ODir                  - The directory to be searched.
>+  @param  LongNameString        - The long name string to search.
>
>-  The previous long name hash node of the directory entry.
>+  @return The previous long name hash node of the directory entry.
>
>---*/
>+**/
>+FAT_DIRENT **
>+FatLongNameHashSearch (
>+  IN FAT_ODIR       *ODir,
>+  IN CHAR16         *LongNameString
>+  )
> {
>   FAT_DIRENT  **PreviousHashNode;
>   for (PreviousHashNode   = &ODir->LongNameHashTable[FatHashLongName (LongNameString)];
>        *PreviousHashNode != NULL;
>        PreviousHashNode   = &(*PreviousHashNode)->LongNameForwardLink
>@@ -117,31 +89,25 @@ Returns:
>   }
>
>   return PreviousHashNode;
> }
>
>-FAT_DIRENT **
>-FatShortNameHashSearch (
>-  IN FAT_ODIR      *ODir,
>-  IN CHAR8         *ShortNameString
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Search the short name hash table for the directory entry.
>
>-Arguments:
>-
>-  ODir                  - The directory to be searched.
>-  ShortNameString       - The short name string to search.
>+  @param  ODir                  - The directory to be searched.
>+  @param  ShortNameString       - The short name string to search.
>
>-Returns:
>+  @return The previous short name hash node of the directory entry.
>
>-  The previous short name hash node of the directory entry.
>-
>---*/
>+**/
>+FAT_DIRENT **
>+FatShortNameHashSearch (
>+  IN FAT_ODIR      *ODir,
>+  IN CHAR8         *ShortNameString
>+  )
> {
>   FAT_DIRENT  **PreviousHashNode;
>   for (PreviousHashNode   = &ODir->ShortNameHashTable[FatHashShortName (ShortNameString)];
>        *PreviousHashNode != NULL;
>        PreviousHashNode   = &(*PreviousHashNode)->ShortNameForwardLink
>@@ -152,31 +118,23 @@ Returns:
>   }
>
>   return PreviousHashNode;
> }
>
>+/**
>+
>+  Insert directory entry to hash table.
>+
>+  @param  ODir                  - The parent directory.
>+  @param  DirEnt                - The directory entry node.
>+
>+**/
> VOID
> FatInsertToHashTable (
>   IN FAT_ODIR     *ODir,
>   IN FAT_DIRENT   *DirEnt
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Insert directory entry to hash table.
>-
>-Arguments:
>-
>-  ODir                  - The parent directory.
>-  DirEnt                - The directory entry node.
>-
>-Returns:
>-
>-  None.
>-
>---*/
> {
>   FAT_DIRENT  **HashTable;
>   UINT32      HashTableIndex;
>
>   //
>@@ -193,30 +151,22 @@ Returns:
>   HashTable                     = ODir->LongNameHashTable;
>   DirEnt->LongNameForwardLink   = HashTable[HashTableIndex];
>   HashTable[HashTableIndex]     = DirEnt;
> }
>
>+/**
>+
>+  Delete directory entry from hash table.
>+
>+  @param  ODir                  - The parent directory.
>+  @param  DirEnt                - The directory entry node.
>+
>+**/
> VOID
> FatDeleteFromHashTable (
>   IN FAT_ODIR     *ODir,
>   IN FAT_DIRENT   *DirEnt
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Delete directory entry from hash table.
>-
>-Arguments:
>-
>-  ODir                  - The parent directory.
>-  DirEnt                - The directory entry node.
>-
>-Returns:
>-
>-  None.
>-
>---*/
> {
>   *FatShortNameHashSearch (ODir, DirEnt->Entry.FileName) = DirEnt->ShortNameForwardLink;
>   *FatLongNameHashSearch (ODir, DirEnt->FileString)      = DirEnt->LongNameForwardLink;
> }
>diff --git a/FatPkg/EnhancedFatDxe/Info.c b/FatPkg/EnhancedFatDxe/Info.c
>index aa1b0f2..1a7f828 100644
>--- a/FatPkg/EnhancedFatDxe/Info.c
>+++ b/FatPkg/EnhancedFatDxe/Info.c
>@@ -1,6 +1,7 @@
>-/*++
>+/** @file
>+  Routines dealing with setting/getting file/volume info
>
> Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
>@@ -8,21 +9,12 @@ http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>
>-Module Name:
>-
>-  Info.c
>-
>-Abstract:
>-
>-  Routines dealing with setting/getting file/volume info
>-
>-Revision History
>
>---*/
>+**/
>
> #include "Fat.h"
>
> EFI_STATUS
> FatGetVolumeInfo (
>@@ -45,62 +37,50 @@ FatSetOrGetInfo (
>   IN EFI_GUID             *Type,
>   IN OUT UINTN            *BufferSize,
>   IN OUT VOID             *Buffer
>   );
>
>+/**
>+
>+  Get the open file's info into Buffer.
>+
>+  @param  OFile                 - The open file.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing file info.
>+
>+  @retval EFI_SUCCESS           - Get the file info successfully.
>+  @retval EFI_BUFFER_TOO_SMALL  - The buffer is too small.
>+
>+**/
> EFI_STATUS
> FatGetFileInfo (
>   IN FAT_OFILE        *OFile,
>   IN OUT UINTN        *BufferSize,
>   OUT VOID            *Buffer
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get the open file's info into Buffer.
>-
>-Arguments:
>+{
>+  return FatGetDirEntInfo (OFile->Volume, OFile->DirEnt, BufferSize, Buffer);
>+}
>
>-  OFile                 - The open file.
>-  BufferSize            - Size of Buffer.
>-  Buffer                - Buffer containing file info.
>+/**
>
>-Returns:
>+  Get the volume's info into Buffer.
>
>-  EFI_SUCCESS           - Get the file info successfully.
>-  EFI_BUFFER_TOO_SMALL  - The buffer is too small.
>+  @param  Volume                - FAT file system volume.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing volume info.
>
>---*/
>-{
>-  return FatGetDirEntInfo (OFile->Volume, OFile->DirEnt, BufferSize, Buffer);
>-}
>+  @retval EFI_SUCCESS           - Get the volume info successfully.
>+  @retval EFI_BUFFER_TOO_SMALL  - The buffer is too small.
>
>+**/
> EFI_STATUS
> FatGetVolumeInfo (
>   IN     FAT_VOLUME     *Volume,
>   IN OUT UINTN          *BufferSize,
>      OUT VOID           *Buffer
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get the volume's info into Buffer.
>-
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>-  BufferSize            - Size of Buffer.
>-  Buffer                - Buffer containing volume info.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Get the volume info successfully.
>-  EFI_BUFFER_TOO_SMALL  - The buffer is too small.
>-
>---*/
> {
>   UINTN                 Size;
>   UINTN                 NameSize;
>   UINTN                 ResultSize;
>   CHAR16                Name[FAT_NAME_LEN + 1];
>@@ -139,34 +119,28 @@ Returns:
>
>   *BufferSize = ResultSize;
>   return Status;
> }
>
>+/**
>+
>+  Get the volume's label info into Buffer.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing volume's label info.
>+
>+  @retval EFI_SUCCESS           - Get the volume's label info successfully.
>+  @retval EFI_BUFFER_TOO_SMALL  - The buffer is too small.
>+
>+**/
> EFI_STATUS
> FatGetVolumeLabelInfo (
>   IN FAT_VOLUME       *Volume,
>   IN OUT UINTN        *BufferSize,
>   OUT VOID            *Buffer
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get the volume's label info into Buffer.
>-
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>-  BufferSize            - Size of Buffer.
>-  Buffer                - Buffer containing volume's label info.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Get the volume's label info successfully.
>-  EFI_BUFFER_TOO_SMALL  - The buffer is too small.
>-
>---*/
> {
>   UINTN                             Size;
>   UINTN                             NameSize;
>   UINTN                             ResultSize;
>   CHAR16                            Name[FAT_NAME_LEN + 1];
>@@ -185,36 +159,30 @@ Returns:
>
>   *BufferSize = ResultSize;
>   return Status;
> }
>
>+/**
>+
>+  Set the volume's info.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing the new volume info.
>+
>+  @retval EFI_SUCCESS           - Set the volume info successfully.
>+  @retval EFI_BAD_BUFFER_SIZE   - The buffer size is error.
>+  @retval EFI_WRITE_PROTECTED   - The volume is read only.
>+  @return other                 - An error occurred when operation the disk.
>+
>+**/
> EFI_STATUS
> FatSetVolumeInfo (
>   IN FAT_VOLUME       *Volume,
>   IN UINTN            BufferSize,
>   IN VOID             *Buffer
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Set the volume's info.
>-
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>-  BufferSize            - Size of Buffer.
>-  Buffer                - Buffer containing the new volume info.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Set the volume info successfully.
>-  EFI_BAD_BUFFER_SIZE   - The buffer size is error.
>-  EFI_WRITE_PROTECTED   - The volume is read only.
>-  other                 - An error occurred when operation the disk.
>-
>---*/
> {
>   EFI_FILE_SYSTEM_INFO  *Info;
>
>   Info = (EFI_FILE_SYSTEM_INFO *) Buffer;
>
>@@ -223,36 +191,30 @@ Returns:
>   }
>
>   return FatSetVolumeEntry (Volume, Info->VolumeLabel);
> }
>
>+/**
>+
>+  Set the volume's label info.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing the new volume label info.
>+
>+  @retval EFI_SUCCESS           - Set the volume label info successfully.
>+  @retval EFI_WRITE_PROTECTED   - The disk is write protected.
>+  @retval EFI_BAD_BUFFER_SIZE   - The buffer size is error.
>+  @return other                 - An error occurred when operation the disk.
>+
>+**/
> EFI_STATUS
> FatSetVolumeLabelInfo (
>   IN FAT_VOLUME       *Volume,
>   IN UINTN            BufferSize,
>   IN VOID             *Buffer
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Set the volume's label info
>-
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>-  BufferSize            - Size of Buffer.
>-  Buffer                - Buffer containing the new volume label info.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Set the volume label info successfully.
>-  EFI_WRITE_PROTECTED   - The disk is write protected.
>-  EFI_BAD_BUFFER_SIZE   - The buffer size is error.
>-  other                 - An error occurred when operation the disk.
>-
>---*/
> {
>   EFI_FILE_SYSTEM_VOLUME_LABEL *Info;
>
>   Info = (EFI_FILE_SYSTEM_VOLUME_LABEL *) Buffer;
>
>@@ -261,48 +223,42 @@ Returns:
>   }
>
>   return FatSetVolumeEntry (Volume, Info->VolumeLabel);
> }
>
>+/**
>+
>+  Set the file info.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  IFile                 - The instance of the open file.
>+  @param  OFile                 - The open file.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing the new file info.
>+
>+  @retval EFI_SUCCESS           - Set the file info successfully.
>+  @retval EFI_ACCESS_DENIED     - It is the root directory
>+                          or the directory attribute bit can not change
>+                          or try to change a directory size
>+                          or something else.
>+  @retval EFI_UNSUPPORTED       - The new file size is larger than 4GB.
>+  @retval EFI_WRITE_PROTECTED   - The disk is write protected.
>+  @retval EFI_BAD_BUFFER_SIZE   - The buffer size is error.
>+  @retval EFI_INVALID_PARAMETER - The time info or attributes info is error.
>+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate new memory.
>+  @retval EFI_VOLUME_CORRUPTED  - The volume is corrupted.
>+  @return other                 - An error occurred when operation the disk.
>+
>+**/
> EFI_STATUS
> FatSetFileInfo (
>   IN FAT_VOLUME       *Volume,
>   IN FAT_IFILE        *IFile,
>   IN FAT_OFILE        *OFile,
>   IN UINTN            BufferSize,
>   IN VOID             *Buffer
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Set the file info.
>-
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>-  IFile                 - The instance of the open file.
>-  OFile                 - The open file.
>-  BufferSize            - Size of Buffer.
>-  Buffer                - Buffer containing the new file info.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Set the file info successfully.
>-  EFI_ACCESS_DENIED     - It is the root directory
>-                          or the directory attribute bit can not change
>-                          or try to change a directory size
>-                          or something else.
>-  EFI_UNSUPPORTED       - The new file size is larger than 4GB.
>-  EFI_WRITE_PROTECTED   - The disk is write protected.
>-  EFI_BAD_BUFFER_SIZE   - The buffer size is error.
>-  EFI_INVALID_PARAMETER - The time info or attributes info is error.
>-  EFI_OUT_OF_RESOURCES  - Can not allocate new memory.
>-  EFI_VOLUME_CORRUPTED  - The volume is corrupted.
>-  other                 - An error occurred when operation the disk.
>-
>---*/
> {
>   EFI_STATUS    Status;
>   EFI_FILE_INFO *NewInfo;
>   FAT_OFILE     *DotOFile;
>   FAT_OFILE     *Parent;
>@@ -470,38 +426,32 @@ Returns:
>
>   OFile->Dirty = TRUE;
>   return FatOFileFlush (OFile);
> }
>
>+/**
>+
>+  Set or Get the some types info of the file into Buffer.
>+
>+  @param  IsSet      - TRUE:The access is set, else is get
>+  @param  FHand      - The handle of file
>+  @param  Type       - The type of the info
>+  @param  BufferSize - Size of Buffer
>+  @param  Buffer     - Buffer containing volume info
>+
>+  @retval EFI_SUCCESS       - Get the info successfully
>+  @retval EFI_DEVICE_ERROR  - Can not find the OFile for the file
>+
>+**/
> EFI_STATUS
> FatSetOrGetInfo (
>   IN     BOOLEAN            IsSet,
>   IN     EFI_FILE_PROTOCOL  *FHand,
>   IN     EFI_GUID           *Type,
>   IN OUT UINTN              *BufferSize,
>   IN OUT VOID               *Buffer
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Set or Get the some types info of the file into Buffer
>-
>-Arguments:
>-
>-  IsSet      - TRUE:The access is set, else is get
>-  FHand      - The handle of file
>-  Type       - The type of the info
>-  BufferSize - Size of Buffer
>-  Buffer     - Buffer containing volume info
>-
>-Returns:
>-
>-  EFI_SUCCESS       - Get the info successfully
>-  EFI_DEVICE_ERROR  - Can not find the OFile for the file
>-
>---*/
> {
>   FAT_IFILE   *IFile;
>   FAT_OFILE   *OFile;
>   FAT_VOLUME  *Volume;
>   EFI_STATUS  Status;
>@@ -558,66 +508,54 @@ Returns:
>
>   FatReleaseLock ();
>   return Status;
> }
>
>+/**
>+
>+  Get the some types info of the file into Buffer.
>+
>+  @param  FHand                 - The handle of file.
>+  @param  Type                  - The type of the info.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing volume info.
>+
>+  @retval EFI_SUCCESS           - Get the info successfully.
>+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>+
>+**/
> EFI_STATUS
> EFIAPI
> FatGetInfo (
>   IN     EFI_FILE_PROTOCOL   *FHand,
>   IN     EFI_GUID            *Type,
>   IN OUT UINTN               *BufferSize,
>      OUT VOID                *Buffer
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get the some types info of the file into Buffer.
>-
>-Arguments:
>+{
>+  return FatSetOrGetInfo (FALSE, FHand, Type, BufferSize, Buffer);
>+}
>
>-  FHand                 - The handle of file.
>-  Type                  - The type of the info.
>-  BufferSize            - Size of Buffer.
>-  Buffer                - Buffer containing volume info.
>+/**
>
>-Returns:
>+  Set the some types info of the file into Buffer.
>
>-  EFI_SUCCESS           - Get the info successfully.
>-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>+  @param  FHand                 - The handle of file.
>+  @param  Type                  - The type of the info.
>+  @param  BufferSize            - Size of Buffer
>+  @param  Buffer                - Buffer containing volume info.
>
>---*/
>-{
>-  return FatSetOrGetInfo (FALSE, FHand, Type, BufferSize, Buffer);
>-}
>+  @retval EFI_SUCCESS           - Set the info successfully.
>+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>
>+**/
> EFI_STATUS
> EFIAPI
> FatSetInfo (
>   IN EFI_FILE_PROTOCOL  *FHand,
>   IN EFI_GUID           *Type,
>   IN UINTN              BufferSize,
>   IN VOID               *Buffer
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Set the some types info of the file into Buffer.
>-
>-Arguments:
>-
>-  FHand                 - The handle of file.
>-  Type                  - The type of the info.
>-  BufferSize            - Size of Buffer
>-  Buffer                - Buffer containing volume info.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Set the info successfully.
>-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>-
>---*/
> {
>   return FatSetOrGetInfo (TRUE, FHand, Type, &BufferSize, Buffer);
> }
>diff --git a/FatPkg/EnhancedFatDxe/Init.c b/FatPkg/EnhancedFatDxe/Init.c
>index d7cfa82..6febffc 100644
>--- a/FatPkg/EnhancedFatDxe/Init.c
>+++ b/FatPkg/EnhancedFatDxe/Init.c
>@@ -1,56 +1,43 @@
>-/*++
>+/** @file
>+  Initialization routines.
>
> Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
> http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>+**/
>
>-Module Name:
>-
>-  Init.c
>+#include "Fat.h"
>
>-Abstract:
>+/**
>
>-  Initialization routines
>+  Allocates volume structure, detects FAT file system, installs protocol,
>+  and initialize cache.
>
>---*/
>+  @param  Handle                - The handle of parent device.
>+  @param  DiskIo                - The DiskIo of parent device.
>+  @param  DiskIo2               - The DiskIo2 of parent device.
>+  @param  BlockIo               - The BlockIo of parent devicel
>
>-#include "Fat.h"
>+  @retval EFI_SUCCESS           - Allocate a new volume successfully.
>+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
>+  @return Others                - Allocating a new volume failed.
>
>+**/
> EFI_STATUS
> FatAllocateVolume (
>   IN  EFI_HANDLE                Handle,
>   IN  EFI_DISK_IO_PROTOCOL      *DiskIo,
>   IN  EFI_DISK_IO2_PROTOCOL     *DiskIo2,
>   IN  EFI_BLOCK_IO_PROTOCOL     *BlockIo
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Allocates volume structure, detects FAT file system, installs protocol,
>-  and initialize cache.
>-
>-Arguments:
>-
>-  Handle                - The handle of parent device.
>-  DiskIo                - The DiskIo of parent device.
>-  BlockIo               - The BlockIo of parent devicel
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Allocate a new volume successfully.
>-  EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
>-  Others                - Allocating a new volume failed.
>-
>---*/
> {
>   EFI_STATUS  Status;
>   FAT_VOLUME  *Volume;
>
>   //
>@@ -118,30 +105,24 @@ Done:
>   }
>
>   return Status;
> }
>
>-EFI_STATUS
>-FatAbandonVolume (
>-  IN FAT_VOLUME *Volume
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Called by FatDriverBindingStop(), Abandon the volume.
>
>-Arguments:
>-
>-  Volume                - The volume to be abandoned.
>-
>-Returns:
>+  @param  Volume                - The volume to be abandoned.
>
>-  EFI_SUCCESS           - Abandoned the volume successfully.
>-  Others                - Can not uninstall the protocol interfaces.
>+  @retval EFI_SUCCESS           - Abandoned the volume successfully.
>+  @return Others                - Can not uninstall the protocol interfaces.
>
>---*/
>+**/
>+EFI_STATUS
>+FatAbandonVolume (
>+  IN FAT_VOLUME *Volume
>+  )
> {
>   EFI_STATUS  Status;
>   BOOLEAN     LockedByMe;
>
>   //
>@@ -200,31 +181,25 @@ Returns:
>   }
>
>   return EFI_SUCCESS;
> }
>
>-EFI_STATUS
>-FatOpenDevice (
>-  IN OUT FAT_VOLUME           *Volume
>-  )
>-/*++
>-
>-Routine Description:
>-
>-  Detects FAT file system on Disk and set relevant fields of Volume
>-
>-Arguments:
>+/**
>
>-  Volume                - The volume structure.
>+  Detects FAT file system on Disk and set relevant fields of Volume.
>
>-Returns:
>+  @param Volume                - The volume structure.
>
>-  EFI_SUCCESS           - The Fat File System is detected successfully
>-  EFI_UNSUPPORTED       - The volume is not FAT file system.
>-  EFI_VOLUME_CORRUPTED  - The volume is corrupted.
>+  @retval EFI_SUCCESS           - The Fat File System is detected successfully
>+  @retval EFI_UNSUPPORTED       - The volume is not FAT file system.
>+  @retval EFI_VOLUME_CORRUPTED  - The volume is corrupted.
>
>---*/
>+**/
>+EFI_STATUS
>+FatOpenDevice (
>+  IN OUT FAT_VOLUME           *Volume
>+  )
> {
>   EFI_STATUS            Status;
>   UINT32                BlockSize;
>   UINT32                DirtyMask;
>   EFI_DISK_IO_PROTOCOL  *DiskIo;
>diff --git a/FatPkg/EnhancedFatDxe/Misc.c b/FatPkg/EnhancedFatDxe/Misc.c
>index 48c99f9..c36bdb8 100644
>--- a/FatPkg/EnhancedFatDxe/Misc.c
>+++ b/FatPkg/EnhancedFatDxe/Misc.c
>@@ -1,6 +1,7 @@
>-/*++
>+/** @file
>+  Miscellaneous functions.
>
> Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
>@@ -8,43 +9,29 @@ http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>
>-Module Name:
>-
>-  Misc.c
>+**/
>
>-Abstract:
>+#include "Fat.h"
>
>-  Miscellaneous functions
>+/**
>
>-Revision History
>+  Create the task
>
>---*/
>+  @param  IFile                 - The instance of the open file.
>+  @param  Token                 - A pointer to the token associated with the transaction.
>
>-#include "Fat.h"
>+  @return FAT_TASK *            - Return the task instance.
>
>+**/
> FAT_TASK *
> FatCreateTask (
>   FAT_IFILE           *IFile,
>   EFI_FILE_IO_TOKEN   *Token
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Create the task
>-
>-Arguments:
>-
>-  IFile                 - The instance of the open file.
>-  Token                 - A pointer to the token associated with the transaction.
>-
>-Return:
>-  FAT_TASK *            - Return the task instance.
>-**/
> {
>   FAT_TASK            *Task;
>
>   Task = AllocateZeroPool (sizeof (*Task));
>   if (Task != NULL) {
>@@ -55,24 +42,21 @@ Return:
>     InitializeListHead (&Task->Link);
>   }
>   return Task;
> }
>
>-VOID
>-FatDestroyTask (
>-  FAT_TASK            *Task
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>-  Destroy the task
>+  Destroy the task.
>
>-Arguments:
>+  @param  Task                  - The task to be destroyed.
>
>-  Task                  - The task to be destroyed.
> **/
>+VOID
>+FatDestroyTask (
>+  FAT_TASK            *Task
>+  )
> {
>   LIST_ENTRY          *Link;
>   FAT_SUBTASK         *Subtask;
>
>   Link = GetFirstNode (&Task->Subtasks);
>@@ -81,53 +65,44 @@ Arguments:
>     Link = FatDestroySubtask (Subtask);
>   }
>   FreePool (Task);
> }
>
>-VOID
>-FatWaitNonblockingTask (
>-  FAT_IFILE           *IFile
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Wait all non-blocking requests complete.
>
>-Arguments:
>+  @param  IFile                 - The instance of the open file.
>
>-  IFile                 - The instance of the open file.
> **/
>+VOID
>+FatWaitNonblockingTask (
>+  FAT_IFILE           *IFile
>+  )
> {
>   BOOLEAN             TaskQueueEmpty;
>
>   do {
>     EfiAcquireLock (&FatTaskLock);
>     TaskQueueEmpty = IsListEmpty (&IFile->Tasks);
>     EfiReleaseLock (&FatTaskLock);
>   } while (!TaskQueueEmpty);
> }
>
>-LIST_ENTRY *
>-FatDestroySubtask (
>-  FAT_SUBTASK         *Subtask
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Remove the subtask from subtask list.
>
>-Arguments:
>-
>-  Subtask               - The subtask to be removed.
>+  @param  Subtask               - The subtask to be removed.
>
>-Returns:
>+  @return LIST_ENTRY *          - The next node in the list.
>
>-  LIST_ENTRY *          - The next node in the list.
>-
>---*/
>+**/
>+LIST_ENTRY *
>+FatDestroySubtask (
>+  FAT_SUBTASK         *Subtask
>+  )
> {
>   LIST_ENTRY          *Link;
>
>   gBS->CloseEvent (Subtask->DiskIo2Token.Event);
>
>@@ -135,32 +110,26 @@ Returns:
>   FreePool (Subtask);
>
>   return Link;
> }
>
>+/**
>+
>+  Execute the task.
>+
>+  @param  IFile                 - The instance of the open file.
>+  @param  Task                  - The task to be executed.
>+
>+  @retval EFI_SUCCESS           - The task was executed sucessfully.
>+  @return other                 - An error occurred when executing the task.
>+
>+**/
> EFI_STATUS
> FatQueueTask (
>   IN FAT_IFILE        *IFile,
>   IN FAT_TASK         *Task
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Execute the task
>-
>-Arguments:
>-
>-  IFile                 - The instance of the open file.
>-  Task                  - The task to be executed.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - The task was executed sucessfully.
>-  other                 - An error occurred when executing the task.
>-
>---*/
> {
>   EFI_STATUS          Status;
>   LIST_ENTRY          *Link;
>   FAT_SUBTASK         *Subtask;
>
>@@ -236,43 +205,37 @@ Returns:
>   }
>
>   return Status;
> }
>
>+/**
>+
>+  Set the volume as dirty or not.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  IoMode                - The access mode.
>+  @param  DirtyValue            - Set the volume as dirty or not.
>+
>+  @retval EFI_SUCCESS           - Set the new FAT entry value sucessfully.
>+  @return other                 - An error occurred when operation the FAT entries.
>+
>+**/
> EFI_STATUS
> FatAccessVolumeDirty (
>   IN FAT_VOLUME       *Volume,
>   IN IO_MODE          IoMode,
>   IN VOID             *DirtyValue
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Set the volume as dirty or not
>-
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>-  IoMode                - The access mode.
>-  DirtyValue            - Set the volume as dirty or not.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Set the new FAT entry value sucessfully.
>-  other                 - An error occurred when operation the FAT entries.
>-
>---*/
> {
>   UINTN WriteCount;
>
>   WriteCount = Volume->FatEntrySize;
>   return FatDiskIo (Volume, IoMode, Volume->FatPos + WriteCount, WriteCount, DirtyValue, NULL);
> }
>
> /**
>-  Invoke a notification event
>+  Invoke a notification event.
>
>   @param  Event                 Event whose notification function is being invoked.
>   @param  Context               The pointer to the notification function's context,
>                                 which is implementation-dependent.
>
>@@ -281,26 +244,10 @@ VOID
> EFIAPI
> FatOnAccessComplete (
>   IN  EFI_EVENT                Event,
>   IN  VOID                     *Context
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Invoke a notification event
>-  case #1. some subtasks are not completed when the FatOpenEx checks the Task->Subtasks
>-           - sets Task->SubtaskCollected so callback to signal the event and free the task.
>-  case #2. all subtasks are completed when the FatOpenEx checks the Task->Subtasks
>-           - FatOpenEx signal the event and free the task.
>-Arguments:
>-
>-  Event                 - Event whose notification function is being invoked.
>-  Context               - The pointer to the notification function's context,
>-                          which is implementation-dependent.
>-
>---*/
> {
>   EFI_STATUS             Status;
>   FAT_SUBTASK            *Subtask;
>   FAT_TASK               *Task;
>
>@@ -339,40 +286,35 @@ Arguments:
>     RemoveEntryList (&Task->Link);
>     FreePool (Task);
>   }
> }
>
>+/**
>+
>+  General disk access function.
>+
>+  @param  Volume                - FAT file system volume.
>+  @param  IoMode                - The access mode (disk read/write or cache access).
>+  @param  Offset                - The starting byte offset to read from.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing read data.
>+  @param  Task                    point to task instance.
>+
>+  @retval EFI_SUCCESS           - The operation is performed successfully.
>+  @retval EFI_VOLUME_CORRUPTED  - The accesss is
>+  @return Others                - The status of read/write the disk
>+
>+**/
> EFI_STATUS
> FatDiskIo (
>   IN     FAT_VOLUME       *Volume,
>   IN     IO_MODE          IoMode,
>   IN     UINT64           Offset,
>   IN     UINTN            BufferSize,
>   IN OUT VOID             *Buffer,
>   IN     FAT_TASK         *Task
>   )
>-/*++
>-
>-Routine Description:
>-
>-  General disk access function
>-
>-Arguments:
>-
>-  Volume                - FAT file system volume.
>-  IoMode                - The access mode (disk read/write or cache access).
>-  Offset                - The starting byte offset to read from.
>-  BufferSize            - Size of Buffer.
>-  Buffer                - Buffer containing read data.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - The operation is performed successfully.
>-  EFI_VOLUME_CORRUPTED  - The accesss is
>-  Others                - The status of read/write the disk
>-
>---*/
> {
>   EFI_STATUS            Status;
>   EFI_DISK_IO_PROTOCOL  *DiskIo;
>   EFI_DISK_READ         IoFunction;
>   FAT_SUBTASK           *Subtask;
>@@ -435,128 +377,84 @@ Returns:
>   }
>
>   return Status;
> }
>
>+/**
>+
>+  Lock the volume.
>+
>+**/
> VOID
> FatAcquireLock (
>   VOID
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Lock the volume.
>-
>-Arguments:
>-
>-  None.
>-
>-Returns:
>-
>-  None.
>-
>---*/
> {
>   EfiAcquireLock (&FatFsLock);
> }
>
>-EFI_STATUS
>-FatAcquireLockOrFail (
>-  VOID
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Lock the volume.
>   If the lock is already in the acquired state, then EFI_ACCESS_DENIED is returned.
>   Otherwise, EFI_SUCCESS is returned.
>
>-Arguments:
>-
>-  None.
>-
>-Returns:
>+  @retval EFI_SUCCESS           - The volume is locked.
>+  @retval EFI_ACCESS_DENIED     - The volume could not be locked because it is already locked.
>
>-  EFI_SUCCESS           - The volume is locked.
>-  EFI_ACCESS_DENIED     - The volume could not be locked because it is already locked.
>-
>---*/
>+**/
>+EFI_STATUS
>+FatAcquireLockOrFail (
>+  VOID
>+  )
> {
>   return EfiAcquireLockOrFail (&FatFsLock);
> }
>
>+/**
>+
>+  Unlock the volume.
>+
>+**/
> VOID
> FatReleaseLock (
>   VOID
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Unlock the volume.
>-
>-Arguments:
>-
>-  Null.
>-
>-Returns:
>-
>-  None.
>-
>---*/
> {
>   EfiReleaseLock (&FatFsLock);
> }
>
>-VOID
>-FatFreeDirEnt (
>-  IN FAT_DIRENT       *DirEnt
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Free directory entry.
>
>-Arguments:
>-
>-  DirEnt                - The directory entry to be freed.
>-
>-Returns:
>+  @param  DirEnt                - The directory entry to be freed.
>
>-  None.
>-
>---*/
>+**/
>+VOID
>+FatFreeDirEnt (
>+  IN FAT_DIRENT       *DirEnt
>+  )
> {
>   if (DirEnt->FileString != NULL) {
>     FreePool (DirEnt->FileString);
>   }
>
>   FreePool (DirEnt);
> }
>
>-VOID
>-FatFreeVolume (
>-  IN FAT_VOLUME       *Volume
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Free volume structure (including the contents of directory cache and disk cache).
>
>-Arguments:
>-
>-  Volume                - The volume structure to be freed.
>+  @param  Volume                - The volume structure to be freed.
>
>-Returns:
>-
>-  None.
>-
>---*/
>+**/
>+VOID
>+FatFreeVolume (
>+  IN FAT_VOLUME       *Volume
>+  )
> {
>   //
>   // Free disk cache
>   //
>   if (Volume->CacheBuffer != NULL) {
>@@ -567,31 +465,23 @@ Returns:
>   //
>   FatCleanupODirCache (Volume);
>   FreePool (Volume);
> }
>
>+/**
>+
>+  Translate EFI time to FAT time.
>+
>+  @param  ETime                 - The time of EFI_TIME.
>+  @param  FTime                 - The time of FAT_DATE_TIME.
>+
>+**/
> VOID
> FatEfiTimeToFatTime (
>   IN  EFI_TIME        *ETime,
>   OUT FAT_DATE_TIME   *FTime
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Translate EFI time to FAT time.
>-
>-Arguments:
>-
>-  ETime                 - The time of EFI_TIME.
>-  FTime                 - The time of FAT_DATE_TIME.
>-
>-Returns:
>-
>-  None.
>-
>---*/
> {
>   //
>   // ignores timezone info in source ETime
>   //
>   if (ETime->Year > 1980) {
>@@ -607,31 +497,23 @@ Returns:
>   FTime->Time.Hour          = ETime->Hour;
>   FTime->Time.Minute        = ETime->Minute;
>   FTime->Time.DoubleSecond  = (UINT16) (ETime->Second / 2);
> }
>
>+/**
>+
>+  Translate Fat time to EFI time.
>+
>+  @param  FTime                 - The time of FAT_DATE_TIME.
>+  @param  ETime                 - The time of EFI_TIME..
>+
>+**/
> VOID
> FatFatTimeToEfiTime (
>   IN  FAT_DATE_TIME     *FTime,
>   OUT EFI_TIME          *ETime
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Translate Fat time to EFI time.
>-
>-Arguments:
>-
>-  FTime                 - The time of FAT_DATE_TIME.
>-  ETime                 - The time of EFI_TIME.
>-
>-Returns:
>-
>-  None.
>-
>---*/
> {
>   ETime->Year       = (UINT16) (FTime->Date.Year + 1980);
>   ETime->Month      = (UINT8) FTime->Date.Month;
>   ETime->Day        = (UINT8) FTime->Date.Day;
>   ETime->Hour       = (UINT8) FTime->Time.Hour;
>@@ -640,29 +522,21 @@ Returns:
>   ETime->Nanosecond = 0;
>   ETime->TimeZone   = EFI_UNSPECIFIED_TIMEZONE;
>   ETime->Daylight   = 0;
> }
>
>-VOID
>-FatGetCurrentFatTime (
>-  OUT FAT_DATE_TIME   *FatNow
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Get Current FAT time.
>
>-Arguments:
>-
>-  FatNow                - Current FAT time.
>-
>-Returns:
>+  @param  FatNow                - Current FAT time.
>
>-  None.
>-
>---*/
>+**/
>+VOID
>+FatGetCurrentFatTime (
>+  OUT FAT_DATE_TIME   *FatNow
>+  )
> {
>   EFI_STATUS Status;
>   EFI_TIME   Now;
>
>   Status = gRT->GetTime (&Now, NULL);
>@@ -675,30 +549,24 @@ Returns:
>     Now.Day = 1;
>     FatEfiTimeToFatTime (&Now, FatNow);
>   }
> }
>
>-BOOLEAN
>-FatIsValidTime (
>-  IN EFI_TIME         *Time
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Check whether a time is valid.
>
>-Arguments:
>-
>-  Time                  - The time of EFI_TIME.
>+  @param  Time                  - The time of EFI_TIME.
>
>-Returns:
>+  @retval TRUE                  - The time is valid.
>+  @retval FALSE                 - The time is not valid.
>
>-  TRUE                  - The time is valid.
>-  FALSE                 - The time is not valid.
>-
>---*/
>+**/
>+BOOLEAN
>+FatIsValidTime (
>+  IN EFI_TIME         *Time
>+  )
> {
>   STATIC UINT8  MonthDays[12];
>   UINTN         Day;
>   BOOLEAN       ValidTime;
>
>diff --git a/FatPkg/EnhancedFatDxe/Open.c b/FatPkg/EnhancedFatDxe/Open.c
>index 1d864d1..7b273fe 100644
>--- a/FatPkg/EnhancedFatDxe/Open.c
>+++ b/FatPkg/EnhancedFatDxe/Open.c
>@@ -1,54 +1,38 @@
>-/*++
>+/** @file
>+  Routines dealing with file open.
>
> Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
> http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>+**/
>
>-Module Name:
>-
>-  open.c
>+#include "Fat.h"
>
>-Abstract:
>+/**
>
>-  Routines dealing with file open
>+  Create an Open instance for the existing OFile.
>+  The IFile of the newly opened file is passed out.
>
>-Revision History
>+  @param  OFile                 - The file that serves as a starting reference point.
>+  @param  PtrIFile              - The newly generated IFile instance.
>
>---*/
>-
>-#include "Fat.h"
>+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory for the IFile
>+  @retval EFI_SUCCESS           - Create the new IFile for the OFile successfully
>
>+**/
> EFI_STATUS
> FatAllocateIFile (
>   IN FAT_OFILE    *OFile,
>   OUT FAT_IFILE   **PtrIFile
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Create an Open instance for the existing OFile.
>-  The IFile of the newly opened file is passed out.
>-
>-Arguments:
>-
>-  OFile                 - The file that serves as a starting reference point.
>-  PtrIFile              - The newly generated IFile instance.
>-
>-Returns:
>-
>-  EFI_OUT_OF_RESOURCES  - Can not allocate the memory for the IFile
>-  EFI_SUCCESS           - Create the new IFile for the OFile successfully
>-
>---*/
> {
>   FAT_IFILE *IFile;
>
>   ASSERT_VOLUME_LOCKED (OFile->Volume);
>
>@@ -79,45 +63,40 @@ Returns:
>
>   *PtrIFile = IFile;
>   return EFI_SUCCESS;
> }
>
>-EFI_STATUS
>-FatOFileOpen (
>-  IN  FAT_OFILE            *OFile,
>-  OUT FAT_IFILE            **NewIFile,
>-  IN  CHAR16               *FileName,
>-  IN  UINT64               OpenMode,
>-  IN  UINT8                Attributes
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Open a file for a file name relative to an existing OFile.
>   The IFile of the newly opened file is passed out.
>
>-Arguments:
>-
>-  OFile                 - The file that serves as a starting reference point.
>-  NewIFile              - The newly generated IFile instance.
>-  FileName              - The file name relative to the OFile.
>-  OpenMode              - Open mode.
>-  Attributes            - Attributes to set if the file is created.
>+  @param  OFile                 - The file that serves as a starting reference point.
>+  @param  NewIFile              - The newly generated IFile instance.
>+  @param  FileName              - The file name relative to the OFile.
>+  @param  OpenMode              - Open mode.
>+  @param  Attributes            - Attributes to set if the file is created.
>
>-Returns:
>
>-  EFI_SUCCESS           - Open the file successfully.
>-  EFI_INVALID_PARAMETER - The open mode is conflict with the attributes
>+  @retval EFI_SUCCESS           - Open the file successfully.
>+  @retval EFI_INVALID_PARAMETER - The open mode is conflict with the attributes
>                           or the file name is not valid.
>-  EFI_NOT_FOUND         - Conficts between dir intention and attribute.
>-  EFI_WRITE_PROTECTED   - Can't open for write if the volume is read only.
>-  EFI_ACCESS_DENIED     - If the file's attribute is read only, and the
>+  @retval EFI_NOT_FOUND         - Conficts between dir intention and attribute.
>+  @retval EFI_WRITE_PROTECTED   - Can't open for write if the volume is read only.
>+  @retval EFI_ACCESS_DENIED     - If the file's attribute is read only, and the
>                           open is for read-write fail it.
>-  EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
>+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
>
>---*/
>+**/
>+EFI_STATUS
>+FatOFileOpen (
>+  IN  FAT_OFILE            *OFile,
>+  OUT FAT_IFILE            **NewIFile,
>+  IN  CHAR16               *FileName,
>+  IN  UINT64               OpenMode,
>+  IN  UINT8                Attributes
>+  )
> {
>   FAT_VOLUME  *Volume;
>   EFI_STATUS  Status;
>   CHAR16      NewFileName[EFI_PATH_STRING_LENGTH];
>   FAT_DIRENT  *DirEnt;
>@@ -197,44 +176,39 @@ Returns:
>
>   DEBUG ((EFI_D_INFO, "FSOpen: Open '%S' %r\n", FileName, Status));
>   return FatOFileFlush (OFile);
> }
>
>+/**
>+
>+  Implements OpenEx() of Simple File System Protocol.
>+
>+  @param  FHand                 - File handle of the file serves as a starting reference point.
>+  @param  NewHandle             - Handle of the file that is newly opened.
>+  @param  FileName              - File name relative to FHand.
>+  @param  OpenMode              - Open mode.
>+  @param  Attributes            - Attributes to set if the file is created.
>+  @param  Token                 - A pointer to the token associated with the transaction.:
>+
>+  @retval EFI_INVALID_PARAMETER - The FileName is NULL or the file string is empty.
>+                          The OpenMode is not supported.
>+                          The Attributes is not the valid attributes.
>+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory for file string.
>+  @retval EFI_SUCCESS           - Open the file successfully.
>+  @return Others                - The status of open file.
>+
>+**/
> EFI_STATUS
> EFIAPI
> FatOpenEx (
>   IN  EFI_FILE_PROTOCOL       *FHand,
>   OUT EFI_FILE_PROTOCOL       **NewHandle,
>   IN  CHAR16                  *FileName,
>   IN  UINT64                  OpenMode,
>   IN  UINT64                  Attributes,
>   IN OUT EFI_FILE_IO_TOKEN    *Token
>   )
>-/*++
>-Routine Description:
>-
>-  Implements OpenEx() of Simple File System Protocol.
>-
>-Arguments:
>-
>-  FHand                 - File handle of the file serves as a starting reference point.
>-  NewHandle             - Handle of the file that is newly opened.
>-  FileName              - File name relative to FHand.
>-  OpenMode              - Open mode.
>-  Attributes            - Attributes to set if the file is created.
>-  Token                 - A pointer to the token associated with the transaction.
>-
>-Returns:
>-
>-  EFI_INVALID_PARAMETER - The FileName is NULL or the file string is empty.
>-                          The OpenMode is not supported.
>-                          The Attributes is not the valid attributes.
>-  EFI_OUT_OF_RESOURCES  - Can not allocate the memory for file string.
>-  EFI_SUCCESS           - Open the file successfully.
>-  Others                - The status of open file.
>-
>---*/
> {
>   FAT_IFILE   *IFile;
>   FAT_IFILE   *NewIFile;
>   FAT_OFILE   *OFile;
>   EFI_STATUS  Status;
>@@ -317,40 +291,36 @@ Returns:
>   }
>
>   return Status;
> }
>
>+/**
>+
>+  Implements Open() of Simple File System Protocol.
>+
>+
>+  @param   FHand                 - File handle of the file serves as a starting reference point.
>+  @param   NewHandle             - Handle of the file that is newly opened.
>+  @param   FileName              - File name relative to FHand.
>+  @param   OpenMode              - Open mode.
>+  @param   Attributes            - Attributes to set if the file is created.
>+
>+  @retval EFI_INVALID_PARAMETER - The FileName is NULL or the file string is empty.
>+                          The OpenMode is not supported.
>+                          The Attributes is not the valid attributes.
>+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory for file string.
>+  @retval EFI_SUCCESS           - Open the file successfully.
>+  @return Others                - The status of open file.
>+
>+**/
> EFI_STATUS
> EFIAPI
> FatOpen (
>   IN  EFI_FILE_PROTOCOL   *FHand,
>   OUT EFI_FILE_PROTOCOL   **NewHandle,
>   IN  CHAR16              *FileName,
>   IN  UINT64              OpenMode,
>   IN  UINT64              Attributes
>   )
>-/*++
>-Routine Description:
>-
>-  Implements Open() of Simple File System Protocol.
>-
>-Arguments:
>-
>-  FHand                 - File handle of the file serves as a starting reference point.
>-  NewHandle             - Handle of the file that is newly opened.
>-  FileName              - File name relative to FHand.
>-  OpenMode              - Open mode.
>-  Attributes            - Attributes to set if the file is created.
>-
>-Returns:
>-
>-  EFI_INVALID_PARAMETER - The FileName is NULL or the file string is empty.
>-                          The OpenMode is not supported.
>-                          The Attributes is not the valid attributes.
>-  EFI_OUT_OF_RESOURCES  - Can not allocate the memory for file string.
>-  EFI_SUCCESS           - Open the file successfully.
>-  Others                - The status of open file.
>-
>---*/
> {
>   return FatOpenEx (FHand, NewHandle, FileName, OpenMode, Attributes, NULL);
> }
>diff --git a/FatPkg/EnhancedFatDxe/OpenVolume.c b/FatPkg/EnhancedFatDxe/OpenVolume.c
>index 0f43ffa..4e12db3 100644
>--- a/FatPkg/EnhancedFatDxe/OpenVolume.c
>+++ b/FatPkg/EnhancedFatDxe/OpenVolume.c
>@@ -1,55 +1,39 @@
>-/*++
>+/** @file
>+  OpenVolume() function of Simple File System Protocol.
>
> Copyright (c) 2005 - 2013, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
> http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>+**/
>
>-Module Name:
>-
>-  OpenVolume.c
>+#include "Fat.h"
>
>-Abstract:
>+/**
>
>-  OpenVolume() function of Simple File System Protocol
>+  Implements Simple File System Protocol interface function OpenVolume().
>
>-Revision History
>+  @param  This                  - Calling context.
>+  @param  File                  - the Root Directory of the volume.
>
>---*/
>-
>-#include "Fat.h"
>+  @retval EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
>+  @retval EFI_VOLUME_CORRUPTED  - The FAT type is error.
>+  @retval EFI_SUCCESS           - Open the volume successfully.
>
>+**/
> EFI_STATUS
> EFIAPI
> FatOpenVolume (
>   IN  EFI_SIMPLE_FILE_SYSTEM_PROTOCOL  *This,
>   OUT EFI_FILE_PROTOCOL                **File
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Implements Simple File System Protocol interface function OpenVolume().
>-
>-Arguments:
>-
>-  This                  - Calling context.
>-  File                  - the Root Directory of the volume.
>-
>-Returns:
>-
>-  EFI_OUT_OF_RESOURCES  - Can not allocate the memory.
>-  EFI_VOLUME_CORRUPTED  - The FAT type is error.
>-  EFI_SUCCESS           - Open the volume successfully.
>-
>---*/
> {
>   EFI_STATUS  Status;
>   FAT_VOLUME  *Volume;
>   FAT_IFILE   *IFile;
>
>diff --git a/FatPkg/EnhancedFatDxe/ReadWrite.c b/FatPkg/EnhancedFatDxe/ReadWrite.c
>index 81676cd..a6e0ec4 100644
>--- a/FatPkg/EnhancedFatDxe/ReadWrite.c
>+++ b/FatPkg/EnhancedFatDxe/ReadWrite.c
>@@ -1,6 +1,7 @@
>-/*++
>+/** @file
>+  Functions that perform file read/write.
>
> Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.<BR>
> This program and the accompanying materials are licensed and made available
> under the terms and conditions of the BSD License which accompanies this
> distribution. The full text of the license may be found at
>@@ -8,48 +9,33 @@ http://opensource.org/licenses/bsd-license.php
>
> THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
> WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
>
>
>-Module Name:
>+**/
>
>-  ReadWrite.c
>+#include "Fat.h"
>
>-Abstract:
>+/**
>
>-  Functions that perform file read/write
>+  Get the file's position of the file.
>
>-Revision History
>
>---*/
>+  @param  FHand                 - The handle of file.
>+  @param  Position              - The file's position of the file.
>
>-#include "Fat.h"
>+  @retval EFI_SUCCESS           - Get the info successfully.
>+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>+  @retval EFI_UNSUPPORTED       - The open file is not a file.
>
>+**/
> EFI_STATUS
> EFIAPI
> FatGetPosition (
>   IN  EFI_FILE_PROTOCOL *FHand,
>   OUT UINT64            *Position
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get the file's position of the file.
>-
>-Arguments:
>-
>-  FHand                 - The handle of file.
>-  Position              - The file's position of the file.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Get the info successfully.
>-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>-  EFI_UNSUPPORTED       - The open file is not a file.
>-
>---*/
> {
>   FAT_IFILE *IFile;
>   FAT_OFILE *OFile;
>
>   IFile = IFILE_FROM_FHAND (FHand);
>@@ -65,34 +51,28 @@ Returns:
>
>   *Position = IFile->Position;
>   return EFI_SUCCESS;
> }
>
>+/**
>+
>+  Set the file's position of the file.
>+
>+  @param  FHand                 - The handle of file.
>+  @param  Position              - The file's position of the file.
>+
>+  @retval EFI_SUCCESS           - Set the info successfully.
>+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>+  @retval EFI_UNSUPPORTED       - Set a directory with a not-zero position.
>+
>+**/
> EFI_STATUS
> EFIAPI
> FatSetPosition (
>   IN EFI_FILE_PROTOCOL  *FHand,
>   IN UINT64             Position
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Set the file's position of the file.
>-
>-Arguments:
>-
>-  FHand                 - The handle of file.
>-  Position              - The file's position of the file.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Set the info successfully.
>-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>-  EFI_UNSUPPORTED       - Set a directory with a not-zero position.
>-
>---*/
> {
>   FAT_IFILE *IFile;
>   FAT_OFILE *OFile;
>
>   IFile = IFILE_FROM_FHAND (FHand);
>@@ -128,34 +108,28 @@ Returns:
>   //
>   IFile->Position = Position;
>   return EFI_SUCCESS;
> }
>
>+/**
>+
>+  Get the file info from the open file of the IFile into Buffer.
>+
>+  @param  IFile                 - The instance of the open file.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing read data.
>+
>+  @retval EFI_SUCCESS           - Get the file info successfully.
>+  @retval other                 - An error occurred when operation the disk.
>+
>+**/
> EFI_STATUS
> FatIFileReadDir (
>   IN     FAT_IFILE              *IFile,
>   IN OUT UINTN                  *BufferSize,
>      OUT VOID                   *Buffer
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get the file info from the open file of the IFile into Buffer.
>-
>-Arguments:
>-
>-  IFile                 - The instance of the open file.
>-  BufferSize            - Size of Buffer.
>-  Buffer                - Buffer containing read data.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Get the file info successfully.
>-  other                 - An error occurred when operation the disk.
>-
>---*/
> {
>   EFI_STATUS  Status;
>   FAT_OFILE   *OFile;
>   FAT_ODIR    *ODir;
>   FAT_DIRENT  *DirEnt;
>@@ -203,42 +177,36 @@ Done:
>   }
>
>   return Status;
> }
>
>+/**
>+
>+  Get the file info from the open file of the IFile into Buffer.
>+
>+  @param FHand                 - The file handle to access.
>+  @param  IoMode                - Indicate whether the access mode is reading or writing.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing read data.
>+  @param  Token                 - A pointer to the token associated with the transaction.
>+
>+  @retval EFI_SUCCESS           - Get the file info successfully.
>+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>+  @retval EFI_VOLUME_CORRUPTED  - The file type of open file is error.
>+  @retval EFI_WRITE_PROTECTED   - The disk is write protect.
>+  @retval EFI_ACCESS_DENIED     - The file is read-only.
>+  @return other                 - An error occurred when operating on the disk.
>+
>+**/
> EFI_STATUS
> FatIFileAccess (
>   IN     EFI_FILE_PROTOCOL     *FHand,
>   IN     IO_MODE               IoMode,
>   IN OUT UINTN                 *BufferSize,
>   IN OUT VOID                  *Buffer,
>   IN     EFI_FILE_IO_TOKEN     *Token
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get the file info from the open file of the IFile into Buffer.
>-
>-Arguments:
>-
>-  FHand                 - The file handle to access.
>-  IoMode                - Indicate whether the access mode is reading or writing.
>-  BufferSize            - Size of Buffer.
>-  Buffer                - Buffer containing read data.
>-  Token                 - A pointer to the token associated with the transaction.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Get the file info successfully.
>-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>-  EFI_VOLUME_CORRUPTED  - The file type of open file is error.
>-  EFI_WRITE_PROTECTED   - The disk is write protect.
>-  EFI_ACCESS_DENIED     - The file is read-only.
>-  other                 - An error occurred when operating on the disk.
>-
>---*/
> {
>   EFI_STATUS  Status;
>   FAT_IFILE   *IFile;
>   FAT_OFILE   *OFile;
>   FAT_VOLUME  *Volume;
>@@ -371,163 +339,135 @@ Done:
>
>   FatReleaseLock ();
>   return Status;
> }
>
>+/**
>+
>+  Get the file info.
>+
>+  @param  FHand                 - The handle of the file.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing read data.
>+
>+
>+  @retval EFI_SUCCESS           - Get the file info successfully.
>+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>+  @retval EFI_VOLUME_CORRUPTED  - The file type of open file is error.
>+  @return other                 - An error occurred when operation the disk.
>+
>+**/
> EFI_STATUS
> EFIAPI
> FatRead (
>   IN     EFI_FILE_PROTOCOL  *FHand,
>   IN OUT UINTN              *BufferSize,
>      OUT VOID               *Buffer
>   )
>-/*++
>+{
>+  return FatIFileAccess (FHand, ReadData, BufferSize, Buffer, NULL);
>+}
>
>-Routine Description:
>+/**
>
>   Get the file info.
>
>-Arguments:
>-
>-  FHand                 - The handle of the file.
>-  BufferSize            - Size of Buffer.
>-  Buffer                - Buffer containing read data.
>+  @param  FHand                 - The handle of the file.
>+  @param  Token                 - A pointer to the token associated with the transaction.
>
>-Returns:
>-
>-  EFI_SUCCESS           - Get the file info successfully.
>-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>-  EFI_VOLUME_CORRUPTED  - The file type of open file is error.
>-  other                 - An error occurred when operation the disk.
>-
>---*/
>-{
>-  return FatIFileAccess (FHand, ReadData, BufferSize, Buffer, NULL);
>-}
>+  @retval EFI_SUCCESS           - Get the file info successfully.
>+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>+  @retval EFI_VOLUME_CORRUPTED  - The file type of open file is error.
>+  @return other                 - An error occurred when operation the disk.
>
>+**/
> EFI_STATUS
> EFIAPI
> FatReadEx (
>   IN     EFI_FILE_PROTOCOL  *FHand,
>   IN OUT EFI_FILE_IO_TOKEN  *Token
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get the file info.
>-
>-Arguments:
>+{
>+  return FatIFileAccess (FHand, ReadData, &Token->BufferSize, Token->Buffer, Token);
>+}
>
>-  FHand                 - The handle of the file.
>-  Token                 - A pointer to the token associated with the transaction.
>+/**
>
>-Returns:
>+  Write the content of buffer into files.
>
>-  EFI_SUCCESS           - Get the file info successfully.
>-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>-  EFI_VOLUME_CORRUPTED  - The file type of open file is error.
>-  other                 - An error occurred when operation the disk.
>+  @param  FHand                 - The handle of the file.
>+  @param  BufferSize            - Size of Buffer.
>+  @param  Buffer                - Buffer containing write data.
>
>---*/
>-{
>-  return FatIFileAccess (FHand, ReadData, &Token->BufferSize, Token->Buffer, Token);
>-}
>+  @retval EFI_SUCCESS           - Set the file info successfully.
>+  @retval EFI_WRITE_PROTECTED   - The disk is write protect.
>+  @retval EFI_ACCESS_DENIED     - The file is read-only.
>+  @retval EFI_DEVICE_ERROR      - The OFile is not valid.
>+  @retval EFI_UNSUPPORTED       - The open file is not a file.
>+                        - The writing file size is larger than 4GB.
>+  @return other                 - An error occurred when operation the disk.
>
>+**/
> EFI_STATUS
> EFIAPI
> FatWrite (
>   IN     EFI_FILE_PROTOCOL  *FHand,
>   IN OUT UINTN              *BufferSize,
>   IN     VOID               *Buffer
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Write the content of buffer into files.
>+{
>+  return FatIFileAccess (FHand, WriteData, BufferSize, Buffer, NULL);
>+}
>
>-Arguments:
>+/**
>
>-  FHand                 - The handle of the file.
>-  BufferSize            - Size of Buffer.
>-  Buffer                - Buffer containing write data.
>+  Get the file info.
>
>-Returns:
>+  @param  FHand                 - The handle of the file.
>+  @param  Token                 - A pointer to the token associated with the transaction.
>
>-  EFI_SUCCESS           - Set the file info successfully.
>-  EFI_WRITE_PROTECTED   - The disk is write protect.
>-  EFI_ACCESS_DENIED     - The file is read-only.
>-  EFI_DEVICE_ERROR      - The OFile is not valid.
>-  EFI_UNSUPPORTED       - The open file is not a file.
>-                        - The writing file size is larger than 4GB.
>-  other                 - An error occurred when operation the disk.
>-
>---*/
>-{
>-  return FatIFileAccess (FHand, WriteData, BufferSize, Buffer, NULL);
>-}
>+  @retval EFI_SUCCESS           - Get the file info successfully.
>+  @retval EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>+  @retval EFI_VOLUME_CORRUPTED  - The file type of open file is error.
>+  @return other                 - An error occurred when operation the disk.
>
>+**/
> EFI_STATUS
> EFIAPI
> FatWriteEx (
>   IN     EFI_FILE_PROTOCOL  *FHand,
>   IN OUT EFI_FILE_IO_TOKEN  *Token
>   )
>-/*++
>-
>-Routine Description:
>-
>-  Get the file info.
>-
>-Arguments:
>+{
>+  return FatIFileAccess (FHand, WriteData, &Token->BufferSize, Token->Buffer, Token);
>+}
>
>-  FHand                 - The handle of the file.
>-  Token                 - A pointer to the token associated with the transaction.
>+/**
>
>-Returns:
>+  This function reads data from a file or writes data to a file.
>+  It uses OFile->PosRem to determine how much data can be accessed in one time.
>
>-  EFI_SUCCESS           - Get the file info successfully.
>-  EFI_DEVICE_ERROR      - Can not find the OFile for the file.
>-  EFI_VOLUME_CORRUPTED  - The file type of open file is error.
>-  other                 - An error occurred when operation the disk.
>+  @param  OFile                 - The open file.
>+  @param  IoMode                - Indicate whether the access mode is reading or writing.
>+  @param  Position              - The position where data will be accessed.
>+  @param  DataBufferSize        - Size of Buffer.
>+  @param  UserBuffer            - Buffer containing data.
>+  @param  Task                    point to task instance.
>
>---*/
>-{
>-  return FatIFileAccess (FHand, WriteData, &Token->BufferSize, Token->Buffer, Token);
>-}
>+  @retval EFI_SUCCESS           - Access the data successfully.
>+  @return other                 - An error occurred when operating on the disk.
>
>+**/
> EFI_STATUS
> FatAccessOFile (
>   IN     FAT_OFILE      *OFile,
>   IN     IO_MODE        IoMode,
>   IN     UINTN          Position,
>   IN OUT UINTN          *DataBufferSize,
>   IN OUT UINT8          *UserBuffer,
>   IN FAT_TASK           *Task
>   )
>-/*++
>-
>-Routine Description:
>-
>-  This function reads data from a file or writes data to a file.
>-  It uses OFile->PosRem to determine how much data can be accessed in one time.
>-
>-Arguments:
>-
>-  OFile                 - The open file.
>-  IoMode                - Indicate whether the access mode is reading or writing.
>-  Position              - The position where data will be accessed.
>-  DataBufferSize        - Size of Buffer.
>-  UserBuffer            - Buffer containing data.
>-
>-Returns:
>-
>-  EFI_SUCCESS           - Access the data successfully.
>-  other                 - An error occurred when operating on the disk.
>-
>---*/
> {
>   FAT_VOLUME  *Volume;
>   UINTN       Len;
>   EFI_STATUS  Status;
>   UINTN       BufferSize;
>@@ -577,32 +517,26 @@ Returns:
>   //
>   *DataBufferSize -= BufferSize;
>   return Status;
> }
>
>-EFI_STATUS
>-FatExpandOFile (
>-  IN FAT_OFILE          *OFile,
>-  IN UINT64             ExpandedSize
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Expand OFile by appending zero bytes at the end of OFile.
>
>-Arguments:
>-
>-  OFile                 - The open file.
>-  ExpandedSize          - The number of zero bytes appended at the end of the file.
>+  @param  OFile                 - The open file.
>+  @param  ExpandedSize          - The number of zero bytes appended at the end of the file.
>
>-Returns:
>+  @retval EFI_SUCCESS           - The file is expanded successfully.
>+  @return other                 - An error occurred when expanding file.
>
>-  EFI_SUCCESS           - The file is expanded successfully.
>-  other                 - An error occurred when expanding file.
>-
>---*/
>+**/
>+EFI_STATUS
>+FatExpandOFile (
>+  IN FAT_OFILE          *OFile,
>+  IN UINT64             ExpandedSize
>+  )
> {
>   EFI_STATUS  Status;
>   UINTN       WritePos;
>
>   WritePos  = OFile->FileSize;
>@@ -612,33 +546,27 @@ Returns:
>   }
>
>   return Status;
> }
>
>-EFI_STATUS
>-FatWriteZeroPool (
>-  IN FAT_OFILE  *OFile,
>-  IN UINTN      WritePos
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Write zero pool from the WritePos to the end of OFile.
>
>-Arguments:
>-
>-  OFile                 - The open file to write zero pool.
>-  WritePos              - The number of zero bytes written.
>-
>-Returns:
>+  @param  OFile                 - The open file to write zero pool.
>+  @param  WritePos              - The number of zero bytes written.
>
>-  EFI_SUCCESS           - Write the zero pool successfully.
>-  EFI_OUT_OF_RESOURCES  - Not enough memory to perform the operation.
>-  other                 - An error occurred when writing disk.
>+  @retval EFI_SUCCESS           - Write the zero pool successfully.
>+  @retval EFI_OUT_OF_RESOURCES  - Not enough memory to perform the operation.
>+  @return other                 - An error occurred when writing disk.
>
>---*/
>+**/
>+EFI_STATUS
>+FatWriteZeroPool (
>+  IN FAT_OFILE  *OFile,
>+  IN UINTN      WritePos
>+  )
> {
>   EFI_STATUS  Status;
>   VOID        *ZeroBuffer;
>   UINTN       AppendedSize;
>   UINTN       BufferSize;
>@@ -674,31 +602,25 @@ Returns:
>
>   FreePool (ZeroBuffer);
>   return Status;
> }
>
>-EFI_STATUS
>-FatTruncateOFile (
>-  IN FAT_OFILE          *OFile,
>-  IN UINTN              TruncatedSize
>-  )
>-/*++
>-
>-Routine Description:
>+/**
>
>   Truncate the OFile to smaller file size.
>
>-Arguments:
>-
>-  OFile                 - The open file.
>-  TruncatedSize         - The new file size.
>+  @param  OFile                 - The open file.
>+  @param  TruncatedSize         - The new file size.
>
>-Returns:
>+  @retval EFI_SUCCESS           - The file is truncated successfully.
>+  @return other                 - An error occurred when truncating file.
>
>-  EFI_SUCCESS           - The file is truncated successfully.
>-  other                 - An error occurred when truncating file.
>-
>---*/
>+**/
>+EFI_STATUS
>+FatTruncateOFile (
>+  IN FAT_OFILE          *OFile,
>+  IN UINTN              TruncatedSize
>+  )
> {
>   OFile->FileSize = TruncatedSize;
>   return FatShrinkEof (OFile);
> }
>diff --git a/FatPkg/EnhancedFatDxe/UnicodeCollation.c b/FatPkg/EnhancedFatDxe/UnicodeCollation.c
>index 61b9aab..b240a93 100644
>--- a/FatPkg/EnhancedFatDxe/UnicodeCollation.c
>+++ b/FatPkg/EnhancedFatDxe/UnicodeCollation.c
>@@ -187,13 +187,12 @@ FatStriCmp (
>
>
> /**
>   Uppercase a string.
>
>-  @param  Str                   The string which will be upper-cased.
>+  @param  String                   The string which will be upper-cased.
>
>-  @return None.
>
> **/
> VOID
> FatStrUpr (
>   IN OUT CHAR16   *String
>@@ -207,13 +206,12 @@ FatStrUpr (
>
>
> /**
>   Lowercase a string
>
>-  @param  Str                   The string which will be lower-cased.
>+  @param  String                   The string which will be lower-cased.
>
>-  @return None
>
> **/
> VOID
> FatStrLwr (
>   IN OUT CHAR16   *String
>--
>1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [patch 5/8] FatPkg\EnhancedFatDxe: Use typedef for complex type
  2016-12-08 10:54 ` [patch 5/8] FatPkg\EnhancedFatDxe: Use typedef for complex type Dandan Bi
@ 2016-12-09  1:11   ` Ni, Ruiyu
  0 siblings, 0 replies; 27+ messages in thread
From: Ni, Ruiyu @ 2016-12-09  1:11 UTC (permalink / raw)
  To: Bi, Dandan, edk2-devel@lists.01.org

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

Regards,
Ray

>-----Original Message-----
>From: Bi, Dandan
>Sent: Thursday, December 8, 2016 6:54 PM
>To: edk2-devel@lists.01.org
>Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
>Subject: [patch 5/8] FatPkg\EnhancedFatDxe: Use typedef for complex type
>
>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/Fat.h           | 36 ++++++++++++++++++++---------------
> FatPkg/EnhancedFatDxe/FatFileSystem.h | 10 ++++++----
> 2 files changed, 27 insertions(+), 19 deletions(-)
>
>diff --git a/FatPkg/EnhancedFatDxe/Fat.h b/FatPkg/EnhancedFatDxe/Fat.h
>index 42aa647..f49acee 100644
>--- a/FatPkg/EnhancedFatDxe/Fat.h
>+++ b/FatPkg/EnhancedFatDxe/Fat.h
>@@ -182,42 +182,48 @@ typedef struct {
> #define HASH_TABLE_MASK  (HASH_TABLE_SIZE - 1)
>
> //
> // The directory entry for opened directory
> //
>-typedef struct _FAT_DIRENT {
>+
>+typedef struct _FAT_DIRENT FAT_DIRENT;
>+typedef struct _FAT_ODIR FAT_ODIR;
>+typedef struct _FAT_OFILE FAT_OFILE;
>+typedef struct _FAT_VOLUME FAT_VOLUME;
>+
>+struct _FAT_DIRENT {
>   UINTN               Signature;
>   UINT16              EntryPos;               // The position of this directory entry in the parent directory file
>   UINT8               EntryCount;             // The count of the directory entry in the parent directory file
>   BOOLEAN             Invalid;                // Indicate whether this directory entry is valid
>   CHAR16              *FileString;            // The unicode long file name for this directory entry
>-  struct _FAT_OFILE   *OFile;                 // The OFile of the corresponding directory entry
>-  struct _FAT_DIRENT  *ShortNameForwardLink;  // Hash successor link for short filename
>-  struct _FAT_DIRENT  *LongNameForwardLink;   // Hash successor link for long filename
>+  FAT_OFILE           *OFile;                 // The OFile of the corresponding directory entry
>+  FAT_DIRENT          *ShortNameForwardLink;  // Hash successor link for short filename
>+  FAT_DIRENT          *LongNameForwardLink;   // Hash successor link for long filename
>   LIST_ENTRY          Link;                   // Connection of every directory entry
>   FAT_DIRECTORY_ENTRY Entry;                  // The physical directory entry stored in disk
>-} FAT_DIRENT;
>+};
>
>-typedef struct _FAT_ODIR {
>+struct _FAT_ODIR {
>   UINTN               Signature;
>   UINT32              CurrentEndPos;          // Current end position of the directory
>   UINT32              CurrentPos;             // Current position of the directory
>   LIST_ENTRY          *CurrentCursor;         // Current directory entry pointer
>   LIST_ENTRY          ChildList;              // List of all directory entries
>   BOOLEAN             EndOfDir;               // Indicate whether we have reached the end of the directory
>   LIST_ENTRY          DirCacheLink;           // Linked in Volume->DirCacheList when discarded
>   UINTN               DirCacheTag;            // The identification of the directory when in directory cache
>   FAT_DIRENT          *LongNameHashTable[HASH_TABLE_SIZE];
>   FAT_DIRENT          *ShortNameHashTable[HASH_TABLE_SIZE];
>-} FAT_ODIR;
>+};
>
> typedef struct {
>   UINTN               Signature;
>   EFI_FILE_PROTOCOL   Handle;
>   UINT64              Position;
>   BOOLEAN             ReadOnly;
>-  struct _FAT_OFILE   *OFile;
>+  FAT_OFILE          *OFile;
>   LIST_ENTRY          Tasks;                  // List of all FAT_TASKs
>   LIST_ENTRY          Link;                   // Link to other IFiles
> } FAT_IFILE;
>
> typedef struct {
>@@ -240,13 +246,13 @@ typedef struct {
> } FAT_SUBTASK;
>
> //
> // FAT_OFILE - Each opened file
> //
>-typedef struct _FAT_OFILE {
>+struct _FAT_OFILE {
>   UINTN               Signature;
>-  struct _FAT_VOLUME  *Volume;
>+  FAT_VOLUME          *Volume;
>   //
>   // A permanant error code to return to all accesses to
>   // this opened file
>   //
>   EFI_STATUS          Error;
>@@ -282,11 +288,11 @@ typedef struct _FAT_OFILE {
>   UINT64              PosDisk;  // on the disk
>   UINTN               PosRem;   // remaining in this disk run
>   //
>   // The opened parent, full path length and currently opened child files
>   //
>-  struct _FAT_OFILE   *Parent;
>+  FAT_OFILE           *Parent;
>   UINTN               FullPathLen;
>   LIST_ENTRY          ChildHead;
>   LIST_ENTRY          ChildLink;
>
>   //
>@@ -301,13 +307,13 @@ typedef struct _FAT_OFILE {
>
>   //
>   // Link in Volume's reference list
>   //
>   LIST_ENTRY          CheckLink;
>-} FAT_OFILE;
>+};
>
>-typedef struct _FAT_VOLUME {
>+struct _FAT_VOLUME {
>   UINTN                           Signature;
>
>   EFI_HANDLE                      Handle;
>   BOOLEAN                         Valid;
>   BOOLEAN                         DiskError;
>@@ -364,11 +370,11 @@ typedef struct _FAT_VOLUME {
>   FAT_DIRENT                      RootDirEnt;
>   //
>   // File Name of root OFile, it is empty string
>   //
>   CHAR16                          RootFileString[1];
>-  struct _FAT_OFILE               *Root;
>+  FAT_OFILE                       *Root;
>
>   //
>   // New OFiles are added to this list so they
>   // can be cleaned up if they aren't referenced.
>   //
>@@ -383,11 +389,11 @@ typedef struct _FAT_VOLUME {
>   //
>   // Disk Cache for this volume
>   //
>   VOID                            *CacheBuffer;
>   DISK_CACHE                      DiskCache[CacheMaxType];
>-} FAT_VOLUME;
>+};
>
> //
> // Function Prototypes
> //
> EFI_STATUS
>diff --git a/FatPkg/EnhancedFatDxe/FatFileSystem.h b/FatPkg/EnhancedFatDxe/FatFileSystem.h
>index bcef258..3f89a34 100644
>--- a/FatPkg/EnhancedFatDxe/FatFileSystem.h
>+++ b/FatPkg/EnhancedFatDxe/FatFileSystem.h
>@@ -144,16 +144,18 @@ typedef struct {
>   CHAR8   Id[4];
>   CHAR8   FatLabel[11];
>   CHAR8   SystemId[8];
> } FAT32_BOOT_SECTOR_EXT;
>
>-typedef struct {
>-  FAT_BOOT_SECTOR_BASIC   FatBsb;
>-  union {
>+typedef union {
>     FAT_BOOT_SECTOR_EXT   FatBse;
>     FAT32_BOOT_SECTOR_EXT Fat32Bse;
>-  } FatBse;
>+  } FAT_BSE;
>+
>+typedef struct {
>+  FAT_BOOT_SECTOR_BASIC   FatBsb;
>+  FAT_BSE  FatBse;
> } FAT_BOOT_SECTOR;
>
> //
> // FAT Info Structure
> //
>--
>1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [patch 4/8] FatPkg\EnhancedFatDxe: Make the variable name follow rule
  2016-12-08 10:54 ` [patch 4/8] FatPkg\EnhancedFatDxe: Make the variable name follow rule Dandan Bi
@ 2016-12-09  1:12   ` Ni, Ruiyu
  0 siblings, 0 replies; 27+ messages in thread
From: Ni, Ruiyu @ 2016-12-09  1:12 UTC (permalink / raw)
  To: Bi, Dandan, edk2-devel@lists.01.org

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

Regards,
Ray

>-----Original Message-----
>From: Bi, Dandan
>Sent: Thursday, December 8, 2016 6:54 PM
>To: edk2-devel@lists.01.org
>Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
>Subject: [patch 4/8] 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>
>---
> 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



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [patch 3/8] FatPkg\EnhancedFatDxe: Make function prototype align with definition
  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
  0 siblings, 0 replies; 27+ messages in thread
From: Ni, Ruiyu @ 2016-12-09  1:13 UTC (permalink / raw)
  To: Bi, Dandan, edk2-devel@lists.01.org

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

Regards,
Ray

>-----Original Message-----
>From: Bi, Dandan
>Sent: Thursday, December 8, 2016 6:54 PM
>To: edk2-devel@lists.01.org
>Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
>Subject: [patch 3/8] FatPkg\EnhancedFatDxe: Make function prototype align with definition
>
>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/Info.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/FatPkg/EnhancedFatDxe/Info.c b/FatPkg/EnhancedFatDxe/Info.c
>index 858b3f4..aa1b0f2 100644
>--- a/FatPkg/EnhancedFatDxe/Info.c
>+++ b/FatPkg/EnhancedFatDxe/Info.c
>@@ -32,12 +32,12 @@ FatGetVolumeInfo (
>   );
>
> EFI_STATUS
> FatSetVolumeInfo (
>   IN FAT_VOLUME       *Volume,
>-  IN OUT UINTN        BufferSize,
>-  OUT VOID            *Buffer
>+  IN UINTN            BufferSize,
>+  IN VOID            *Buffer
>   );
>
> EFI_STATUS
> FatSetOrGetInfo (
>   IN BOOLEAN              IsSet,
>--
>1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [patch 1/8] FatPkg\EnhancedFatDxe: Avoid Non-Boolean type uses as Boolean
  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
  0 siblings, 0 replies; 27+ messages in thread
From: Ni, Ruiyu @ 2016-12-09  1:14 UTC (permalink / raw)
  To: Bi, Dandan, edk2-devel@lists.01.org

Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>

Regards,
Ray

>-----Original Message-----
>From: Bi, Dandan
>Sent: Thursday, December 8, 2016 6:54 PM
>To: edk2-devel@lists.01.org
>Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
>Subject: [patch 1/8] FatPkg\EnhancedFatDxe: Avoid Non-Boolean type uses as Boolean
>
>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/FileName.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>diff --git a/FatPkg/EnhancedFatDxe/FileName.c b/FatPkg/EnhancedFatDxe/FileName.c
>index 5df4036..f393aa6 100644
>--- a/FatPkg/EnhancedFatDxe/FileName.c
>+++ b/FatPkg/EnhancedFatDxe/FileName.c
>@@ -57,11 +57,11 @@ Returns:
>   UINTN   ExtendNameLen;
>
>   PossibleShortName = TRUE;
>   SeparateDot       = NULL;
>   SetMem (File8Dot3Name, FAT_NAME_LEN, ' ');
>-  for (TempName = FileName; *TempName; TempName++) {
>+  for (TempName = FileName; *TempName != '\0'; TempName++) {
>     if (*TempName == L'.') {
>       SeparateDot = TempName;
>     }
>   }
>
>@@ -451,11 +451,11 @@ Returns:
> {
>   UINTN ShortNameLen;
>   UINT8 Sum;
>   Sum = 0;
>   for (ShortNameLen = FAT_NAME_LEN; ShortNameLen != 0; ShortNameLen--) {
>-    Sum = (UINT8)(((Sum & 1) ? 0x80 : 0) + (Sum >> 1) + *ShortNameString++);
>+    Sum = (UINT8)((((Sum & 1) != 0) ? 0x80 : 0) + (Sum >> 1) + *ShortNameString++);
>   }
>
>   return Sum;
> }
>
>--
>1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration
  2016-12-09  0:57   ` Ni, Ruiyu
@ 2016-12-09  1:18     ` Bi, Dandan
  0 siblings, 0 replies; 27+ messages in thread
From: Bi, Dandan @ 2016-12-09  1:18 UTC (permalink / raw)
  To: Ni, Ruiyu, edk2-devel@lists.01.org

Got it ! I will submit a new patch. Thanks!

Regards,
Dandan

-----Original Message-----
From: Ni, Ruiyu 
Sent: Friday, December 9, 2016 8:58 AM
To: Bi, Dandan <dandan.bi@intel.com>; edk2-devel@lists.01.org
Subject: RE: [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration

Dandan,
Could you please create a global array mMonthDays?
UINT8  mMonthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

Regards,
Ray

>-----Original Message-----
>From: Bi, Dandan
>Sent: Thursday, December 8, 2016 6:54 PM
>To: edk2-devel@lists.01.org
>Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
>Subject: [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after 
>declaration
>
>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/Misc.c | 14 +++++++++++++-
> 1 file changed, 13 insertions(+), 1 deletion(-)
>
>diff --git a/FatPkg/EnhancedFatDxe/Misc.c 
>b/FatPkg/EnhancedFatDxe/Misc.c index f91759c..6ad688c 100644
>--- a/FatPkg/EnhancedFatDxe/Misc.c
>+++ b/FatPkg/EnhancedFatDxe/Misc.c
>@@ -696,15 +696,27 @@ Returns:
>   TRUE                  - The time is valid.
>   FALSE                 - The time is not valid.
>
> --*/
> {
>-  static UINT8  MonthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 
>31, 30, 31 };
>+  STATIC UINT8  MonthDays[12];
>   UINTN         Day;
>   BOOLEAN       ValidTime;
>
>   ValidTime = TRUE;
>+  MonthDays[0] = 31;
>+  MonthDays[1] = 28;
>+  MonthDays[2] = 31;
>+  MonthDays[3] = 30;
>+  MonthDays[4] = 31;
>+  MonthDays[5] = 30;
>+  MonthDays[6] = 31;
>+  MonthDays[7] = 31;
>+  MonthDays[8] = 30;
>+  MonthDays[9] = 31;
>+  MonthDays[10] = 30;
>+  MonthDays[11] = 31;
>
>   //
>   // Check the fields for range problems
>   // Fat can only support from 1980
>   //
>--
>1.9.5.msysgit.1



^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration
  2016-12-09  0:40           ` Yao, Jiewen
@ 2016-12-09 16:32             ` Kurt Kennett
  0 siblings, 0 replies; 27+ messages in thread
From: Kurt Kennett @ 2016-12-09 16:32 UTC (permalink / raw)
  To: Yao, Jiewen, afish@apple.com
  Cc: Bi, Dandan, edk2-devel@lists.01.org, Ni, Ruiyu

No.

Try "static const"

K2

From: Yao, Jiewen [mailto:jiewen.yao@intel.com]
Sent: Thursday, December 8, 2016 4:40 PM
To: afish@apple.com; Kurt Kennett <Kurt.Kennett@microsoft.com>
Cc: Bi, Dandan <dandan.bi@intel.com>; edk2-devel@lists.01.org; Ni, Ruiyu <ruiyu.ni@intel.com>
Subject: RE: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration

Hi
I found it is using "STATIC" not "CONST".

Does a compiler put "STATIC" data to READ-ONLY section?

Thank you
Yao Jiewen

From: afish@apple.com<mailto:afish@apple.com> [mailto:afish@apple.com]
Sent: Friday, December 9, 2016 8:37 AM
To: Kurt Kennett <Kurt.Kennett@microsoft.com<mailto:Kurt.Kennett@microsoft.com>>
Cc: Yao, Jiewen <jiewen.yao@intel.com<mailto:jiewen.yao@intel.com>>; Bi, Dandan <dandan.bi@intel.com<mailto:dandan.bi@intel.com>>; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>; Ni, Ruiyu <ruiyu.ni@intel.com<mailto:ruiyu.ni@intel.com>>
Subject: Re: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration


> On Dec 8, 2016, at 4:26 PM, Kurt Kennett <Kurt.Kennett@microsoft.com<mailto:Kurt.Kennett@microsoft.com>> wrote:
>
> Is the data 'variable'?  i.e does it ever change?
>
> A normal compiler should put this data into a section marked read-only if it is marked as const, and a loader could read-protect the region after load.
>

K2,

Did you mean write-protoect?

FYI in my example in this thread from a macOS clang compiler the constant date ends up in a const TEXT section, as the text section in general is const. That is why the compiler emitted a PC relative access. This only ever becomes an issue when hand writing assemble code for X64.

Thanks,

Andrew Fish

> K2
>
> -----Original Message-----
> From: Yao, Jiewen [mailto:jiewen.yao@intel.com]
> Sent: Thursday, December 8, 2016 3:47 PM
> To: Kurt Kennett <Kurt.Kennett@microsoft.com<mailto:Kurt.Kennett@microsoft.com>>; Bi, Dandan <dandan.bi@intel.com<mailto:dandan.bi@intel.com>>; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com<mailto:ruiyu.ni@intel.com>>
> Subject: RE: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration
>
> Agree. Maybe we can move it to be a global variable ?
>
> Thank you
> Yao Jiewen
>
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>> Kurt Kennett
>> Sent: Friday, December 9, 2016 1:28 AM
>> To: Bi, Dandan <dandan.bi@intel.com<mailto:dandan.bi@intel.com>>; edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
>> Cc: Ni, Ruiyu <ruiyu.ni@intel.com<mailto:ruiyu.ni@intel.com>>
>> Subject: Re: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize
>> variable after declaration
>>
>> This seems kind of silly.
>> Why isn't this just const data?  This adds code and memory accesses
>> that are worthless and happen on every call to the function.
>>
>> K2
>>
>> -----Original Message-----
>> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
>> Dandan Bi
>> Sent: Thursday, December 8, 2016 2:54 AM
>> To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
>> Cc: Ruiyu Ni <ruiyu.ni@intel.com<mailto:ruiyu.ni@intel.com>>
>> Subject: [edk2] [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable
>> after declaration
>>
>> Cc: Ruiyu Ni <ruiyu.ni@intel.com<mailto:ruiyu.ni@intel.com>>
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Dandan Bi <dandan.bi@intel.com<mailto:dandan.bi@intel.com>>
>> ---
>> FatPkg/EnhancedFatDxe/Misc.c | 14 +++++++++++++-
>> 1 file changed, 13 insertions(+), 1 deletion(-)
>>
>> diff --git a/FatPkg/EnhancedFatDxe/Misc.c
>> b/FatPkg/EnhancedFatDxe/Misc.c index f91759c..6ad688c 100644
>> --- a/FatPkg/EnhancedFatDxe/Misc.c
>> +++ b/FatPkg/EnhancedFatDxe/Misc.c
>> @@ -696,15 +696,27 @@ Returns:
>>   TRUE                  - The time is valid.
>>   FALSE                 - The time is not valid.
>>
>> --*/
>> {
>> -  static UINT8  MonthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30,
>> 31, 30, 31 };
>> +  STATIC UINT8  MonthDays[12];
>>   UINTN         Day;
>>   BOOLEAN       ValidTime;
>>
>>   ValidTime = TRUE;
>> +  MonthDays[0] = 31;
>> +  MonthDays[1] = 28;
>> +  MonthDays[2] = 31;
>> +  MonthDays[3] = 30;
>> +  MonthDays[4] = 31;
>> +  MonthDays[5] = 30;
>> +  MonthDays[6] = 31;
>> +  MonthDays[7] = 31;
>> +  MonthDays[8] = 30;
>> +  MonthDays[9] = 31;
>> +  MonthDays[10] = 30;
>> +  MonthDays[11] = 31;
>>
>>   //
>>   // Check the fields for range problems
>>   // Fat can only support from 1980
>>   //
>> --
>> 1.9.5.msysgit.1
>>
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
>> https://lists.01.org/mailman/listinfo/edk2-devel
>> _______________________________________________
>> edk2-devel mailing list
>> edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
>> https://lists.01.org/mailman/listinfo/edk2-devel
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [patch 2/8] FatPkg\EnhancedFatDxe: Initialize variable after declaration
  2016-12-08 23:11     ` Andrew Fish
@ 2016-12-20 23:26       ` Brian J. Johnson
  0 siblings, 0 replies; 27+ messages in thread
From: Brian J. Johnson @ 2016-12-20 23:26 UTC (permalink / raw)
  To: Andrew Fish, Kurt Kennett; +Cc: Ruiyu Ni, Dandan Bi, edk2-devel@lists.01.org

On 12/08/2016 05:11 PM, Andrew Fish wrote:
>> On Dec 8, 2016, at 9:27 AM, Kurt Kennett <Kurt.Kennett@microsoft.com> wrote:
>>
>> This seems kind of silly.
>> Why isn't this just const data?  This adds code and memory accesses that are worthless and happen on every call to the function.
>>
> K2,
>
> I think this is an attempt to conform to the coding standard?

I just went looking through the C Coding Standards document 
(https://github.com/tianocore-docs/Docs/raw/master/Specifications/CCS_2_1_Draft.pdf) 
and couldn't actually find this requirement.  Which really surprises 
me... I must not be using the right search terms.

Could someone point out the specific section covering this requirement? 
I have somebody asking me about it internally here.

Sorry to be both dense and pedantic,
-- 

						Brian J. Johnson

--------------------------------------------------------------------

   My statements are my own, are not authorized by SGI, and do not
   necessarily represent SGI’s positions.


^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2016-12-20 23:26 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [patch 4/8] FatPkg\EnhancedFatDxe: Make the variable name follow rule Dandan Bi
2016-12-09  1:12   ` 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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox