TianoCore EDK2 master
Loading...
Searching...
No Matches
Map.c File Reference

Go to the source code of this file.

Functions

BOOLEAN IsNumberLetterOnly (IN CONST CHAR16 *String, IN CONST UINTN Len)
 
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)
 
CHAR16 * GetDeviceMediaType (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
 
BOOLEAN IsRemoveableDevice (IN EFI_DEVICE_PATH_PROTOCOL *DevicePath)
 
BOOLEAN MappingListHasType (IN CONST CHAR16 *MapList, IN CONST CHAR16 *Specific, IN CONST CHAR16 *TypeString, IN CONST BOOLEAN Normal, IN CONST BOOLEAN Consist)
 
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)
 
EFI_STATUS PerformSingleMappingDelete (IN CONST CHAR16 *Specific, IN CONST EFI_HANDLE Handle)
 
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)
 
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)
 
EFI_STATUS PerformMappingDelete (IN CONST CHAR16 *Specific)
 
SHELL_STATUS AddMappingFromMapping (IN CONST CHAR16 *Map, IN CONST CHAR16 *SName)
 
SHELL_STATUS AddMappingFromHandle (IN CONST EFI_HANDLE Handle, IN CONST CHAR16 *SName)
 
VOID ProbeForMediaChange (VOID)
 
SHELL_STATUS EFIAPI ShellCommandRunMap (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
 

Variables

CONST CHAR16 Cd [] = L"cd*"
 
CONST CHAR16 Hd [] = L"hd*"
 
CONST CHAR16 Fp [] = L"fp*"
 
CONST CHAR16 AnyF [] = L"F*"
 
STATIC CONST SHELL_PARAM_ITEM MapParamList []
 

Detailed Description

Main file for map shell level 2 command.

Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP

SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file Map.c.

Function Documentation

◆ AddMappingFromHandle()

SHELL_STATUS AddMappingFromHandle ( IN CONST EFI_HANDLE  Handle,
IN CONST CHAR16 *  SName 
)

function to add a mapping from an EFI_HANDLE.

This function will get the device path associated with the Handle and call SetMap.

Parameters
[in]HandleThe handle to add a mapping for
[in]SNameThe name of the new mapping
Return values
SHELL_SUCCESSthe mapping was added
SHELL_INVALID_PARAMETERSName was not valid for a map name.
Returns
Shell version of a return value from either gBS->OpenProtocol or EfiShellProtocol->SetMap

Definition at line 992 of file Map.c.

◆ AddMappingFromMapping()

SHELL_STATUS AddMappingFromMapping ( IN CONST CHAR16 *  Map,
IN CONST CHAR16 *  SName 
)

function to add a mapping from mapping.

This function will get the device path associated with the mapping and call SetMap.

Parameters
[in]MapThe Map to add a mapping for
[in]SNameThe name of the new mapping
Return values
SHELL_SUCCESSthe mapping was added
SHELL_INVALID_PARAMETERthe device path for Map could not be retrieved.
Returns
Shell version of a return value from EfiShellProtocol->SetMap

Definition at line 934 of file Map.c.

◆ GetDeviceMediaType()

CHAR16 * GetDeviceMediaType ( IN EFI_DEVICE_PATH_PROTOCOL DevicePath)

Determine what type of device is represented and return it's string. The string is in allocated memory and must be callee freed. The HII is is listed below. The actual string cannot be determined.

Parameters
[in]DevicePathThe device to analyze.
Return values
STR_MAP_MEDIA_UNKNOWNThe media type is unknown.
STR_MAP_MEDIA_HARDDISKThe media is a hard drive.
STR_MAP_MEDIA_CDROMThe media is a CD ROM.
STR_MAP_MEDIA_FLOPPYThe media is a floppy drive.

Definition at line 140 of file Map.c.

◆ IsNumberLetterOnly()

BOOLEAN IsNumberLetterOnly ( IN CONST CHAR16 *  String,
IN CONST UINTN  Len 
)

Determine if a string has only numbers and letters.

This is useful for such things as Map names which can only be letters and numbers.

Parameters
[in]Stringpointer to the string to analyze,
[in]LenNumber of characters to analyze.
Return values
TRUEString has only numbers and letters
FALSEString has at least one other character.

Definition at line 31 of file Map.c.

◆ IsRemoveableDevice()

BOOLEAN IsRemoveableDevice ( IN EFI_DEVICE_PATH_PROTOCOL DevicePath)

Function to detemine if a handle has removable storage.

Parameters
[in]DevicePathDevicePath to test.
Return values
TRUEThe handle has removable storage.
FALSEThe handle does not have removable storage.

Definition at line 185 of file Map.c.

◆ MappingListHasType()

BOOLEAN MappingListHasType ( IN CONST CHAR16 *  MapList,
IN CONST CHAR16 *  Specific,
IN CONST CHAR16 *  TypeString,
IN CONST BOOLEAN  Normal,
IN CONST BOOLEAN  Consist 
)

Function to detemine if a something on the map list matches.

Parameters
[in]MapListThe pointer to the list to test.
[in]SpecificThe pointer to a specific name to test for.
[in]TypeStringThe pointer to the list of types.
[in]NormalAlways show normal mappings.
[in]ConsistAlways show consistent mappings.
Return values
TRUEThe map should be displayed.
FALSEThe map should not be displayed.

Definition at line 223 of file Map.c.

◆ PerformMappingDelete()

EFI_STATUS PerformMappingDelete ( IN CONST CHAR16 *  Specific)

Delete a specific map.

Parameters
[in]SpecificThe pointer to the name of the map to delete.
Return values
EFI_INVALID_PARAMETERSpecific was NULL.
EFI_SUCCESSThe operation was successful.
EFI_NOT_FOUNDSpecific could not be found.

Definition at line 788 of file Map.c.

◆ PerformMappingDisplay()

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 
)

Function to display mapping information to the user.

If Specific is specified then Consist and Normal will be ignored since information will be printed for the specific item only.

Parameters
[in]VerboseTRUE to display (extra) verbose information.
[in]ConsistTRUE to display consistent mappings.
[in]NormalTRUE to display normal (not consist) mappings.
[in]TypeStringPointer to string of filter types.
[in]SFOTRUE to display output in Standard Output Format.
[in]SpecificPointer to string for specific map to display.
[in]HeaderTRUE to print the header block.
Return values
SHELL_SUCCESSThe display was printed.
SHELL_INVALID_PARAMETEROne of Consist or Normal must be TRUE if no Specific.

Definition at line 540 of file Map.c.

◆ PerformMappingDisplay2()

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 
)

Perform a mapping display and parse for multiple types in the TypeString.

Parameters
[in]VerboseTRUE to use verbose output.
[in]ConsistTRUE to display consistent names.
[in]NormalTRUE to display normal names.
[in]TypeStringAn optional comma-delimited list of types.
[in]SFOTRUE to display in SFO format. See Spec.
[in]SpecificAn optional specific map name to display alone.
Return values
SHELL_INVALID_PARAMETERA parameter was invalid.
SHELL_SUCCESSThe display was successful.
See also
PerformMappingDisplay

Definition at line 734 of file Map.c.

◆ PerformSingleMappingDelete()

EFI_STATUS PerformSingleMappingDelete ( IN CONST CHAR16 *  Specific,
IN CONST EFI_HANDLE  Handle 
)

Delete Specific from the list of maps for device Handle.

Parameters
[in]SpecificThe name to delete.
[in]HandleThe device to look on.
Return values
EFI_SUCCESSThe delete was successful.
EFI_NOT_FOUNDName was not a map on Handle.

Definition at line 487 of file Map.c.

◆ PerformSingleMappingDisplay()

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 
)

Display a single map line for device Handle if conditions are met.

Parameters
[in]VerboseTRUE to display (extra) verbose information.
[in]ConsistTRUE to display consistent mappings.
[in]NormalTRUE to display normal (not consist) mappings.
[in]TypeStringpointer to string of filter types.
[in]SFOTRUE to display output in Standard Output Format.
[in]Specificpointer to string for specific map to display.
[in]HandleThe handle to display from.
Return values
EFI_SUCCESSThe mapping was displayed.

Definition at line 304 of file Map.c.

◆ ProbeForMediaChange()

VOID ProbeForMediaChange ( VOID  )

The routine issues dummy read for every physical block device to cause the BlockIo re-installed if media change happened.

Definition at line 1059 of file Map.c.

◆ SearchList()

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 
)

Do a search in the Target delimited list.

Parameters
[in]ListThe list to seatch in.
[in]MetaTargetThe item to search for. MetaMatching supported.
[out]FullNameOptional pointer to an allocated buffer containing the match.
[in]MetaTRUE to use MetaMatching.
[in]SkipTrailingNumbersTRUE to allow for numbers after the MetaTarget.
[in]TargetThe single character that delimits list items (";" normally).

Definition at line 64 of file Map.c.

◆ ShellCommandRunMap()

SHELL_STATUS EFIAPI ShellCommandRunMap ( IN EFI_HANDLE  ImageHandle,
IN EFI_SYSTEM_TABLE SystemTable 
)

Function for 'map' command.

Parameters
[in]ImageHandleHandle to the Image (NULL if Internal).
[in]SystemTablePointer to the System Table (NULL if Internal).

Definition at line 1113 of file Map.c.

Variable Documentation

◆ AnyF

CONST CHAR16 AnyF[] = L"F*"

Definition at line 519 of file Map.c.

◆ Cd

CONST CHAR16 Cd[] = L"cd*"

Definition at line 516 of file Map.c.

◆ Fp

CONST CHAR16 Fp[] = L"fp*"

Definition at line 518 of file Map.c.

◆ Hd

CONST CHAR16 Hd[] = L"hd*"

Definition at line 517 of file Map.c.

◆ MapParamList

STATIC CONST SHELL_PARAM_ITEM MapParamList[]
Initial value:
= {
{ L"-d", TypeValue },
{ L"-r", TypeFlag },
{ L"-v", TypeFlag },
{ L"-c", TypeFlag },
{ L"-f", TypeFlag },
{ L"-u", TypeFlag },
{ L"-t", TypeValue },
{ L"-sfo", TypeValue },
{ NULL, TypeMax }
}
#define NULL
Definition: Base.h:319
@ TypeValue
A flag that has some data following it with a space (IE "-a 1").
Definition: ShellLib.h:700
@ TypeFlag
A flag that is present or not present only (IE "-a").
Definition: ShellLib.h:699

Definition at line 1042 of file Map.c.