summaryrefslogtreecommitdiffstats
path: root/FatPkg/EnhancedFatDxe/Misc.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/Misc.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/Misc.c')
-rw-r--r--FatPkg/EnhancedFatDxe/Misc.c182
1 files changed, 93 insertions, 89 deletions
diff --git a/FatPkg/EnhancedFatDxe/Misc.c b/FatPkg/EnhancedFatDxe/Misc.c
index d488a6e9a6..68a113fcfd 100644
--- a/FatPkg/EnhancedFatDxe/Misc.c
+++ b/FatPkg/EnhancedFatDxe/Misc.c
@@ -22,11 +22,11 @@ UINT8 mMonthDays[] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
**/
FAT_TASK *
FatCreateTask (
- FAT_IFILE *IFile,
- EFI_FILE_IO_TOKEN *Token
+ FAT_IFILE *IFile,
+ EFI_FILE_IO_TOKEN *Token
)
{
- FAT_TASK *Task;
+ FAT_TASK *Task;
Task = AllocateZeroPool (sizeof (*Task));
if (Task != NULL) {
@@ -36,6 +36,7 @@ FatCreateTask (
InitializeListHead (&Task->Subtasks);
InitializeListHead (&Task->Link);
}
+
return Task;
}
@@ -48,17 +49,18 @@ FatCreateTask (
**/
VOID
FatDestroyTask (
- FAT_TASK *Task
+ FAT_TASK *Task
)
{
- LIST_ENTRY *Link;
- FAT_SUBTASK *Subtask;
+ LIST_ENTRY *Link;
+ FAT_SUBTASK *Subtask;
Link = GetFirstNode (&Task->Subtasks);
while (!IsNull (&Task->Subtasks, Link)) {
Subtask = CR (Link, FAT_SUBTASK, Link, FAT_SUBTASK_SIGNATURE);
- Link = FatDestroySubtask (Subtask);
+ Link = FatDestroySubtask (Subtask);
}
+
FreePool (Task);
}
@@ -71,10 +73,10 @@ FatDestroyTask (
**/
VOID
FatWaitNonblockingTask (
- FAT_IFILE *IFile
+ FAT_IFILE *IFile
)
{
- BOOLEAN TaskQueueEmpty;
+ BOOLEAN TaskQueueEmpty;
do {
EfiAcquireLock (&FatTaskLock);
@@ -94,10 +96,10 @@ FatWaitNonblockingTask (
**/
LIST_ENTRY *
FatDestroySubtask (
- FAT_SUBTASK *Subtask
+ FAT_SUBTASK *Subtask
)
{
- LIST_ENTRY *Link;
+ LIST_ENTRY *Link;
gBS->CloseEvent (Subtask->DiskIo2Token.Event);
@@ -120,14 +122,14 @@ FatDestroySubtask (
**/
EFI_STATUS
FatQueueTask (
- IN FAT_IFILE *IFile,
- IN FAT_TASK *Task
+ IN FAT_IFILE *IFile,
+ IN FAT_TASK *Task
)
{
- EFI_STATUS Status;
- LIST_ENTRY *Link;
- LIST_ENTRY *NextLink;
- FAT_SUBTASK *Subtask;
+ EFI_STATUS Status;
+ LIST_ENTRY *Link;
+ LIST_ENTRY *NextLink;
+ FAT_SUBTASK *Subtask;
//
// Sometimes the Task doesn't contain any subtasks, signal the event directly.
@@ -153,12 +155,12 @@ FatQueueTask (
// handle list elements being removed during the traverse.
//
for ( Link = GetFirstNode (&Task->Subtasks), NextLink = GetNextNode (&Task->Subtasks, Link)
- ; Link != &Task->Subtasks
- ; Link = NextLink, NextLink = Link->ForwardLink
- ) {
+ ; Link != &Task->Subtasks
+ ; Link = NextLink, NextLink = Link->ForwardLink
+ )
+ {
Subtask = CR (Link, FAT_SUBTASK, Link, FAT_SUBTASK_SIGNATURE);
if (Subtask->Write) {
-
Status = IFile->OFile->Volume->DiskIo2->WriteDiskEx (
IFile->OFile->Volume->DiskIo2,
IFile->OFile->Volume->MediaId,
@@ -177,6 +179,7 @@ FatQueueTask (
Subtask->Buffer
);
}
+
if (EFI_ERROR (Status)) {
break;
}
@@ -191,7 +194,7 @@ FatQueueTask (
//
while (!IsNull (&Task->Subtasks, Link)) {
Subtask = CR (Link, FAT_SUBTASK, Link, FAT_SUBTASK_SIGNATURE);
- Link = FatDestroySubtask (Subtask);
+ Link = FatDestroySubtask (Subtask);
}
if (IsListEmpty (&Task->Subtasks)) {
@@ -225,12 +228,12 @@ FatQueueTask (
**/
EFI_STATUS
FatAccessVolumeDirty (
- IN FAT_VOLUME *Volume,
- IN IO_MODE IoMode,
- IN VOID *DirtyValue
+ IN FAT_VOLUME *Volume,
+ IN IO_MODE IoMode,
+ IN VOID *DirtyValue
)
{
- UINTN WriteCount;
+ UINTN WriteCount;
WriteCount = Volume->FatEntrySize;
return FatDiskIo (Volume, IoMode, Volume->FatPos + WriteCount, WriteCount, DirtyValue, NULL);
@@ -247,20 +250,20 @@ FatAccessVolumeDirty (
VOID
EFIAPI
FatOnAccessComplete (
- IN EFI_EVENT Event,
- IN VOID *Context
+ IN EFI_EVENT Event,
+ IN VOID *Context
)
{
- EFI_STATUS Status;
- FAT_SUBTASK *Subtask;
- FAT_TASK *Task;
+ EFI_STATUS Status;
+ FAT_SUBTASK *Subtask;
+ FAT_TASK *Task;
//
// Avoid someone in future breaks the below assumption.
//
ASSERT (EfiGetCurrentTpl () == FatTaskLock.Tpl);
- Subtask = (FAT_SUBTASK *) Context;
+ Subtask = (FAT_SUBTASK *)Context;
Task = Subtask->Task;
Status = Subtask->DiskIo2Token.TransactionStatus;
@@ -310,12 +313,12 @@ FatOnAccessComplete (
**/
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
+ IN FAT_VOLUME *Volume,
+ IN IO_MODE IoMode,
+ IN UINT64 Offset,
+ IN UINTN BufferSize,
+ IN OUT VOID *Buffer,
+ IN FAT_TASK *Task
)
{
EFI_STATUS Status;
@@ -341,30 +344,30 @@ FatDiskIo (
//
// Blocking access
//
- DiskIo = Volume->DiskIo;
- IoFunction = (IoMode == ReadDisk) ? DiskIo->ReadDisk : DiskIo->WriteDisk;
- Status = IoFunction (DiskIo, Volume->MediaId, Offset, BufferSize, Buffer);
+ DiskIo = Volume->DiskIo;
+ IoFunction = (IoMode == ReadDisk) ? DiskIo->ReadDisk : DiskIo->WriteDisk;
+ Status = IoFunction (DiskIo, Volume->MediaId, Offset, BufferSize, Buffer);
} else {
//
// Non-blocking access
//
Subtask = AllocateZeroPool (sizeof (*Subtask));
if (Subtask == NULL) {
- Status = EFI_OUT_OF_RESOURCES;
+ Status = EFI_OUT_OF_RESOURCES;
} else {
Subtask->Signature = FAT_SUBTASK_SIGNATURE;
Subtask->Task = Task;
- Subtask->Write = (BOOLEAN) (IoMode == WriteDisk);
+ Subtask->Write = (BOOLEAN)(IoMode == WriteDisk);
Subtask->Offset = Offset;
Subtask->Buffer = Buffer;
Subtask->BufferSize = BufferSize;
- Status = gBS->CreateEvent (
- EVT_NOTIFY_SIGNAL,
- TPL_NOTIFY,
- FatOnAccessComplete,
- Subtask,
- &Subtask->DiskIo2Token.Event
- );
+ Status = gBS->CreateEvent (
+ EVT_NOTIFY_SIGNAL,
+ TPL_NOTIFY,
+ FatOnAccessComplete,
+ Subtask,
+ &Subtask->DiskIo2Token.Event
+ );
if (!EFI_ERROR (Status)) {
InsertTailList (&Task->Subtasks, &Subtask->Link);
} else {
@@ -436,7 +439,7 @@ FatReleaseLock (
**/
VOID
FatFreeDirEnt (
- IN FAT_DIRENT *DirEnt
+ IN FAT_DIRENT *DirEnt
)
{
if (DirEnt->FileString != NULL) {
@@ -455,7 +458,7 @@ FatFreeDirEnt (
**/
VOID
FatFreeVolume (
- IN FAT_VOLUME *Volume
+ IN FAT_VOLUME *Volume
)
{
//
@@ -464,6 +467,7 @@ FatFreeVolume (
if (Volume->CacheBuffer != NULL) {
FreePool (Volume->CacheBuffer);
}
+
//
// Free directory cache
//
@@ -481,26 +485,26 @@ FatFreeVolume (
**/
VOID
FatEfiTimeToFatTime (
- IN EFI_TIME *ETime,
- OUT FAT_DATE_TIME *FTime
+ IN EFI_TIME *ETime,
+ OUT FAT_DATE_TIME *FTime
)
{
//
// ignores timezone info in source ETime
//
if (ETime->Year > 1980) {
- FTime->Date.Year = (UINT16) (ETime->Year - 1980);
+ FTime->Date.Year = (UINT16)(ETime->Year - 1980);
}
if (ETime->Year >= 1980 + FAT_MAX_YEAR_FROM_1980) {
FTime->Date.Year = FAT_MAX_YEAR_FROM_1980;
}
- FTime->Date.Month = ETime->Month;
- FTime->Date.Day = ETime->Day;
- FTime->Time.Hour = ETime->Hour;
- FTime->Time.Minute = ETime->Minute;
- FTime->Time.DoubleSecond = (UINT16) (ETime->Second / 2);
+ FTime->Date.Month = ETime->Month;
+ FTime->Date.Day = ETime->Day;
+ FTime->Time.Hour = ETime->Hour;
+ FTime->Time.Minute = ETime->Minute;
+ FTime->Time.DoubleSecond = (UINT16)(ETime->Second / 2);
}
/**
@@ -513,16 +517,16 @@ FatEfiTimeToFatTime (
**/
VOID
FatFatTimeToEfiTime (
- IN FAT_DATE_TIME *FTime,
- OUT EFI_TIME *ETime
+ IN FAT_DATE_TIME *FTime,
+ OUT EFI_TIME *ETime
)
{
- 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;
- ETime->Minute = (UINT8) FTime->Time.Minute;
- ETime->Second = (UINT8) (FTime->Time.DoubleSecond * 2);
+ 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;
+ ETime->Minute = (UINT8)FTime->Time.Minute;
+ ETime->Second = (UINT8)(FTime->Time.DoubleSecond * 2);
ETime->Nanosecond = 0;
ETime->TimeZone = EFI_UNSPECIFIED_TIMEZONE;
ETime->Daylight = 0;
@@ -537,20 +541,20 @@ FatFatTimeToEfiTime (
**/
VOID
FatGetCurrentFatTime (
- OUT FAT_DATE_TIME *FatNow
+ OUT FAT_DATE_TIME *FatNow
)
{
- EFI_STATUS Status;
- EFI_TIME Now;
+ EFI_STATUS Status;
+ EFI_TIME Now;
Status = gRT->GetTime (&Now, NULL);
if (!EFI_ERROR (Status)) {
FatEfiTimeToFatTime (&Now, FatNow);
} else {
ZeroMem (&Now, sizeof (EFI_TIME));
- Now.Year = 1980;
+ Now.Year = 1980;
Now.Month = 1;
- Now.Day = 1;
+ Now.Day = 1;
FatEfiTimeToFatTime (&Now, FatNow);
}
}
@@ -567,11 +571,11 @@ FatGetCurrentFatTime (
**/
BOOLEAN
FatIsValidTime (
- IN EFI_TIME *Time
+ IN EFI_TIME *Time
)
{
- UINTN Day;
- BOOLEAN ValidTime;
+ UINTN Day;
+ BOOLEAN ValidTime;
ValidTime = TRUE;
@@ -579,30 +583,30 @@ FatIsValidTime (
// Check the fields for range problems
// Fat can only support from 1980
//
- if (Time->Year < 1980 ||
- Time->Month < 1 ||
- Time->Month > 12 ||
- Time->Day < 1 ||
- Time->Day > 31 ||
- Time->Hour > 23 ||
- Time->Minute > 59 ||
- Time->Second > 59 ||
- Time->Nanosecond > 999999999
- ) {
-
+ if ((Time->Year < 1980) ||
+ (Time->Month < 1) ||
+ (Time->Month > 12) ||
+ (Time->Day < 1) ||
+ (Time->Day > 31) ||
+ (Time->Hour > 23) ||
+ (Time->Minute > 59) ||
+ (Time->Second > 59) ||
+ (Time->Nanosecond > 999999999)
+ )
+ {
ValidTime = FALSE;
-
} else {
//
// Perform a more specific check of the day of the month
//
Day = mMonthDays[Time->Month - 1];
- if (Time->Month == 2 && IS_LEAP_YEAR (Time->Year)) {
+ if ((Time->Month == 2) && IS_LEAP_YEAR (Time->Year)) {
Day += 1;
//
// 1 extra day this month
//
}
+
if (Time->Day > Day) {
ValidTime = FALSE;
}