/* Search the Root OFile for the possible volume label. */
STATIC EFI_STATUS FatSeekVolumeId(IN FAT_OFILE *Root, OUT FAT_DIRENT *DirEnt)
/* Search the Root OFile for the possible volume label. */
STATIC EFI_STATUS FatSeekVolumeId(IN FAT_OFILE *Root, OUT FAT_DIRENT *DirEnt)
{
  EFI_STATUS           Status;
  UINTN                EntryPos;
  FAT_DIRECTORY_ENTRY  *Entry;
  EntryPos        = 0;
  Entry           = &DirEnt->Entry;
  DirEnt->Invalid = TRUE;
  do {
    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)) {
      DirEnt->EntryPos   = (UINT16)EntryPos;
      DirEnt->EntryCount = 1;
      DirEnt->Invalid    = FALSE;
      break;
    }
    EntryPos++;
  } while (Entry->FileName[0] != EMPTY_ENTRY_MARK);
  return EFI_SUCCESS;
}