]> git.proxmox.com Git - mirror_edk2.git/blobdiff - EmbeddedPkg/Ebl/Dir.c
Fix help command scroll issue. Also add FV space used, and free space to dir command.
[mirror_edk2.git] / EmbeddedPkg / Ebl / Dir.c
index 126ef5d7c78ca802e01b8a96a1c821b9bb7a043a..2920d6a8e1c9eac2eade26289f609e072e546fae 100644 (file)
@@ -90,6 +90,7 @@ EblDirCmd (
   CHAR16                        UnicodeFileName[MAX_CMD_LINE];\r
   CHAR8                         *Path;\r
   CHAR8                         *TypeStr;\r
+  UINTN                         TotalSize;\r
 \r
 \r
   if (Argc <= 1) {\r
@@ -143,6 +144,7 @@ EblDirCmd (
       }\r
     }\r
 \r
+    TotalSize = 0;\r
     Fv = File->Fv;\r
     Key = 0;\r
     CurrentRow = 0;\r
@@ -157,6 +159,7 @@ EblDirCmd (
                                 &Size\r
                                 );\r
       if (!EFI_ERROR (GetNextFileStatus)) {\r
+        TotalSize += Size;\r
         // Calculate size of entire file\r
         Section = NULL;\r
         Size = 0;\r
@@ -170,8 +173,8 @@ EblDirCmd (
                       &AuthenticationStatus\r
                       );\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
+          // EFI_SUCCESS or EFI_BUFFER_TOO_SMALL mean size is valid \r
+          Size = 0;\r
         }\r
         \r
         TypeStr = (Type <= EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE) ? gFvFileType[Type] : "UNKNOWN";\r
@@ -189,7 +192,7 @@ EblDirCmd (
                         );\r
         if (!EFI_ERROR (Status)) {\r
           if (StrStr (Section, MatchSubString) != NULL) {\r
-            AsciiPrint ("%,6d %7a %g %s\n", Size, TypeStr, &NameGuid, Section);\r
+            AsciiPrint ("%,9d %7a %g %s\n", Size, TypeStr, &NameGuid, Section);\r
             if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {\r
               break;\r
             }\r
@@ -197,7 +200,7 @@ EblDirCmd (
           FreePool (Section);\r
         } else {\r
           if (*MatchSubString == '\0') {\r
-            AsciiPrint ("%,6d %7a %g\n", Size, TypeStr, &NameGuid);\r
+            AsciiPrint ("%,9d %7a %g\n", Size, TypeStr, &NameGuid);\r
             if (EblAnyKeyToContinueQtoQuit (&CurrentRow, FALSE)) {\r
               break;\r
             }\r
@@ -206,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