]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Ebl/Dir.c
Update the copyright notice format
[mirror_edk2.git] / EmbeddedPkg / Ebl / Dir.c
index ff1b557ed18a20e2d954e54dda9714f3b9adbd1e..3bd072d584d801074012e42ea705ff493564dd01 100644 (file)
@@ -1,11 +1,11 @@
 /** @file\r
   Dir for EBL (Embedded Boot Loader)\r
 \r
-  Copyright (c) 2007, Intel Corporation<BR>\r
-  Portions copyright (c) 2008-2009, Apple Inc. All rights reserved.\r
+  Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>\r
+  Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.<BR>\r
 \r
 \r
-  All rights reserved. This program and the accompanying materials\r
+  This program and the accompanying materials\r
   are licensed and made available under the terms and conditions of the BSD License\r
   which accompanies this distribution.  The full text of the license may be found at\r
   http://opensource.org/licenses/bsd-license.php\r
 \r
 GLOBAL_REMOVE_IF_UNREFERENCED   CHAR8 *gFvFileType[] = {\r
   "All",\r
-  "Raw",\r
-  "Freeform",\r
+  "Bin",\r
+  "section",\r
   "SEC",\r
   "PeiCore",\r
   "DxeCore",\r
   "PEIM",\r
   "Driver",\r
-  "Combo Driver",\r
-  "Application",\r
+  "Combo",\r
+  "App",\r
   "NULL",\r
   "FV"\r
 };\r
@@ -89,6 +89,8 @@ EblDirCmd (
   UINTN                         BestMatchCount;\r
   CHAR16                        UnicodeFileName[MAX_CMD_LINE];\r
   CHAR8                         *Path;\r
+  CHAR8                         *TypeStr;\r
+  UINTN                         TotalSize;\r
 \r
 \r
   if (Argc <= 1) {\r
@@ -142,6 +144,7 @@ EblDirCmd (
       }\r
     }\r
 \r
+    TotalSize = 0;\r
     Fv = File->Fv;\r
     Key = 0;\r
     CurrentRow = 0;\r
@@ -156,10 +159,11 @@ EblDirCmd (
                                 &Size\r
                                 );\r
       if (!EFI_ERROR (GetNextFileStatus)) {\r
-         // Calculate size of entire file\r
-         Section = NULL;\r
-         Size = 0;\r
-         Status = Fv->ReadFile (\r
+        TotalSize += Size;\r
+        // Calculate size of entire file\r
+        Section = NULL;\r
+        Size = 0;\r
+        Status = Fv->ReadFile (\r
                       Fv,\r
                       &NameGuid, \r
                       Section,\r
@@ -168,10 +172,12 @@ EblDirCmd (
                       &Attributes,\r
                       &AuthenticationStatus\r
                       );\r
-         if (!((Status == EFI_BUFFER_TOO_SMALL) || !EFI_ERROR (Status))) {\r
+        if (!((Status == EFI_BUFFER_TOO_SMALL) || !EFI_ERROR (Status))) {\r
           // EFI_SUCCESS or EFI_BUFFER_TOO_SMALL mean size is valid \r
           Size = 0;\r
-         }\r
+        }\r
+        \r
+        TypeStr = (Type <= EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) ? gFvFileType[Type] : "UNKNOWN";\r
 \r
         // read the UI seciton to do a name match.\r
         Section = NULL;\r
@@ -186,7 +192,7 @@ EblDirCmd (
                         );\r
         if (!EFI_ERROR (Status)) {\r
           if (StrStr (Section, MatchSubString) != NULL) {\r
-            AsciiPrint ("  %g %s %a %,d\n", &NameGuid, Section, gFvFileType[Type], Size);\r
+            AsciiPrint ("%,9d %7a %g %s\n", Size, TypeStr, &NameGuid, Section);\r
             if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {\r
               break;\r
             }\r
@@ -194,7 +200,7 @@ EblDirCmd (
           FreePool (Section);\r
         } else {\r
           if (*MatchSubString == '\0') {\r
-            AsciiPrint ("  %g %a %,d\n", &NameGuid, gFvFileType[Type], Size);\r
+            AsciiPrint ("%,9d %7a %g\n", Size, TypeStr, &NameGuid);\r
             if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {\r
               break;\r
             }\r
@@ -203,6 +209,11 @@ EblDirCmd (
       }\r
     } while (!EFI_ERROR (GetNextFileStatus));\r
        \r
+    if (SearchType == EFI_FV_FILETYPE_ALL) {\r
+      AsciiPrint ("%,20d bytes in files %,d bytes free\n", TotalSize, File->FvSize - File->FvHeaderSize - TotalSize);\r
+    }\r
+    \r
+    \r
   } else if ((File->Type == EfiOpenFileSystem) || (File->Type == EfiOpenBlockIo)) {\r
     // Simple File System DIR\r
 \r