From f747c71e301c7cf710d6511fbcc86a7ae6d475fa Mon Sep 17 00:00:00 2001 From: Jaben Carsey Date: Wed, 28 May 2014 17:31:22 +0000 Subject: [PATCH] ShellPkg: fix display for map command with filtering MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This patch correctly displays map information when a filter was applied such as “map fs*” or “map f*”, including the use of “-c” to display the consist names first in this situation. It also moves a statement from both clauses of an “if/else” to above the “if” statement for efficiency. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Jaben Carsey Reviewed-by: Tapan Shah Reviewed-by: Erik Bjorge git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15548 6f19259b-4bc3-4df7-8a09-765794883524 --- .../Library/UefiShellLevel2CommandsLib/Map.c | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/ShellPkg/Library/UefiShellLevel2CommandsLib/Map.c b/ShellPkg/Library/UefiShellLevel2CommandsLib/Map.c index 9e33286c90..4865d0e7a1 100644 --- a/ShellPkg/Library/UefiShellLevel2CommandsLib/Map.c +++ b/ShellPkg/Library/UefiShellLevel2CommandsLib/Map.c @@ -1,7 +1,7 @@ /** @file Main file for map shell level 2 command. - Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.
+ Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -345,6 +345,7 @@ MappingListHasType( FreePool(NewSpecific); } if ( Consist + && !Specific && (SearchList(MapList, L"HD*", NULL, TRUE, TRUE, L";") ||SearchList(MapList, L"CD*", NULL, TRUE, TRUE, L";") ||SearchList(MapList, L"F*", NULL, TRUE, TRUE, L";") @@ -353,6 +354,7 @@ MappingListHasType( } if ( Normal + && !Specific && (SearchList(MapList, L"FS", NULL, FALSE, TRUE, L";") ||SearchList(MapList, L"BLK", NULL, FALSE, TRUE, L";"))){ return (TRUE); @@ -416,7 +418,11 @@ PerformSingleMappingDisplay( return EFI_NOT_FOUND; } - if (Normal) { + if (Normal || !Consist) { + // + // need the Normal here since people can use both on command line. otherwise unused. + // + // // Allocate a name // @@ -434,7 +440,7 @@ PerformSingleMappingDisplay( if (TempSpot != NULL) { *TempSpot = CHAR_NULL; } - } else if (Consist) { + } else { CurrentName = NULL; // @@ -485,16 +491,10 @@ PerformSingleMappingDisplay( Alias[StrLen(Alias)-1] = CHAR_NULL; } } - } else { - CurrentName = NULL; - CurrentName = StrnCatGrow(&CurrentName, 0, L"", 0); - if (CurrentName == NULL) { - return (EFI_OUT_OF_RESOURCES); - } } DevPathString = ConvertDevicePathToText(DevPath, TRUE, FALSE); + TempLen = StrLen(CurrentName); if (!SFO) { - TempLen = StrLen(CurrentName); ShellPrintHiiEx ( -1, -1, @@ -528,7 +528,6 @@ PerformSingleMappingDisplay( SHELL_FREE_NON_NULL(MediaType); } } else { - TempLen = StrLen(CurrentName); ShellPrintHiiEx ( -1, -1, -- 2.39.2