diff options
author | Ruiyu Ni <ruiyu.ni@intel.com> | 2013-07-26 03:14:08 +0000 |
---|---|---|
committer | niruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524> | 2013-07-26 03:14:08 +0000 |
commit | 863986b3c8e67736d361b68e293d01e6f92f825c (patch) | |
tree | 15cf067d949655c9defeeeaa78eeea6050845b64 /ShellPkg/Application/Shell/ShellProtocol.c | |
parent | 4d0a30a494599226450bf69ad9d6fc689f61712e (diff) | |
download | edk2-platforms-863986b3c8e67736d361b68e293d01e6f92f825c.tar.xz |
Update all the code to consume the ConvertDevicePathToText, ConvertDevicePathNodeToText, ConvertTextToDevicePath and ConvertTextToDeviceNode APIs in DevicePathLib.
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Elvin Li <elvin.li@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14505 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'ShellPkg/Application/Shell/ShellProtocol.c')
-rw-r--r-- | ShellPkg/Application/Shell/ShellProtocol.c | 55 |
1 files changed, 18 insertions, 37 deletions
diff --git a/ShellPkg/Application/Shell/ShellProtocol.c b/ShellPkg/Application/Shell/ShellProtocol.c index df4874a23c..d39114f50e 100644 --- a/ShellPkg/Application/Shell/ShellProtocol.c +++ b/ShellPkg/Application/Shell/ShellProtocol.c @@ -115,27 +115,18 @@ InternalShellProtocolDebugPrintMessage ( IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath
)
{
- EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevicePathToText;
EFI_STATUS Status;
CHAR16 *Temp;
- Status = EFI_SUCCESS;
DEBUG_CODE_BEGIN();
- DevicePathToText = NULL;
- Status = gBS->LocateProtocol(&gEfiDevicePathToTextProtocolGuid,
- NULL,
- (VOID**)&DevicePathToText);
if (Mapping != NULL) {
DEBUG((EFI_D_INFO, "Added new map item:\"%S\"\r\n", Mapping));
}
- if (!EFI_ERROR(Status)) {
- if (DevicePath != NULL) {
- Temp = DevicePathToText->ConvertDevicePathToText(DevicePath, TRUE, TRUE);
- DEBUG((EFI_D_INFO, "DevicePath: %S\r\n", Temp));
- FreePool(Temp);
- }
- }
+ Temp = ConvertDevicePathToText(DevicePath, TRUE, TRUE);
+ DEBUG((EFI_D_INFO, "DevicePath: %S\r\n", Temp));
+ FreePool(Temp);
+
DEBUG_CODE_END();
return (Status);
}
@@ -647,7 +638,6 @@ EfiShellGetDeviceName( {
EFI_STATUS Status;
EFI_COMPONENT_NAME2_PROTOCOL *CompName2;
- EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *DevicePathToText;
EFI_DEVICE_PATH_PROTOCOL *DevicePath;
EFI_HANDLE *HandleList;
UINTN HandleCount;
@@ -815,28 +805,19 @@ EfiShellGetDeviceName( }
}
if ((Flags & EFI_DEVICE_NAME_USE_DEVICE_PATH) != 0) {
- Status = gBS->LocateProtocol(
- &gEfiDevicePathToTextProtocolGuid,
+ Status = gBS->OpenProtocol(
+ DeviceHandle,
+ &gEfiDevicePathProtocolGuid,
+ (VOID**)&DevicePath,
+ gImageHandle,
NULL,
- (VOID**)&DevicePathToText);
- //
- // we now have the device path to text protocol
- //
+ EFI_OPEN_PROTOCOL_GET_PROTOCOL);
if (!EFI_ERROR(Status)) {
- Status = gBS->OpenProtocol(
- DeviceHandle,
- &gEfiDevicePathProtocolGuid,
- (VOID**)&DevicePath,
- gImageHandle,
- NULL,
- EFI_OPEN_PROTOCOL_GET_PROTOCOL);
- if (!EFI_ERROR(Status)) {
- //
- // use device path to text on the device path
- //
- *BestDeviceName = DevicePathToText->ConvertDevicePathToText(DevicePath, TRUE, TRUE);
- return (EFI_SUCCESS);
- }
+ //
+ // use device path to text on the device path
+ //
+ *BestDeviceName = ConvertDevicePathToText(DevicePath, TRUE, TRUE);
+ return (EFI_SUCCESS);
}
}
//
@@ -1583,11 +1564,11 @@ EfiShellExecute( DevPath = AppendDevicePath (ShellInfoObject.ImageDevPath, ShellInfoObject.FileDevPath);
DEBUG_CODE_BEGIN();
- Temp = gDevPathToText->ConvertDevicePathToText(ShellInfoObject.FileDevPath, TRUE, TRUE);
+ Temp = ConvertDevicePathToText(ShellInfoObject.FileDevPath, TRUE, TRUE);
FreePool(Temp);
- Temp = gDevPathToText->ConvertDevicePathToText(ShellInfoObject.ImageDevPath, TRUE, TRUE);
+ Temp = ConvertDevicePathToText(ShellInfoObject.ImageDevPath, TRUE, TRUE);
FreePool(Temp);
- Temp = gDevPathToText->ConvertDevicePathToText(DevPath, TRUE, TRUE);
+ Temp = ConvertDevicePathToText(DevPath, TRUE, TRUE);
FreePool(Temp);
DEBUG_CODE_END();
|