summaryrefslogtreecommitdiffstats
path: root/FatPkg/EnhancedFatDxe/Flush.c
diff options
context:
space:
mode:
authorMichael Kubacki <michael.kubacki@microsoft.com>2021-12-05 14:53:58 -0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2021-12-07 17:24:28 +0000
commitbcdcc4160d7460c46c08c9395aae81be44ef23a9 (patch)
tree8e8607b86b86a1cebeaf6f614c43731a486b61a5 /FatPkg/EnhancedFatDxe/Flush.c
parenta550d468a6ca577d9e9c57a0eafcf2fc9fbb8c97 (diff)
downloadedk2-bcdcc4160d7460c46c08c9395aae81be44ef23a9.tar.gz
edk2-bcdcc4160d7460c46c08c9395aae81be44ef23a9.tar.bz2
edk2-bcdcc4160d7460c46c08c9395aae81be44ef23a9.zip
FatPkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the FatPkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Ray Ni <ray.ni@intel.com>
Diffstat (limited to 'FatPkg/EnhancedFatDxe/Flush.c')
-rw-r--r--FatPkg/EnhancedFatDxe/Flush.c91
1 files changed, 52 insertions, 39 deletions
diff --git a/FatPkg/EnhancedFatDxe/Flush.c b/FatPkg/EnhancedFatDxe/Flush.c
index d532791075..8c6010328b 100644
--- a/FatPkg/EnhancedFatDxe/Flush.c
+++ b/FatPkg/EnhancedFatDxe/Flush.c
@@ -35,10 +35,10 @@ FatFlushEx (
EFI_STATUS Status;
FAT_TASK *Task;
- IFile = IFILE_FROM_FHAND (FHand);
- OFile = IFile->OFile;
- Volume = OFile->Volume;
- Task = NULL;
+ IFile = IFILE_FROM_FHAND (FHand);
+ OFile = IFile->OFile;
+ Volume = OFile->Volume;
+ Task = NULL;
//
// If the file has a permanent error, return it
@@ -50,6 +50,7 @@ FatFlushEx (
if (Volume->ReadOnly) {
return EFI_WRITE_PROTECTED;
}
+
//
// If read only, return error
//
@@ -67,6 +68,7 @@ FatFlushEx (
if (FHand->Revision < EFI_FILE_PROTOCOL_REVISION2) {
return EFI_UNSUPPORTED;
}
+
Task = FatCreateTask (IFile, Token);
if (Task == NULL) {
return EFI_OUT_OF_RESOURCES;
@@ -77,8 +79,8 @@ FatFlushEx (
// Flush the OFile
//
FatAcquireLock ();
- Status = FatOFileFlush (OFile);
- Status = FatCleanupVolume (OFile->Volume, OFile, Status, Task);
+ Status = FatOFileFlush (OFile);
+ Status = FatCleanupVolume (OFile->Volume, OFile, Status, Task);
FatReleaseLock ();
if (Token != NULL) {
@@ -132,9 +134,9 @@ FatClose (
FAT_OFILE *OFile;
FAT_VOLUME *Volume;
- IFile = IFILE_FROM_FHAND (FHand);
- OFile = IFile->OFile;
- Volume = OFile->Volume;
+ IFile = IFILE_FROM_FHAND (FHand);
+ OFile = IFile->OFile;
+ Volume = OFile->Volume;
//
// Lock the volume
@@ -169,14 +171,14 @@ FatClose (
**/
EFI_STATUS
FatIFileClose (
- FAT_IFILE *IFile
+ FAT_IFILE *IFile
)
{
FAT_OFILE *OFile;
FAT_VOLUME *Volume;
- OFile = IFile->OFile;
- Volume = OFile->Volume;
+ OFile = IFile->OFile;
+ Volume = OFile->Volume;
ASSERT_VOLUME_LOCKED (Volume);
@@ -193,6 +195,7 @@ FatIFileClose (
if (OFile->CheckLink.ForwardLink == NULL) {
InsertHeadList (&Volume->CheckRef, &OFile->CheckLink);
}
+
//
// Done. Free the open instance structure
//
@@ -213,13 +216,13 @@ FatIFileClose (
**/
EFI_STATUS
FatOFileFlush (
- IN FAT_OFILE *OFile
+ IN FAT_OFILE *OFile
)
{
- EFI_STATUS Status;
- FAT_OFILE *Parent;
- FAT_DIRENT *DirEnt;
- FAT_DATE_TIME FatNow;
+ EFI_STATUS Status;
+ FAT_OFILE *Parent;
+ FAT_DIRENT *DirEnt;
+ FAT_DATE_TIME FatNow;
//
// Flush each entry up the tree while dirty
@@ -233,8 +236,8 @@ FatOFileFlush (
return OFile->Error;
}
- Parent = OFile->Parent;
- DirEnt = OFile->DirEnt;
+ Parent = OFile->Parent;
+ DirEnt = OFile->DirEnt;
if (OFile->Dirty) {
//
// Update the last modification time
@@ -248,12 +251,13 @@ FatOFileFlush (
OFile->PreserveLastModification = FALSE;
if (OFile->Archive) {
DirEnt->Entry.Attributes |= FAT_ATTRIBUTE_ARCHIVE;
- OFile->Archive = FALSE;
+ OFile->Archive = FALSE;
}
+
//
// Write the directory entry
//
- if (Parent != NULL && !DirEnt->Invalid) {
+ if ((Parent != NULL) && !DirEnt->Invalid) {
//
// Write the OFile's directory entry
//
@@ -265,11 +269,13 @@ FatOFileFlush (
OFile->Dirty = FALSE;
}
+
//
// Check the parent
//
OFile = Parent;
} while (OFile != NULL);
+
return EFI_SUCCESS;
}
@@ -287,7 +293,7 @@ FatOFileFlush (
**/
BOOLEAN
FatCheckOFileRef (
- IN FAT_OFILE *OFile
+ IN FAT_OFILE *OFile
)
{
//
@@ -308,6 +314,7 @@ FatCheckOFileRef (
//
return FALSE;
}
+
//
// Free the Ofile
//
@@ -328,11 +335,11 @@ FatCheckOFileRef (
STATIC
VOID
FatCheckVolumeRef (
- IN FAT_VOLUME *Volume
+ IN FAT_VOLUME *Volume
)
{
- FAT_OFILE *OFile;
- FAT_OFILE *Parent;
+ FAT_OFILE *OFile;
+ FAT_OFILE *Parent;
//
// Check all files on the pending check list
@@ -346,8 +353,8 @@ FatCheckVolumeRef (
// Go up the tree cleaning up any un-referenced OFiles
//
while (Parent != NULL) {
- OFile = Parent;
- Parent = OFile->Parent;
+ OFile = Parent;
+ Parent = OFile->Parent;
if (!FatCheckOFileRef (OFile)) {
break;
}
@@ -373,19 +380,21 @@ FatCheckVolumeRef (
**/
EFI_STATUS
FatCleanupVolume (
- IN FAT_VOLUME *Volume,
- IN FAT_OFILE *OFile,
- IN EFI_STATUS EfiStatus,
- IN FAT_TASK *Task
+ IN FAT_VOLUME *Volume,
+ IN FAT_OFILE *OFile,
+ IN EFI_STATUS EfiStatus,
+ IN FAT_TASK *Task
)
{
EFI_STATUS Status;
+
//
// Flag the OFile
//
if (OFile != NULL) {
FatSetVolumeError (OFile, EfiStatus);
}
+
//
// Clean up any dangling OFiles that don't have IFiles
// we don't check return status here because we want the
@@ -403,16 +412,18 @@ FatCleanupVolume (
return Status;
}
}
+
//
// Update that the volume is not dirty
//
- if (Volume->FatDirty && Volume->FatType != Fat12) {
- Volume->FatDirty = FALSE;
- Status = FatAccessVolumeDirty (Volume, WriteFat, &Volume->NotDirtyValue);
+ if (Volume->FatDirty && (Volume->FatType != Fat12)) {
+ Volume->FatDirty = FALSE;
+ Status = FatAccessVolumeDirty (Volume, WriteFat, &Volume->NotDirtyValue);
if (EFI_ERROR (Status)) {
return Status;
}
}
+
//
// Flush all dirty cache entries to disk
//
@@ -421,11 +432,12 @@ FatCleanupVolume (
return Status;
}
}
+
//
// If the volume is cleared , remove it.
// The only time volume be invalidated is in DriverBindingStop.
//
- if (Volume->Root == NULL && !Volume->Valid) {
+ if ((Volume->Root == NULL) && !Volume->Valid) {
//
// Free the volume structure
//
@@ -445,12 +457,12 @@ FatCleanupVolume (
**/
VOID
FatSetVolumeError (
- IN FAT_OFILE *OFile,
- IN EFI_STATUS Status
+ IN FAT_OFILE *OFile,
+ IN EFI_STATUS Status
)
{
- LIST_ENTRY *Link;
- FAT_OFILE *ChildOFile;
+ LIST_ENTRY *Link;
+ FAT_OFILE *ChildOFile;
//
// If this OFile doesn't already have an error, set one
@@ -458,6 +470,7 @@ FatSetVolumeError (
if (!EFI_ERROR (OFile->Error)) {
OFile->Error = Status;
}
+
//
// Set the error on each child OFile
//