VirtualBox

Ignore:
Timestamp:
Apr 14, 2023 3:17:44 PM (23 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
156854
Message:

Devices/EFI/FirmwareNew: Update to edk2-stable202302 and make it build, bugref:4643

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew

  • trunk/src/VBox/Devices/EFI/FirmwareNew/FatPkg/EnhancedFatDxe/DirectoryManage.c

    r85718 r99404  
    2525EFI_STATUS
    2626FatAccessEntry (
    27   IN     FAT_OFILE            *Parent,
    28   IN     IO_MODE              IoMode,
    29   IN     UINTN                EntryPos,
    30   IN OUT VOID                 *Entry
    31   )
    32 {
    33   UINTN Position;
    34   UINTN BufferSize;
     27  IN     FAT_OFILE  *Parent,
     28  IN     IO_MODE    IoMode,
     29  IN     UINTN      EntryPos,
     30  IN OUT VOID       *Entry
     31  )
     32{
     33  UINTN  Position;
     34  UINTN  BufferSize;
    3535
    3636  Position = EntryPos * sizeof (FAT_DIRECTORY_ENTRY);
     
    4040    //
    4141    ASSERT (IoMode == ReadData);
    42     ((FAT_DIRECTORY_ENTRY *) Entry)->FileName[0] = EMPTY_ENTRY_MARK;
    43     ((FAT_DIRECTORY_ENTRY *) Entry)->Attributes  = 0;
     42    ((FAT_DIRECTORY_ENTRY *)Entry)->FileName[0] = EMPTY_ENTRY_MARK;
     43    ((FAT_DIRECTORY_ENTRY *)Entry)->Attributes  = 0;
    4444    return EFI_SUCCESS;
    4545  }
     
    6262EFI_STATUS
    6363FatStoreDirEnt (
    64   IN FAT_OFILE            *OFile,
    65   IN FAT_DIRENT           *DirEnt
    66   )
    67 {
    68   EFI_STATUS        Status;
    69   FAT_DIRECTORY_LFN LfnEntry;
    70   UINTN             EntryPos;
    71   CHAR16            *LfnBufferPointer;
    72   CHAR16            LfnBuffer[MAX_LFN_ENTRIES * LFN_CHAR_TOTAL + 1];
    73   UINT8             EntryCount;
    74   UINT8             LfnOrdinal;
     64  IN FAT_OFILE   *OFile,
     65  IN FAT_DIRENT  *DirEnt
     66  )
     67{
     68  EFI_STATUS         Status;
     69  FAT_DIRECTORY_LFN  LfnEntry;
     70  UINTN              EntryPos;
     71  CHAR16             *LfnBufferPointer;
     72  CHAR16             LfnBuffer[MAX_LFN_ENTRIES * LFN_CHAR_TOTAL + 1];
     73  UINT8              EntryCount;
     74  UINT8              LfnOrdinal;
    7575
    7676  EntryPos   = DirEnt->EntryPos;
     
    146146{
    147147  CHAR16  *FileString;
     148
    148149  FileString = DirEnt->FileString;
    149   if (StrCmp (FileString, L".") == 0 || StrCmp (FileString, L"..") == 0) {
     150  if ((StrCmp (FileString, L".") == 0) || (StrCmp (FileString, L"..") == 0)) {
    150151    return TRUE;
    151152  }
     
    164165VOID
    165166FatSetDirEntCluster (
    166   IN FAT_OFILE    *OFile
     167  IN FAT_OFILE  *OFile
    167168  )
    168169{
     
    172173  DirEnt                        = OFile->DirEnt;
    173174  Cluster                       = OFile->FileCluster;
    174   DirEnt->Entry.FileClusterHigh = (UINT16) (Cluster >> 16);
    175   DirEnt->Entry.FileCluster     = (UINT16) Cluster;
     175  DirEnt->Entry.FileClusterHigh = (UINT16)(Cluster >> 16);
     176  DirEnt->Entry.FileCluster     = (UINT16)Cluster;
    176177}
    177178
     
    185186VOID
    186187FatUpdateDirEntClusterSizeInfo (
    187   IN FAT_OFILE    *OFile
     188  IN FAT_OFILE  *OFile
    188189  )
    189190{
    190191  ASSERT (OFile->ODir == NULL);
    191   OFile->DirEnt->Entry.FileSize = (UINT32) OFile->FileSize;
     192  OFile->DirEnt->Entry.FileSize = (UINT32)OFile->FileSize;
    192193  FatSetDirEntCluster (OFile);
    193194}
     
    203204VOID
    204205FatCloneDirEnt (
    205   IN  FAT_DIRENT          *DirEnt1,
    206   IN  FAT_DIRENT          *DirEnt2
    207   )
    208 {
    209   UINT8 *Entry1;
    210   UINT8 *Entry2;
    211   Entry1  = (UINT8 *) &DirEnt1->Entry;
    212   Entry2  = (UINT8 *) &DirEnt2->Entry;
     206  IN  FAT_DIRENT  *DirEnt1,
     207  IN  FAT_DIRENT  *DirEnt2
     208  )
     209{
     210  UINT8  *Entry1;
     211  UINT8  *Entry2;
     212
     213  Entry1 = (UINT8 *)&DirEnt1->Entry;
     214  Entry2 = (UINT8 *)&DirEnt2->Entry;
    213215  CopyMem (
    214216    Entry1 + FAT_ENTRY_INFO_OFFSET,
     
    229231VOID
    230232FatLoadLongNameEntry (
    231   IN FAT_OFILE           *Parent,
    232   IN FAT_DIRENT          *DirEnt
    233   )
    234 {
    235   CHAR16            LfnBuffer[MAX_LFN_ENTRIES * LFN_CHAR_TOTAL + 1];
    236   CHAR16            *LfnBufferPointer;
    237   CHAR8             *File8Dot3Name;
    238   UINTN             EntryPos;
    239   UINT8             LfnOrdinal;
    240   UINT8             LfnChecksum;
    241   FAT_DIRECTORY_LFN LfnEntry;
    242   EFI_STATUS        Status;
    243 
    244   EntryPos          = DirEnt->EntryPos;
    245   File8Dot3Name     = DirEnt->Entry.FileName;
    246   LfnBufferPointer  = LfnBuffer;
     233  IN FAT_OFILE   *Parent,
     234  IN FAT_DIRENT  *DirEnt
     235  )
     236{
     237  CHAR16             LfnBuffer[MAX_LFN_ENTRIES * LFN_CHAR_TOTAL + 1];
     238  CHAR16             *LfnBufferPointer;
     239  CHAR8              *File8Dot3Name;
     240  UINTN              EntryPos;
     241  UINT8              LfnOrdinal;
     242  UINT8              LfnChecksum;
     243  FAT_DIRECTORY_LFN  LfnEntry;
     244  EFI_STATUS         Status;
     245
     246  EntryPos         = DirEnt->EntryPos;
     247  File8Dot3Name    = DirEnt->Entry.FileName;
     248  LfnBufferPointer = LfnBuffer;
    247249  //
    248250  // Computes checksum for LFN
     
    259261    Status = FatAccessEntry (Parent, ReadData, EntryPos, &LfnEntry);
    260262    if (EFI_ERROR (Status) ||
    261         LfnEntry.Attributes != FAT_ATTRIBUTE_LFN ||
    262         LfnEntry.MustBeZero != 0 ||
    263         LfnEntry.Checksum != LfnChecksum ||
    264         (LfnEntry.Ordinal & (~FAT_LFN_LAST)) != LfnOrdinal ||
    265         LfnOrdinal > MAX_LFN_ENTRIES
    266         ) {
     263        (LfnEntry.Attributes != FAT_ATTRIBUTE_LFN) ||
     264        (LfnEntry.MustBeZero != 0) ||
     265        (LfnEntry.Checksum != LfnChecksum) ||
     266        ((LfnEntry.Ordinal & (~FAT_LFN_LAST)) != LfnOrdinal) ||
     267        (LfnOrdinal > MAX_LFN_ENTRIES)
     268        )
     269    {
    267270      //
    268271      // The directory entry does not have a long file name or
     
    282285    LfnOrdinal++;
    283286  } while ((LfnEntry.Ordinal & FAT_LFN_LAST) == 0);
     287
    284288  DirEnt->EntryCount = LfnOrdinal;
    285289  //
     
    313317VOID
    314318FatAddDirEnt (
    315   IN FAT_ODIR             *ODir,
    316   IN FAT_DIRENT           *DirEnt
     319  IN FAT_ODIR    *ODir,
     320  IN FAT_DIRENT  *DirEnt
    317321  )
    318322{
     
    320324    DirEnt->Link.BackLink = &ODir->ChildList;
    321325  }
     326
    322327  InsertTailList (DirEnt->Link.BackLink, &DirEnt->Link);
    323328  FatInsertToHashTable (ODir, DirEnt);
     
    339344EFI_STATUS
    340345FatLoadNextDirEnt (
    341   IN  FAT_OFILE           *OFile,
    342   OUT FAT_DIRENT          **PtrDirEnt
    343   )
    344 {
    345   EFI_STATUS          Status;
    346   FAT_DIRENT          *DirEnt;
    347   FAT_ODIR            *ODir;
    348   FAT_DIRECTORY_ENTRY Entry;
     346  IN  FAT_OFILE   *OFile,
     347  OUT FAT_DIRENT  **PtrDirEnt
     348  )
     349{
     350  EFI_STATUS           Status;
     351  FAT_DIRENT           *DirEnt;
     352  FAT_ODIR             *ODir;
     353  FAT_DIRECTORY_ENTRY  Entry;
    349354
    350355  ODir = OFile->ODir;
     
    359364  DirEnt = NULL;
    360365
    361   for (;;) {
     366  for ( ; ;) {
    362367    //
    363368    // Read the next directory entry until we find a valid directory entry (excluding lfn entry)
     
    368373    }
    369374
    370     if (((UINT8) Entry.FileName[0] != DELETE_ENTRY_MARK) && (Entry.Attributes & FAT_ATTRIBUTE_VOLUME_ID) == 0) {
     375    if (((UINT8)Entry.FileName[0] != DELETE_ENTRY_MARK) && ((Entry.Attributes & FAT_ATTRIBUTE_VOLUME_ID) == 0)) {
    371376      //
    372377      // We get a valid directory entry, then handle it
     
    399404    // Remember the directory's entry position on disk
    400405    //
    401     DirEnt->EntryPos = (UINT16) ODir->CurrentEndPos;
     406    DirEnt->EntryPos = (UINT16)ODir->CurrentEndPos;
    402407    CopyMem (&DirEnt->Entry, &Entry, sizeof (FAT_DIRECTORY_ENTRY));
    403408    FatLoadLongNameEntry (OFile, DirEnt);
     
    406411      goto Done;
    407412    }
     413
    408414    //
    409415    // Add this directory entry to directory
     
    441447EFI_STATUS
    442448FatGetDirEntInfo (
    443   IN     FAT_VOLUME         *Volume,
    444   IN     FAT_DIRENT         *DirEnt,
    445   IN OUT UINTN              *BufferSize,
    446      OUT VOID               *Buffer
    447   )
    448 {
    449   UINTN               Size;
    450   UINTN               NameSize;
    451   UINTN               ResultSize;
    452   UINTN               Cluster;
    453   EFI_STATUS          Status;
    454   EFI_FILE_INFO       *Info;
    455   FAT_DIRECTORY_ENTRY *Entry;
    456   FAT_DATE_TIME       FatLastAccess;
     449  IN     FAT_VOLUME  *Volume,
     450  IN     FAT_DIRENT  *DirEnt,
     451  IN OUT UINTN       *BufferSize,
     452  OUT VOID           *Buffer
     453  )
     454{
     455  UINTN                Size;
     456  UINTN                NameSize;
     457  UINTN                ResultSize;
     458  UINTN                Cluster;
     459  EFI_STATUS           Status;
     460  EFI_FILE_INFO        *Info;
     461  FAT_DIRECTORY_ENTRY  *Entry;
     462  FAT_DATE_TIME        FatLastAccess;
    457463
    458464  ASSERT_VOLUME_LOCKED (Volume);
    459465
    460   Size        = SIZE_OF_EFI_FILE_INFO;
    461   NameSize    = StrSize (DirEnt->FileString);
    462   ResultSize  = Size + NameSize;
    463 
    464   Status      = EFI_BUFFER_TOO_SMALL;
     466  Size       = SIZE_OF_EFI_FILE_INFO;
     467  NameSize   = StrSize (DirEnt->FileString);
     468  ResultSize = Size + NameSize;
     469
     470  Status = EFI_BUFFER_TOO_SMALL;
    465471  if (*BufferSize >= ResultSize) {
    466     Status      = EFI_SUCCESS;
    467     Entry       = &DirEnt->Entry;
    468     Info        = Buffer;
    469     Info->Size  = ResultSize;
     472    Status     = EFI_SUCCESS;
     473    Entry      = &DirEnt->Entry;
     474    Info       = Buffer;
     475    Info->Size = ResultSize;
    470476    if ((Entry->Attributes & FAT_ATTRIBUTE_DIRECTORY) != 0) {
    471       Cluster             = (Entry->FileClusterHigh << 16) | Entry->FileCluster;
    472       Info->PhysicalSize  = FatPhysicalDirSize (Volume, Cluster);
    473       Info->FileSize      = Info->PhysicalSize;
     477      Cluster            = (Entry->FileClusterHigh << 16) | Entry->FileCluster;
     478      Info->PhysicalSize = FatPhysicalDirSize (Volume, Cluster);
     479      Info->FileSize     = Info->PhysicalSize;
    474480    } else {
    475       Info->FileSize      = Entry->FileSize;
    476       Info->PhysicalSize  = FatPhysicalFileSize (Volume, Entry->FileSize);
     481      Info->FileSize     = Entry->FileSize;
     482      Info->PhysicalSize = FatPhysicalFileSize (Volume, Entry->FileSize);
    477483    }
    478484
     
    483489    FatFatTimeToEfiTime (&Entry->FileModificationTime, &Info->ModificationTime);
    484490    Info->Attribute = Entry->Attributes & EFI_FILE_VALID_ATTR;
    485     CopyMem ((CHAR8 *) Buffer + Size, DirEnt->FileString, NameSize);
     491    CopyMem ((CHAR8 *)Buffer + Size, DirEnt->FileString, NameSize);
    486492  }
    487493
     
    505511EFI_STATUS
    506512FatSearchODir (
    507   IN  FAT_OFILE      *OFile,
    508   IN  CHAR16         *FileNameString,
    509   OUT FAT_DIRENT     **PtrDirEnt
     513  IN  FAT_OFILE   *OFile,
     514  IN  CHAR16      *FileNameString,
     515  OUT FAT_DIRENT  **PtrDirEnt
    510516  )
    511517{
     
    526532  //
    527533  DirEnt = *FatLongNameHashSearch (ODir, FileNameString);
    528   if (DirEnt == NULL && PossibleShortName) {
    529       DirEnt = *FatShortNameHashSearch (ODir, File8Dot3Name);
    530   }
     534  if ((DirEnt == NULL) && PossibleShortName) {
     535    DirEnt = *FatShortNameHashSearch (ODir, File8Dot3Name);
     536  }
     537
    531538  if (DirEnt == NULL) {
    532539    //
     
    545552        }
    546553
    547         if (PossibleShortName && CompareMem (File8Dot3Name, DirEnt->Entry.FileName, FAT_NAME_LEN) == 0) {
     554        if (PossibleShortName && (CompareMem (File8Dot3Name, DirEnt->Entry.FileName, FAT_NAME_LEN) == 0)) {
    548555          break;
    549556        }
     
    565572VOID
    566573FatResetODirCursor (
    567   IN FAT_OFILE    *OFile
     574  IN FAT_OFILE  *OFile
    568575  )
    569576{
     
    589596EFI_STATUS
    590597FatGetNextDirEnt (
    591   IN  FAT_OFILE     *OFile,
    592   OUT FAT_DIRENT    **PtrDirEnt
     598  IN  FAT_OFILE   *OFile,
     599  OUT FAT_DIRENT  **PtrDirEnt
    593600  )
    594601{
     
    618625    // End of directory, return NULL
    619626    //
    620     DirEnt              = NULL;
    621     ODir->CurrentPos    = ODir->CurrentEndPos;
     627    DirEnt           = NULL;
     628    ODir->CurrentPos = ODir->CurrentEndPos;
    622629  } else {
    623630    ODir->CurrentCursor = ODir->CurrentCursor->ForwardLink;
     
    641648VOID
    642649FatSetEntryCount (
    643   IN FAT_OFILE    *OFile,
    644   IN FAT_DIRENT   *DirEnt
     650  IN FAT_OFILE   *OFile,
     651  IN FAT_DIRENT  *DirEnt
    645652  )
    646653{
     
    651658  // Get new entry count and set the 8.3 name
    652659  //
    653   DirEnt->EntryCount  = 1;
    654   FileString          = DirEnt->FileString;
    655   File8Dot3Name       = DirEnt->Entry.FileName;
     660  DirEnt->EntryCount = 1;
     661  FileString         = DirEnt->FileString;
     662  File8Dot3Name      = DirEnt->Entry.FileName;
    656663  SetMem (File8Dot3Name, FAT_NAME_LEN, ' ');
    657664  if (StrCmp (FileString, L".") == 0) {
     
    665672    // ".." entry
    666673    //
    667     File8Dot3Name[0]  = '.';
    668     File8Dot3Name[1]  = '.';
     674    File8Dot3Name[0] = '.';
     675    File8Dot3Name[1] = '.';
    669676    FatCloneDirEnt (DirEnt, OFile->Parent->DirEnt);
    670677  } else {
     
    720727EFI_STATUS
    721728FatSeekVolumeId (
    722   IN  FAT_OFILE            *Root,
    723   OUT FAT_DIRENT           *DirEnt
    724   )
    725 {
    726   EFI_STATUS          Status;
    727   UINTN               EntryPos;
    728   FAT_DIRECTORY_ENTRY *Entry;
     729  IN  FAT_OFILE   *Root,
     730  OUT FAT_DIRENT  *DirEnt
     731  )
     732{
     733  EFI_STATUS           Status;
     734  UINTN                EntryPos;
     735  FAT_DIRECTORY_ENTRY  *Entry;
    729736
    730737  EntryPos        = 0;
     
    737744    }
    738745
    739     if (((UINT8) Entry->FileName[0] != DELETE_ENTRY_MARK) && (((Entry->Attributes) & (~FAT_ATTRIBUTE_ARCHIVE)) == FAT_ATTRIBUTE_VOLUME_ID)) {
    740       DirEnt->EntryPos   = (UINT16) EntryPos;
     746    if (((UINT8)Entry->FileName[0] != DELETE_ENTRY_MARK) && (((Entry->Attributes) & (~FAT_ATTRIBUTE_ARCHIVE)) == FAT_ATTRIBUTE_VOLUME_ID)) {
     747      DirEnt->EntryPos   = (UINT16)EntryPos;
    741748      DirEnt->EntryCount = 1;
    742749      DirEnt->Invalid    = FALSE;
     
    746753    EntryPos++;
    747754  } while (Entry->FileName[0] != EMPTY_ENTRY_MARK);
     755
    748756  return EFI_SUCCESS;
    749757}
     
    767775EFI_STATUS
    768776FatFirstFitInsertDirEnt (
    769   IN FAT_OFILE    *OFile,
    770   IN FAT_DIRENT   *DirEnt
    771   )
    772 {
    773   EFI_STATUS      Status;
    774   FAT_ODIR        *ODir;
    775   LIST_ENTRY      *CurrentEntry;
    776   FAT_DIRENT      *CurrentDirEnt;
    777   UINT32          CurrentPos;
    778   UINT32          LabelPos;
    779   UINT32          NewEntryPos;
    780   UINT16          EntryCount;
    781   FAT_DIRENT      LabelDirEnt;
     777  IN FAT_OFILE   *OFile,
     778  IN FAT_DIRENT  *DirEnt
     779  )
     780{
     781  EFI_STATUS  Status;
     782  FAT_ODIR    *ODir;
     783  LIST_ENTRY  *CurrentEntry;
     784  FAT_DIRENT  *CurrentDirEnt;
     785  UINT32      CurrentPos;
     786  UINT32      LabelPos;
     787  UINT32      NewEntryPos;
     788  UINT16      EntryCount;
     789  FAT_DIRENT  LabelDirEnt;
    782790
    783791  LabelPos = 0;
     
    800808       CurrentEntry != &ODir->ChildList;
    801809       CurrentEntry = CurrentEntry->ForwardLink
    802       ) {
     810       )
     811  {
    803812    CurrentDirEnt = DIRENT_FROM_LINK (CurrentEntry);
    804813    if (NewEntryPos + CurrentDirEnt->EntryCount <= CurrentDirEnt->EntryPos) {
    805       if (LabelPos > NewEntryPos || LabelPos <= CurrentPos) {
     814      if ((LabelPos > NewEntryPos) || (LabelPos <= CurrentPos)) {
    806815        //
    807816        // first fit succeeded
     
    820829
    821830Done:
    822   DirEnt->EntryPos   = (UINT16) NewEntryPos;
     831  DirEnt->EntryPos      = (UINT16)NewEntryPos;
    823832  DirEnt->Link.BackLink = CurrentEntry;
    824833  return EFI_SUCCESS;
     
    840849EFI_STATUS
    841850FatNewEntryPos (
    842   IN FAT_OFILE    *OFile,
    843   IN FAT_DIRENT   *DirEnt
     851  IN FAT_OFILE   *OFile,
     852  IN FAT_DIRENT  *DirEnt
    844853  )
    845854{
     
    860869    }
    861870  }
     871
    862872  //
    863873  // We will append this entry to the end of directory
     
    874884      return FatFirstFitInsertDirEnt (OFile, DirEnt);
    875885    }
     886
    876887    //
    877888    // We should allocate a new cluster for this directory
     
    882893    }
    883894  }
     895
    884896  //
    885897  // We append our directory entry at the end of directory file
    886898  //
    887899  ODir->CurrentEndPos = NewEndPos;
    888   DirEnt->EntryPos = (UINT16) (ODir->CurrentEndPos - 1);
     900  DirEnt->EntryPos    = (UINT16)(ODir->CurrentEndPos - 1);
    889901  return EFI_SUCCESS;
    890902}
     
    903915EFI_STATUS
    904916FatGetVolumeEntry (
    905   IN FAT_VOLUME           *Volume,
    906   IN CHAR16               *Name
     917  IN FAT_VOLUME  *Volume,
     918  IN CHAR16      *Name
    907919  )
    908920{
     
    910922  FAT_DIRENT  LabelDirEnt;
    911923
    912   *Name   = 0;
    913   Status  = FatSeekVolumeId (Volume->Root, &LabelDirEnt);
     924  *Name  = 0;
     925  Status = FatSeekVolumeId (Volume->Root, &LabelDirEnt);
    914926  if (!EFI_ERROR (Status)) {
    915927    if (!LabelDirEnt.Invalid) {
     
    935947EFI_STATUS
    936948FatSetVolumeEntry (
    937   IN FAT_VOLUME           *Volume,
    938   IN CHAR16               *Name
     949  IN FAT_VOLUME  *Volume,
     950  IN CHAR16      *Name
    939951  )
    940952{
     
    943955  FAT_OFILE   *Root;
    944956
    945   Root    = Volume->Root;
    946   Status  = FatSeekVolumeId (Volume->Root, &LabelDirEnt);
     957  Root   = Volume->Root;
     958  Status = FatSeekVolumeId (Volume->Root, &LabelDirEnt);
    947959  if (EFI_ERROR (Status)) {
    948960    return Status;
     
    984996EFI_STATUS
    985997FatCreateDotDirEnts (
    986   IN FAT_OFILE          *OFile
     998  IN FAT_OFILE  *OFile
    987999  )
    9881000{
     
    10031015    return Status;
    10041016  }
     1017
    10051018  //
    10061019  // Create ".."
     
    10261039EFI_STATUS
    10271040FatCreateDirEnt (
    1028   IN  FAT_OFILE         *OFile,
    1029   IN  CHAR16            *FileName,
    1030   IN  UINT8             Attributes,
    1031   OUT FAT_DIRENT        **PtrDirEnt
     1041  IN  FAT_OFILE   *OFile,
     1042  IN  CHAR16      *FileName,
     1043  IN  UINT8       Attributes,
     1044  OUT FAT_DIRENT  **PtrDirEnt
    10321045  )
    10331046{
     
    10441057  }
    10451058
    1046   DirEnt->Signature   = FAT_DIRENT_SIGNATURE;
    1047   DirEnt->FileString  = AllocateCopyPool (StrSize (FileName), FileName);
     1059  DirEnt->Signature  = FAT_DIRENT_SIGNATURE;
     1060  DirEnt->FileString = AllocateCopyPool (StrSize (FileName), FileName);
    10481061  if (DirEnt->FileString == NULL) {
    10491062    Status = EFI_OUT_OF_RESOURCES;
    10501063    goto Done;
    10511064  }
     1065
    10521066  //
    10531067  // Determine how many directory entries we need
     
    10651079  DirEnt->Entry.Attributes = Attributes;
    10661080  *PtrDirEnt               = DirEnt;
    1067   DEBUG ((EFI_D_INFO, "FSOpen: Created new directory entry '%S'\n", DirEnt->FileString));
     1081  DEBUG ((DEBUG_INFO, "FSOpen: Created new directory entry '%S'\n", DirEnt->FileString));
    10681082  return FatStoreDirEnt (OFile, DirEnt);
    10691083
     
    10861100EFI_STATUS
    10871101FatRemoveDirEnt (
    1088   IN FAT_OFILE    *OFile,
    1089   IN FAT_DIRENT   *DirEnt
     1102  IN FAT_OFILE   *OFile,
     1103  IN FAT_DIRENT  *DirEnt
    10901104  )
    10911105{
     
    10991113    ODir->CurrentCursor = ODir->CurrentCursor->BackLink;
    11001114  }
     1115
    11011116  //
    11021117  // Remove from directory entry list
     
    11261141EFI_STATUS
    11271142FatOpenDirEnt (
    1128   IN FAT_OFILE         *Parent,
    1129   IN FAT_DIRENT        *DirEnt
     1143  IN FAT_OFILE   *Parent,
     1144  IN FAT_DIRENT  *DirEnt
    11301145  )
    11311146{
     
    11591174      // The newly created OFile is root
    11601175      //
    1161       Volume                = VOLUME_FROM_ROOT_DIRENT (DirEnt);
    1162       Volume->Root          = OFile;
    1163       OFile->FileCluster    = Volume->RootCluster;
     1176      Volume             = VOLUME_FROM_ROOT_DIRENT (DirEnt);
     1177      Volume->Root       = OFile;
     1178      OFile->FileCluster = Volume->RootCluster;
    11641179      if (Volume->FatType  != Fat32) {
    1165         OFile->IsFixedRootDir  = TRUE;
     1180        OFile->IsFixedRootDir = TRUE;
    11661181      }
    11671182    }
    11681183
    1169     OFile->FileCurrentCluster  = OFile->FileCluster;
    1170     OFile->Volume              = Volume;
     1184    OFile->FileCurrentCluster = OFile->FileCluster;
     1185    OFile->Volume             = Volume;
    11711186    InsertHeadList (&Volume->CheckRef, &OFile->CheckLink);
    11721187
     
    12001215VOID
    12011216FatCloseDirEnt (
    1202   IN FAT_DIRENT        *DirEnt
     1217  IN FAT_DIRENT  *DirEnt
    12031218  )
    12041219{
     
    12061221  FAT_VOLUME  *Volume;
    12071222
    1208   OFile   = DirEnt->OFile;
     1223  OFile = DirEnt->OFile;
    12091224  ASSERT (OFile != NULL);
    1210   Volume  = OFile->Volume;
     1225  Volume = OFile->Volume;
    12111226
    12121227  if (OFile->ODir != NULL) {
     
    12521267EFI_STATUS
    12531268FatLocateOFile (
    1254   IN OUT FAT_OFILE        **PtrOFile,
    1255   IN     CHAR16           *FileName,
    1256   IN     UINT8            Attributes,
    1257      OUT CHAR16           *NewFileName
     1269  IN OUT FAT_OFILE  **PtrOFile,
     1270  IN     CHAR16     *FileName,
     1271  IN     UINT8      Attributes,
     1272  OUT CHAR16        *NewFileName
    12581273  )
    12591274{
     
    12741289  }
    12751290
    1276   OFile       = *PtrOFile;
    1277   Volume      = OFile->Volume;
     1291  OFile  = *PtrOFile;
     1292  Volume = OFile->Volume;
    12781293
    12791294  DirIntended = FALSE;
     
    12811296    DirIntended = TRUE;
    12821297  }
     1298
    12831299  //
    12841300  // If name starts with path name separator, then move to root OFile
     
    12891305    FileNameLen--;
    12901306  }
     1307
    12911308  //
    12921309  // Per FAT Spec the file name should meet the following criteria:
     
    13011318    return EFI_INVALID_PARAMETER;
    13021319  }
     1320
    13031321  //
    13041322  // Start at current location
    13051323  //
    13061324  Next = FileName;
    1307   for (;;) {
     1325  for ( ; ;) {
    13081326    //
    13091327    // Get the next component name
     
    13161334    //
    13171335    if (ComponentName[0] == 0) {
    1318       if (DirIntended && OFile->ODir == NULL) {
     1336      if (DirIntended && (OFile->ODir == NULL)) {
    13191337        return EFI_NOT_FOUND;
    13201338      }
     
    13231341      break;
    13241342    }
     1343
    13251344    //
    13261345    // If "dot", then current
     
    13291348      continue;
    13301349    }
     1350
    13311351    //
    13321352    // If "dot dot", then parent
     
    13361356        return EFI_INVALID_PARAMETER;
    13371357      }
     1358
    13381359      OFile = OFile->Parent;
    13391360      continue;
     
    13431364      return EFI_INVALID_PARAMETER;
    13441365    }
     1366
    13451367    //
    13461368    // We have a component name, try to open it
     
    13521374      return EFI_NOT_FOUND;
    13531375    }
     1376
    13541377    //
    13551378    // Search the compName in the directory
     
    13681391      }
    13691392
    1370       if (DirIntended && (Attributes & FAT_ATTRIBUTE_DIRECTORY) == 0) {
     1393      if (DirIntended && ((Attributes & FAT_ATTRIBUTE_DIRECTORY) == 0)) {
    13711394        return EFI_INVALID_PARAMETER;
    13721395      }
     1396
    13731397      //
    13741398      // It's the last component name - return with the open
     
    13891413  return EFI_SUCCESS;
    13901414}
    1391 
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette