ShellPkg: fix display for map command with filtering

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 <Jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hp.com>
Reviewed-by: Erik Bjorge <erik.c.bjorge@intel.com>


git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@15548 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
Jaben Carsey 2014-05-28 17:31:22 +00:00 committed by jcarsey
parent 0c41d28e59
commit f747c71e30
1 changed files with 10 additions and 11 deletions

View File

@ -1,7 +1,7 @@
/** @file
Main file for map shell level 2 command.
Copyright (c) 2009 - 2013, Intel Corporation. All rights reserved.<BR>
Copyright (c) 2009 - 2014, Intel Corporation. All rights reserved.<BR>
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,