/** @file\r
FAT file system access routines for FAT recovery PEIM\r
\r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>\r
\r
This program and the accompanying materials are licensed and made available\r
under the terms and conditions of the BSD License which accompanies this\r
}\r
\r
File->CurrentPos += Pos;\r
-\r
+ //\r
+ // Calculate the amount of consecutive cluster occupied by the file.\r
+ // FatReadFile() will use it to read these blocks once.\r
+ //\r
File->StraightReadAmount = 0;\r
Cluster = File->CurrentCluster;\r
while (!FAT_CLUSTER_FUNCTIONAL (Cluster)) {\r
} else {\r
\r
if ((File->Attributes & FAT_ATTR_DIRECTORY) == 0) {\r
- Size = Size < (File->FileSize - File->CurrentPos) ? Size : (UINTN) (File->FileSize - File->CurrentPos);\r
+ Size = Size < (File->FileSize - File->CurrentPos) ? Size : (File->FileSize - File->CurrentPos);\r
}\r
//\r
// This is a normal cluster based file\r
// We only search for *FILE* in root directory\r
// Long file name entry is *NOT* supported\r
//\r
- if ((DirEntry.Attributes == FAT_ATTR_DIRECTORY) || (DirEntry.Attributes == FAT_ATTR_LFN)) {\r
+ if (((DirEntry.Attributes & FAT_ATTR_DIRECTORY) == FAT_ATTR_DIRECTORY) || (DirEntry.Attributes == FAT_ATTR_LFN)) {\r
continue;\r
}\r
//\r
SubFile->StartingCluster = SubFile->CurrentCluster;\r
SubFile->Volume = ParentDir->Volume;\r
\r
- if (SubFile->StartingCluster != 0) {\r
- Status = FatSetFilePos (PrivateData, SubFile, 0);\r
- }\r
//\r
// in Pei phase, time parameters do not need to be filled for minimum use.\r
//\r