]> git.proxmox.com Git - mirror_edk2.git/blobdiff - FatPkg/FatPei/FatLiteApi.c
Only traverse recovery file's FAT table to fast the recovery performance.
[mirror_edk2.git] / FatPkg / FatPei / FatLiteApi.c
index bf8158d94f01ea3f165664bdf8b42cd18e41b8e2..46054be284ae1a3b8eb343e55bfc4d5fc963283d 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   FAT recovery PEIM entry point, Ppi Functions and FAT Api functions.\r
 \r
-Copyright (c) 2006 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2011, 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
@@ -577,6 +577,7 @@ FindRecoveryFile (
   //\r
   // Construct root directory file\r
   //\r
+  ZeroMem (&Parent, sizeof (PEI_FAT_FILE));\r
   Parent.IsFixedRootDir   = (BOOLEAN) ((PrivateData->Volume[VolumeIndex].FatType == Fat32) ? FALSE : TRUE);\r
   Parent.Attributes       = FAT_ATTR_DIRECTORY;\r
   Parent.CurrentPos       = 0;\r
@@ -593,6 +594,9 @@ FindRecoveryFile (
   //\r
   Status = FatReadNextDirectoryEntry (PrivateData, &Parent, File);\r
   while (Status == EFI_SUCCESS) {\r
+    //\r
+    // Compare whether the file name is recovery file name.\r
+    //\r
     if (EngStriColl (PrivateData, FileName, File->FileName)) {\r
       break;\r
     }\r
@@ -604,6 +608,13 @@ FindRecoveryFile (
     return EFI_NOT_FOUND;\r
   }\r
 \r
+  //\r
+  // Get the recovery file, set its file position to 0.\r
+  //\r
+  if (File->StartingCluster != 0) {\r
+    Status = FatSetFilePos (PrivateData, File, 0);\r
+  }\r
+\r
   *Handle = File;\r
 \r
   return EFI_SUCCESS;\r