]> git.proxmox.com Git - mirror_edk2.git/blobdiff - ShellPkg/Library/UefiShellLevel2CommandsLib/Map.c
Update all the code to consume the ConvertDevicePathToText, ConvertDevicePathNodeToTe...
[mirror_edk2.git] / ShellPkg / Library / UefiShellLevel2CommandsLib / Map.c
index 68130d4db834c5b8677e14cfc4373a744a5de185..bd004beaaf9fa291bcdf66bf7c8d4471e6343bc9 100644 (file)
@@ -1,7 +1,7 @@
 /** @file\r
   Main file for map shell level 2 command.\r
 \r
-  Copyright (c) 2009 - 2011, Intel Corporation. All rights reserved.<BR>\r
+  Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>\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
@@ -347,7 +347,7 @@ MappingListHasType(
   if (  Consist\r
     && (SearchList(MapList, L"HD*",  NULL, TRUE, TRUE, L";")\r
       ||SearchList(MapList, L"CD*",  NULL, TRUE, TRUE, L";")\r
-      ||SearchList(MapList, L"AnyF*",   NULL, TRUE, TRUE, L";")\r
+      ||SearchList(MapList, L"F*",   NULL, TRUE, TRUE, L";")\r
       ||SearchList(MapList, L"FP*",  NULL, TRUE, TRUE, L";"))){\r
     return (TRUE);\r
   }\r
@@ -414,11 +414,14 @@ PerformSingleMappingDisplay(
 \r
   CurrentName = NULL;\r
   CurrentName = StrnCatGrow(&CurrentName, 0, MapList, 0);\r
+  if (CurrentName == NULL) {\r
+    return (EFI_OUT_OF_RESOURCES);\r
+  }\r
   TempSpot = StrStr(CurrentName, L";");\r
   if (TempSpot != NULL) {\r
     *TempSpot = CHAR_NULL;\r
   }\r
-  DevPathString = gDevPathToText->ConvertDevicePathToText(DevPath, TRUE, FALSE);\r
+  DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE);\r
   if (!SFO) {\r
     TempLen = StrLen(CurrentName);\r
     ShellPrintHiiEx (\r
@@ -516,18 +519,19 @@ CONST CHAR16 AnyF[] = L"F*";
 /**\r
   Function to display mapping information to the user.\r
 \r
-  if Specific is specified then Consist and Normal will be ignored since information will\r
+  If Specific is specified then Consist and Normal will be ignored since information will\r
   be printed for the specific item only.\r
 \r
-  @param[in] Verbose                TRUE to display (extra) verbose information\r
-  @param[in] Consist                TRUE to display consistent mappings\r
-  @param[in] Normal                 TRUE to display normal (not consist) mappings\r
-  @param[in] TypeString             pointer to string of filter types\r
-  @param[in] SFO                    TRUE to display output in Standard Output Format\r
-  @param[in] Specific               pointer to string for specific map to display\r
+  @param[in] Verbose                TRUE to display (extra) verbose information.\r
+  @param[in] Consist                TRUE to display consistent mappings.\r
+  @param[in] Normal                 TRUE to display normal (not consist) mappings.\r
+  @param[in] TypeString             Pointer to string of filter types.\r
+  @param[in] SFO                    TRUE to display output in Standard Output Format.\r
+  @param[in] Specific               Pointer to string for specific map to display.\r
+  @param[in] Header                 TRUE to print the header block.\r
 \r
-  @retval SHELL_SUCCESS               the display was printed\r
-  @retval SHELL_INVALID_PARAMETER     one of Consist or Normal must be TRUE if no Specific\r
+  @retval SHELL_SUCCESS               The display was printed.\r
+  @retval SHELL_INVALID_PARAMETER     One of Consist or Normal must be TRUE if no Specific.\r
 \r
 **/\r
 SHELL_STATUS\r
@@ -685,7 +689,11 @@ PerformMappingDisplay(
     FreePool(HandleBuffer);\r
   }\r
   if (!Found) {\r
-    ShellPrintHiiEx(gST->ConOut->Mode->CursorColumn, gST->ConOut->Mode->CursorRow-1, NULL, STRING_TOKEN (STR_MAP_NF), gShellLevel2HiiHandle, Specific);\r
+    if (Specific != NULL) {\r
+      ShellPrintHiiEx(gST->ConOut->Mode->CursorColumn, gST->ConOut->Mode->CursorRow-1, NULL, STRING_TOKEN (STR_MAP_NF), gShellLevel2HiiHandle, Specific);\r
+    } else {\r
+      ShellPrintHiiEx(gST->ConOut->Mode->CursorColumn, gST->ConOut->Mode->CursorRow-1, NULL, STRING_TOKEN (STR_CD_NF), gShellLevel2HiiHandle);\r
+    }\r
   }\r
   return (SHELL_SUCCESS);\r
 }\r
@@ -1017,7 +1025,6 @@ ShellCommandRunMap (
   CONST CHAR16  *SName;\r
   CONST CHAR16  *Mapping;\r
   EFI_HANDLE    MapAsHandle;\r
-  CONST EFI_DEVICE_PATH_PROTOCOL *DevPath;\r
   SHELL_STATUS  ShellStatus;\r
   BOOLEAN       SfoMode;\r
   BOOLEAN       ConstMode;\r
@@ -1029,7 +1036,6 @@ ShellCommandRunMap (
   ProblemParam  = NULL;\r
   Mapping       = NULL;\r
   SName         = NULL;\r
-  DevPath       = NULL;\r
   ShellStatus   = SHELL_SUCCESS;\r
   MapAsHandle = NULL;\r
 \r
@@ -1085,18 +1091,15 @@ ShellCommandRunMap (
           if (SName != NULL) {\r
             Status = PerformMappingDelete(SName);\r
             if (EFI_ERROR(Status)) {\r
-              switch (Status) {\r
-                case EFI_ACCESS_DENIED:\r
-                  ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellLevel2HiiHandle);\r
-                  ShellStatus = SHELL_ACCESS_DENIED;\r
-                  break;\r
-                case EFI_NOT_FOUND:\r
-                  ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MAP_NF), gShellLevel2HiiHandle, SName);\r
-                  ShellStatus = SHELL_INVALID_PARAMETER;\r
-                  break;\r
-                default:\r
-                  ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, Status);\r
-                  ShellStatus = SHELL_UNSUPPORTED;\r
+              if (Status == EFI_ACCESS_DENIED) {\r
+                ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_AD), gShellLevel2HiiHandle);\r
+                ShellStatus = SHELL_ACCESS_DENIED;\r
+              } else if (Status == EFI_NOT_FOUND) {\r
+                ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_MAP_NF), gShellLevel2HiiHandle, SName);\r
+                ShellStatus = SHELL_INVALID_PARAMETER;\r
+              } else {\r
+                ShellPrintHiiEx(-1, -1, NULL, STRING_TOKEN (STR_GEN_ERR_UK), gShellLevel2HiiHandle, Status);\r
+                ShellStatus = SHELL_UNSUPPORTED;\r
               }\r
             }\r
           } else {\r