]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Only traverse recovery file's FAT table to fast the recovery performance.
authorFeng Tian <feng.tian@intel.com>
Tue, 22 Nov 2011 03:01:14 +0000 (03:01 +0000)
committerJordan Justen <jordan.l.justen@intel.com>
Thu, 7 Apr 2016 06:22:43 +0000 (23:22 -0700)
Signed-off-by: erictian
Reviewed-by: niruiyu
(based on FatPkg commit 6e68a62cf0c6b8ecad2bceff4e8d86ff08d1f041)

[jordan.l.justen@intel.com: Use script to relicense to 2-clause BSD]
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Acked-by: Mark Doran <mark.doran@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
FatPkg/FatPei/FatLiteAccess.c
FatPkg/FatPei/FatLiteApi.c

index 0a688a3185e6971779cd9b5dfd2269ea84978f90..53f5e3f60cbbc118c01846b66fc99e9ea43257bb 100644 (file)
@@ -1,7 +1,7 @@
 /** @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 - 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
@@ -315,7 +315,10 @@ FatSetFilePos (
     }\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
@@ -517,9 +520,6 @@ FatReadNextDirectoryEntry (
   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
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