ShellPkg/UefiShellLib: drop DeviceHandle param of ShellOpenFileByDevicePath()
authorLaszlo Ersek <lersek@redhat.com>
Wed, 18 Jul 2018 18:25:25 +0000 (20:25 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Thu, 16 Aug 2018 18:02:50 +0000 (20:02 +0200)
The ShellOpenFileByDevicePath() API promises to set the DeviceHandle
output parameter to the handle of the filesystem identified by the
FilePath input parameter. However, this doesn't actually happen when the
UEFI Shell 2.0 method is used (which is basically "always" nowadays).

Accordingly, the only caller of ShellOpenFileByDevicePath(), namely
ShellOpenFileByName(), defines a (dummy) local DeviceHandle variable just
so it can call ShellOpenFileByDevicePath().

Remove the useless output parameter.

Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1008
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
ShellPkg/Include/Library/ShellLib.h
ShellPkg/Library/UefiShellLib/UefiShellLib.c
ShellPkg/Library/UefiShellLib/UefiShellLib.inf

index e360a67..92fddc5 100644 (file)
@@ -89,7 +89,6 @@ ShellSetFileInfo (
 \r
   @param[in, out]  FilePath      On input, the device path to the file.  On output,\r
                                  the remaining device path.\r
-  @param[out]   DeviceHandle     Pointer to the system device handle.\r
   @param[out]   FileHandle       Pointer to the file handle.\r
   @param[in]    OpenMode         The mode to open the file with.\r
   @param[in]    Attributes       The file's file attributes.\r
@@ -115,7 +114,6 @@ EFI_STATUS
 EFIAPI\r
 ShellOpenFileByDevicePath(\r
   IN OUT EFI_DEVICE_PATH_PROTOCOL     **FilePath,\r
-  OUT EFI_HANDLE                      *DeviceHandle,\r
   OUT SHELL_FILE_HANDLE               *FileHandle,\r
   IN UINT64                           OpenMode,\r
   IN UINT64                           Attributes\r
index 3c24ba1..18c3be4 100644 (file)
@@ -472,7 +472,6 @@ ShellSetFileInfo (
 \r
   @param  FilePath        on input the device path to the file.  On output\r
                           the remaining device path.\r
-  @param  DeviceHandle    pointer to the system device handle.\r
   @param  FileHandle      pointer to the file handle.\r
   @param  OpenMode        the mode to open the file with.\r
   @param  Attributes      the file's file attributes.\r
@@ -498,7 +497,6 @@ EFI_STATUS
 EFIAPI\r
 ShellOpenFileByDevicePath(\r
   IN OUT EFI_DEVICE_PATH_PROTOCOL     **FilePath,\r
-  OUT EFI_HANDLE                      *DeviceHandle,\r
   OUT SHELL_FILE_HANDLE               *FileHandle,\r
   IN UINT64                           OpenMode,\r
   IN UINT64                           Attributes\r
@@ -511,8 +509,9 @@ ShellOpenFileByDevicePath(
   EFI_FILE_PROTOCOL               *Handle2;\r
   CHAR16                          *FnafPathName;\r
   UINTN                           PathLen;\r
+  EFI_HANDLE                      DeviceHandle;\r
 \r
-  if (FilePath == NULL || FileHandle == NULL || DeviceHandle == NULL) {\r
+  if (FilePath == NULL || FileHandle == NULL) {\r
     return (EFI_INVALID_PARAMETER);\r
   }\r
 \r
@@ -538,11 +537,11 @@ ShellOpenFileByDevicePath(
   //\r
   Status = gBS->LocateDevicePath (&gEfiSimpleFileSystemProtocolGuid,\r
                                   FilePath,\r
-                                  DeviceHandle);\r
+                                  &DeviceHandle);\r
   if (EFI_ERROR (Status)) {\r
     return Status;\r
   }\r
-  Status = gBS->OpenProtocol(*DeviceHandle,\r
+  Status = gBS->OpenProtocol(DeviceHandle,\r
                              &gEfiSimpleFileSystemProtocolGuid,\r
                              (VOID**)&EfiSimpleFileSystemProtocol,\r
                              gImageHandle,\r
@@ -690,7 +689,6 @@ ShellOpenFileByName(
   IN UINT64                     Attributes\r
   )\r
 {\r
-  EFI_HANDLE                    DeviceHandle;\r
   EFI_DEVICE_PATH_PROTOCOL      *FilePath;\r
   EFI_STATUS                    Status;\r
   EFI_FILE_INFO                 *FileInfo;\r
@@ -774,7 +772,6 @@ ShellOpenFileByName(
   FilePath = mEfiShellEnvironment2->NameToPath ((CHAR16*)FileName);\r
   if (FilePath != NULL) {\r
     return (ShellOpenFileByDevicePath(&FilePath,\r
-                                      &DeviceHandle,\r
                                       FileHandle,\r
                                       OpenMode,\r
                                       Attributes));\r
index 0df6323..38d9a4b 100644 (file)
@@ -19,7 +19,7 @@
   BASE_NAME                      = UefiShellLib\r
   FILE_GUID                      = 449D0F00-2148-4a43-9836-F10B3980ECF5\r
   MODULE_TYPE                    = UEFI_DRIVER\r
-  VERSION_STRING                 = 1.1\r
+  VERSION_STRING                 = 1.2\r
   LIBRARY_CLASS                  = ShellLib|UEFI_APPLICATION UEFI_DRIVER DXE_RUNTIME_DRIVER DXE_DRIVER\r
   CONSTRUCTOR                    = ShellLibConstructor\r
   DESTRUCTOR                     = ShellLibDestructor\r