summaryrefslogtreecommitdiffstats
path: root/FatPkg/EnhancedFatDxe/FileSpace.c
diff options
context:
space:
mode:
authorDandan Bi <dandan.bi@intel.com>2016-12-09 10:07:49 +0800
committerRuiyu Ni <ruiyu.ni@intel.com>2016-12-09 11:02:09 +0800
commitcae7420b4bd015b78f915c4ba766dbee15da0468 (patch)
tree6d993ff6a13caf4ba46e3a0cc20e2cb07da40fc0 /FatPkg/EnhancedFatDxe/FileSpace.c
parent6b7e4498e8eb4b3e69472bdadbc5de60d15e0d4d (diff)
downloadedk2-cae7420b4bd015b78f915c4ba766dbee15da0468.tar.gz
edk2-cae7420b4bd015b78f915c4ba766dbee15da0468.tar.bz2
edk2-cae7420b4bd015b78f915c4ba766dbee15da0468.zip
FatPkg/EnhancedFatDxe: Make the comments align with EDKIIcoding style
Cc: Ruiyu Ni <ruiyu.ni@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Diffstat (limited to 'FatPkg/EnhancedFatDxe/FileSpace.c')
-rw-r--r--FatPkg/EnhancedFatDxe/FileSpace.c334
1 files changed, 126 insertions, 208 deletions
diff --git a/FatPkg/EnhancedFatDxe/FileSpace.c b/FatPkg/EnhancedFatDxe/FileSpace.c
index db44a331a8..1254cd68b5 100644
--- a/FatPkg/EnhancedFatDxe/FileSpace.c
+++ b/FatPkg/EnhancedFatDxe/FileSpace.c
@@ -1,4 +1,5 @@
-/*++
+/** @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
@@ -10,43 +11,28 @@ 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;
@@ -89,28 +75,22 @@ 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;
@@ -147,6 +127,19 @@ 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 (
@@ -154,25 +147,6 @@ FatSetFatEntry (
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;
@@ -253,29 +227,23 @@ Returns:
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;
@@ -294,26 +262,20 @@ 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;
@@ -354,28 +316,22 @@ Returns:
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;
@@ -387,26 +343,20 @@ 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;
@@ -465,30 +415,24 @@ Returns:
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;
@@ -591,31 +535,25 @@ Done:
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;
@@ -691,28 +629,22 @@ Returns:
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);
@@ -742,27 +674,21 @@ 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;
@@ -771,25 +697,17 @@ Returns:
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;