38 for (Count = 0; Count < Len && String !=
NULL && *String != CHAR_NULL; String++, Count++) {
39 if (!(((*String >= L
'a') && (*String <= L
'z')) ||
40 ((*String >= L
'A') && (*String <= L
'Z')) ||
41 ((*String >= L
'0') && (*String <= L
'9')))
67 OUT CHAR16 **FullName OPTIONAL,
69 IN CONST BOOLEAN SkipTrailingNumbers,
75 CONST CHAR16 *ListWalker;
79 for (ListWalker = List, TempList =
NULL
80 ; ListWalker !=
NULL && *ListWalker != CHAR_NULL
85 if (TempList ==
NULL) {
86 ASSERT (TempList !=
NULL);
90 TempSpot =
StrStr (TempList, Target);
91 if (TempSpot !=
NULL) {
92 *TempSpot = CHAR_NULL;
96 TempList[
StrLen (TempList)-1] = CHAR_NULL;
99 ListWalker =
StrStr (ListWalker, Target);
100 while (ListWalker !=
NULL && *ListWalker == *Target) {
105 Result = gUnicodeCollation->MetaiMatch (gUnicodeCollation, (CHAR16 *)TempList, (CHAR16 *)MetaTarget);
107 Result = (BOOLEAN)(
StrCmp (TempList, MetaTarget) == 0);
111 if (FullName !=
NULL) {
112 *FullName = TempList;
153 if (
NULL == DevicePath) {
167 if (EISA_ID_TO_NUM (Acpi->
HID) == 0x0604) {
189 if (
NULL == DevicePath) {
232 RETURN_STATUS Status;
238 if (Specific !=
NULL) {
239 Length =
StrLen (Specific);
243 NewSpecific =
AllocatePool ((Length + 2) *
sizeof (CHAR16));
244 if (NewSpecific ==
NULL) {
248 StrCpyS (NewSpecific, Length + 2, Specific);
249 if (Specific[Length - 1] != L
':') {
251 if (EFI_ERROR (Status)) {
266 && (Specific ==
NULL)
276 && (Specific ==
NULL)
310 IN CONST CHAR16 *Specific OPTIONAL,
316 CONST CHAR16 *MapList;
319 CHAR16 *DevPathString;
324 CONST CHAR16 *TempSpot2;
330 DevPathCopy = DevPath;
331 MapList = gEfiShellProtocol->GetMapFromDevicePath (&DevPathCopy);
332 if (MapList ==
NULL) {
333 return EFI_NOT_FOUND;
337 return EFI_NOT_FOUND;
340 if (Normal || !Consist) {
349 CurrentName =
StrnCatGrow (&CurrentName, 0, MapList, 0);
350 if (CurrentName ==
NULL) {
351 return (EFI_OUT_OF_RESOURCES);
358 TempSpot =
StrStr (CurrentName, L
";");
359 if (TempSpot !=
NULL) {
360 *TempSpot = CHAR_NULL;
368 TempSpot =
StrStr (MapList, L
";");
369 if (TempSpot !=
NULL) {
374 if (CurrentName ==
NULL) {
378 if (CurrentName ==
NULL) {
382 if (CurrentName ==
NULL) {
386 if (CurrentName ==
NULL) {
390 CurrentName =
StrnCatGrow (&CurrentName, 0, MapList, 0);
391 if (CurrentName ==
NULL) {
392 return (EFI_OUT_OF_RESOURCES);
395 TempSpot =
StrStr (CurrentName, L
";");
396 if (TempSpot !=
NULL) {
397 *TempSpot = CHAR_NULL;
402 return EFI_OUT_OF_RESOURCES;
405 TempSpot =
StrStr (Alias, CurrentName);
406 if (TempSpot !=
NULL) {
407 TempSpot2 =
StrStr (TempSpot, L
";");
408 if (TempSpot2 !=
NULL) {
412 *TempSpot = CHAR_NULL;
416 if (Alias[
StrLen (Alias)-1] == L
';') {
417 Alias[
StrLen (Alias)-1] = CHAR_NULL;
423 TempLen =
StrLen (CurrentName);
430 gShellLevel2HiiHandle,
432 Alias !=
NULL ? Alias : (TempLen <
StrLen (MapList) ? MapList + TempLen+1 : L
""),
440 if (((TypeString !=
NULL) && (MediaType !=
NULL) && (
StrStr (TypeString, MediaType) !=
NULL)) || (TypeString ==
NULL)) {
448 gShellLevel2HiiHandle,
451 Removable ? L
"Yes" : L
"No",
456 SHELL_FREE_NON_NULL (MediaType);
464 gShellLevel2HiiHandle,
467 Consist ? L
"" : (TempLen <
StrLen (MapList) ? MapList + TempLen+1 : L
"")
471 SHELL_FREE_NON_NULL (DevPathString);
472 SHELL_FREE_NON_NULL (CurrentName);
473 SHELL_FREE_NON_NULL (Alias);
494 CONST CHAR16 *MapList;
498 DevPathCopy = DevPath;
499 MapList = gEfiShellProtocol->GetMapFromDevicePath (&DevPathCopy);
502 if (MapList ==
NULL) {
503 return (EFI_NOT_FOUND);
510 return (EFI_NOT_FOUND);
513 return (gEfiShellProtocol->SetMap (
NULL, CurrentName));
516CONST CHAR16 Cd[] = L
"cd*";
517CONST CHAR16 Hd[] = L
"hd*";
518CONST CHAR16 Fp[] = L
"fp*";
519CONST CHAR16 AnyF[] = L
"F*";
546 IN CONST CHAR16 *Specific OPTIONAL,
557 if (!Consist && !Normal && (Specific ==
NULL) && (TypeString ==
NULL)) {
562 if (TypeString !=
NULL) {
573 Test = (CHAR16 *)AnyF;
597 Status =
gBS->LocateHandle (
599 &gEfiSimpleFileSystemProtocolGuid,
604 if (Status == EFI_BUFFER_TOO_SMALL) {
606 if (HandleBuffer ==
NULL) {
610 Status =
gBS->LocateHandle (
612 &gEfiSimpleFileSystemProtocolGuid,
622 for ( LoopVar = 0, Found =
FALSE
623 ; LoopVar < (BufferSize /
sizeof (
EFI_HANDLE)) && HandleBuffer !=
NULL
634 HandleBuffer[LoopVar]
636 if (!EFI_ERROR (Status)) {
644 Status =
gBS->LocateHandle (
646 &gEfiBlockIoProtocolGuid,
651 if (Status == EFI_BUFFER_TOO_SMALL) {
652 SHELL_FREE_NON_NULL (HandleBuffer);
654 if (HandleBuffer ==
NULL) {
658 Status =
gBS->LocateHandle (
660 &gEfiBlockIoProtocolGuid,
667 if (!EFI_ERROR (Status) && (HandleBuffer !=
NULL)) {
679 if (
gBS->OpenProtocol (
680 HandleBuffer[LoopVar],
681 &gEfiSimpleFileSystemProtocolGuid,
685 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
698 HandleBuffer[LoopVar]
700 if (!EFI_ERROR (Status)) {
709 if (Specific !=
NULL) {
740 IN CONST CHAR16 *Specific OPTIONAL
743 CONST CHAR16 *TypeWalker;
747 if (TypeString ==
NULL) {
752 for (TypeWalker = TypeString; TypeWalker !=
NULL && *TypeWalker != CHAR_NULL;) {
753 Comma =
StrStr (TypeWalker, L
",");
756 ShellStatus =
PerformMappingDisplay (Verbose, Consist, Normal, TypeWalker, SFO, Specific, (BOOLEAN)(TypeWalker == TypeString));
758 PerformMappingDisplay (Verbose, Consist, Normal, TypeWalker, SFO, Specific, (BOOLEAN)(TypeWalker == TypeString));
765 ShellStatus =
PerformMappingDisplay (Verbose, Consist, Normal, TypeWalker, SFO, Specific, (BOOLEAN)(TypeWalker == TypeString));
767 PerformMappingDisplay (Verbose, Consist, Normal, TypeWalker, SFO, Specific, (BOOLEAN)(TypeWalker == TypeString));
771 TypeWalker = Comma + 1;
775 return (ShellStatus);
798 if (Specific ==
NULL) {
799 return (EFI_INVALID_PARAMETER);
809 Status =
gBS->LocateHandle (
811 &gEfiDevicePathProtocolGuid,
816 if (Status == EFI_BUFFER_TOO_SMALL) {
818 if (HandleBuffer ==
NULL) {
819 return (EFI_OUT_OF_RESOURCES);
822 Status =
gBS->LocateHandle (
824 &gEfiDevicePathProtocolGuid,
831 if (EFI_ERROR (Status)) {
832 SHELL_FREE_NON_NULL (HandleBuffer);
836 if (HandleBuffer !=
NULL) {
854 Status =
gBS->LocateHandle (
856 &gEfiBlockIoProtocolGuid,
861 if (Status == EFI_BUFFER_TOO_SMALL) {
864 if (HandleBuffer ==
NULL) {
865 return (EFI_OUT_OF_RESOURCES);
868 Status =
gBS->LocateHandle (
870 &gEfiBlockIoProtocolGuid,
877 if (EFI_ERROR (Status)) {
878 SHELL_FREE_NON_NULL (HandleBuffer);
882 if (HandleBuffer !=
NULL) {
894 if (
gBS->OpenProtocol (
895 HandleBuffer[LoopVar],
896 &gEfiDevicePathProtocolGuid,
900 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
912 SHELL_FREE_NON_NULL (HandleBuffer);
914 return (EFI_NOT_FOUND);
942 RETURN_STATUS StrRetStatus;
945 if (NewSName ==
NULL) {
949 if (NewSName[
StrLen (NewSName)-1] != L
':') {
950 StrRetStatus =
StrnCatS (NewSName, (
StrSize (SName) +
sizeof (CHAR16))/
sizeof (CHAR16), L
":",
StrLen (L
":"));
951 if (EFI_ERROR (StrRetStatus)) {
962 DevPath = gEfiShellProtocol->GetDevicePathFromMap (Map);
963 if (DevPath ==
NULL) {
968 Status = gEfiShellProtocol->SetMap (DevPath, NewSName);
970 if (EFI_ERROR (Status)) {
1000 RETURN_STATUS StrRetStatus;
1003 if (NewSName ==
NULL) {
1007 if (NewSName[
StrLen (NewSName)-1] != L
':') {
1008 StrRetStatus =
StrnCatS (NewSName, (
StrSize (SName) +
sizeof (CHAR16))/
sizeof (CHAR16), L
":",
StrLen (L
":"));
1009 if (EFI_ERROR (StrRetStatus)) {
1020 Status =
gBS->OpenProtocol (
1022 &gEfiDevicePathProtocolGuid,
1026 EFI_OPEN_PROTOCOL_GET_PROTOCOL
1028 if (EFI_ERROR (Status)) {
1033 Status = gEfiShellProtocol->SetMap (DevPath, NewSName);
1035 if (EFI_ERROR (Status)) {
1069 gBS->LocateHandleBuffer (
1071 &gEfiBlockIoProtocolGuid,
1079 for (Index = 0; Index < HandleCount; Index++) {
1080 Status =
gBS->HandleProtocol (
1082 &gEfiBlockIoProtocolGuid,
1085 if (!EFI_ERROR (Status)) {
1086 if (!BlockIo->Media->LogicalPartition) {
1093 BlockIo->ReadBlocks (
1095 BlockIo->Media->MediaId,
1120 CHAR16 *ProblemParam;
1121 CONST CHAR16 *SName;
1122 CONST CHAR16 *Mapping;
1128 CONST CHAR16 *Param1;
1129 CONST CHAR16 *TypeString;
1130 UINTN TempStringLength;
1132 ProblemParam =
NULL;
1151 if (EFI_ERROR (Status)) {
1152 if ((Status == EFI_VOLUME_CORRUPTED) && (ProblemParam !=
NULL)) {
1188 if (SName !=
NULL) {
1190 if (EFI_ERROR (Status)) {
1191 if (Status == EFI_ACCESS_DENIED) {
1194 }
else if (Status == EFI_NOT_FOUND) {
1221 if (EFI_ERROR (Status)) {
1232 if (EFI_ERROR (Status)) {
1243 && (TypeString ==
NULL)
1278 if ( (SName ==
NULL)
1279 && (Mapping ==
NULL)
1294 }
else if ( (SName ==
NULL)
1295 || (Mapping ==
NULL)
1317 if ((MapAsHandle ==
NULL) && (Mapping[
StrLen (Mapping)-1] != L
':')) {
1321 TempStringLength =
StrLen (SName);
1322 if (!
IsNumberLetterOnly (SName, TempStringLength-((SName[TempStringLength-1] == L
':') ? 1 : 0))) {
1328 if (MapAsHandle !=
NULL) {
1335 switch (ShellStatus) {
1374 return (ShellStatus);
UINTN EFIAPI StrSize(IN CONST CHAR16 *String)
RETURN_STATUS EFIAPI StrCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
INTN EFIAPI StrCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString)
INTN EFIAPI StrnCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString, IN UINTN Length)
RETURN_STATUS EFIAPI StrnCatS(IN OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source, IN UINTN Length)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
#define MEDIA_HARDDRIVE_DP
#define MESSAGING_DEVICE_PATH
UINT8 EFIAPI DevicePathType(IN CONST VOID *Node)
UINT8 EFIAPI DevicePathSubType(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI NextDevicePathNode(IN CONST VOID *Node)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI DevicePathFromHandle(IN EFI_HANDLE Handle)
CHAR16 *EFIAPI ConvertDevicePathToText(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath, IN BOOLEAN DisplayOnly, IN BOOLEAN AllowShortcuts)
BOOLEAN EFIAPI IsDevicePathEndType(IN CONST VOID *Node)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
EFI_HANDLE EFIAPI ConvertHandleIndexToHandle(IN CONST UINTN TheIndex)
UINTN EFIAPI ConvertHandleToHandleIndex(IN CONST EFI_HANDLE TheHandle)
EFI_STRING EFIAPI HiiGetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
SHELL_STATUS PerformMappingDisplay2(IN CONST BOOLEAN Verbose, IN CONST BOOLEAN Consist, IN CONST BOOLEAN Normal, IN CONST CHAR16 *TypeString, IN CONST BOOLEAN SFO, IN CONST CHAR16 *Specific OPTIONAL)
SHELL_STATUS AddMappingFromMapping(IN CONST CHAR16 *Map, IN CONST CHAR16 *SName)
BOOLEAN SearchList(IN CONST CHAR16 *List, IN CONST CHAR16 *MetaTarget, OUT CHAR16 **FullName OPTIONAL, IN CONST BOOLEAN Meta, IN CONST BOOLEAN SkipTrailingNumbers, IN CONST CHAR16 *Target)
SHELL_STATUS PerformMappingDisplay(IN CONST BOOLEAN Verbose, IN CONST BOOLEAN Consist, IN CONST BOOLEAN Normal, IN CONST CHAR16 *TypeString, IN CONST BOOLEAN SFO, IN CONST CHAR16 *Specific OPTIONAL, IN CONST BOOLEAN Header)
BOOLEAN IsRemoveableDevice(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
EFI_STATUS PerformSingleMappingDelete(IN CONST CHAR16 *Specific, IN CONST EFI_HANDLE Handle)
SHELL_STATUS EFIAPI ShellCommandRunMap(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
SHELL_STATUS AddMappingFromHandle(IN CONST EFI_HANDLE Handle, IN CONST CHAR16 *SName)
EFI_STATUS PerformMappingDelete(IN CONST CHAR16 *Specific)
EFI_STATUS PerformSingleMappingDisplay(IN CONST BOOLEAN Verbose, IN CONST BOOLEAN Consist, IN CONST BOOLEAN Normal, IN CONST CHAR16 *TypeString, IN CONST BOOLEAN SFO, IN CONST CHAR16 *Specific OPTIONAL, IN CONST EFI_HANDLE Handle)
BOOLEAN IsNumberLetterOnly(IN CONST CHAR16 *String, IN CONST UINTN Len)
BOOLEAN MappingListHasType(IN CONST CHAR16 *MapList, IN CONST CHAR16 *Specific, IN CONST CHAR16 *TypeString, IN CONST BOOLEAN Normal, IN CONST BOOLEAN Consist)
CHAR16 * GetDeviceMediaType(IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
VOID ProbeForMediaChange(VOID)
#define ASSERT_EFI_ERROR(StatusParameter)
@ SHELL_INVALID_PARAMETER
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_STATUS EFIAPI CommandInit(VOID)
EFI_STATUS EFIAPI ShellCommandUpdateMapping(VOID)
EFI_STATUS EFIAPI ShellCommandCreateInitialMappingsAndPaths(VOID)
CONST CHAR16 *EFIAPI ShellGetCurrentDir(IN CHAR16 *CONST DeviceName OPTIONAL)
CONST CHAR16 *EFIAPI ShellCommandLineGetValue(IN CONST LIST_ENTRY *CheckPackage, IN CHAR16 *KeyString)
UINTN EFIAPI ShellStrToUintn(IN CONST CHAR16 *String)
#define ShellCommandLineParse(CheckList, CheckPackage, ProblemParam, AutoPageBreak)
Make it easy to upgrade from older versions of the shell library.
EFI_STATUS EFIAPI ShellPrintHiiEx(IN INT32 Col OPTIONAL, IN INT32 Row OPTIONAL, IN CONST CHAR8 *Language OPTIONAL, IN CONST EFI_STRING_ID HiiFormatStringId, IN CONST EFI_HII_HANDLE HiiFormatHandle,...)
BOOLEAN EFIAPI ShellCommandLineGetFlag(IN CONST LIST_ENTRY *CONST CheckPackage, IN CONST CHAR16 *CONST KeyString)
BOOLEAN EFIAPI ShellIsHexOrDecimalNumber(IN CONST CHAR16 *String, IN CONST BOOLEAN ForceHex, IN CONST BOOLEAN StopAtSpace)
@ TypeValue
A flag that has some data following it with a space (IE "-a 1").
@ TypeFlag
A flag that is present or not present only (IE "-a").
BOOLEAN EFIAPI ShellIsDecimalDigitCharacter(IN CHAR16 Char)
CHAR16 *EFIAPI StrnCatGrow(IN OUT CHAR16 **Destination, IN OUT UINTN *CurrentSize, IN CONST CHAR16 *Source, IN UINTN Count)
VOID EFIAPI ShellCommandLineFreeVarList(IN LIST_ENTRY *CheckPackage)
EFI_STATUS EFIAPI ShellInitialize(VOID)
CONST CHAR16 *EFIAPI ShellCommandLineGetRawValue(IN CONST LIST_ENTRY *CONST CheckPackage, IN UINTN Position)
INTN EFIAPI Test(CONST VOID *b1, CONST VOID *b2)
EFI_SIMPLE_TEXT_OUTPUT_MODE * Mode
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * ConOut