]> git.proxmox.com Git - mirror_edk2.git/commitdiff
IntelFrameworkPkg/FrameworkUefiLib: don't special-case EFI_FILE_MODE_CREATE
authorLaszlo Ersek <lersek@redhat.com>
Fri, 17 Aug 2018 13:06:35 +0000 (15:06 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Wed, 22 Aug 2018 08:32:24 +0000 (10:32 +0200)
Synchronize EfiOpenFileByDevicePath() with the MdePkg/UefiLib instance, as
described in the previous patch.

Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Suggested-by: Ruiyu Ni <ruiyu.ni@intel.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1074
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c

index b283d775b47098b265ed5690f32d3f20baf25e41..45bf4b17c5c3bb951cf8a2eec0e0db0348dce0b6 100644 (file)
@@ -1702,12 +1702,7 @@ EfiLocateProtocolBuffer (
 \r
   On the remaining device path, the longest initial sequence of\r
   FILEPATH_DEVICE_PATH nodes is node-wise traversed with\r
-  EFI_FILE_PROTOCOL.Open(). For the pathname fragment specified by each\r
-  traversed FILEPATH_DEVICE_PATH node, EfiOpenFileByDevicePath() first masks\r
-  EFI_FILE_MODE_CREATE out of OpenMode, and passes 0 for Attributes. If\r
-  EFI_FILE_PROTOCOL.Open() fails, and OpenMode includes EFI_FILE_MODE_CREATE,\r
-  then the operation is retried with the caller's OpenMode and Attributes\r
-  unmodified.\r
+  EFI_FILE_PROTOCOL.Open().\r
 \r
   (As a consequence, if OpenMode includes EFI_FILE_MODE_CREATE, and Attributes\r
   includes EFI_FILE_DIRECTORY, and each FILEPATH_DEVICE_PATH specifies a single\r
@@ -1739,18 +1734,10 @@ EfiLocateProtocolBuffer (
                            the last node in FilePath.\r
 \r
   @param[in] OpenMode      The OpenMode parameter to pass to\r
-                           EFI_FILE_PROTOCOL.Open(). For each\r
-                           FILEPATH_DEVICE_PATH node in FilePath,\r
-                           EfiOpenFileByDevicePath() first opens the specified\r
-                           pathname fragment with EFI_FILE_MODE_CREATE masked\r
-                           out of OpenMode and with Attributes set to 0, and\r
-                           only retries the operation with EFI_FILE_MODE_CREATE\r
-                           unmasked and Attributes propagated if the first open\r
-                           attempt fails.\r
+                           EFI_FILE_PROTOCOL.Open().\r
 \r
   @param[in] Attributes    The Attributes parameter to pass to\r
-                           EFI_FILE_PROTOCOL.Open(), when EFI_FILE_MODE_CREATE\r
-                           is propagated unmasked in OpenMode.\r
+                           EFI_FILE_PROTOCOL.Open().\r
 \r
   @retval EFI_SUCCESS            The file or directory has been opened or\r
                                  created.\r
@@ -1861,31 +1848,16 @@ EfiOpenFileByDevicePath (
     }\r
 \r
     //\r
-    // Open the next pathname fragment with EFI_FILE_MODE_CREATE masked out and\r
-    // with Attributes set to 0.\r
+    // Open or create the file corresponding to the next pathname fragment.\r
     //\r
     Status = LastFile->Open (\r
                          LastFile,\r
                          &NextFile,\r
                          PathName,\r
-                         OpenMode & ~(UINT64)EFI_FILE_MODE_CREATE,\r
-                         0\r
+                         OpenMode,\r
+                         Attributes\r
                          );\r
 \r
-    //\r
-    // Retry with EFI_FILE_MODE_CREATE and the original Attributes if the first\r
-    // attempt failed, and the caller specified EFI_FILE_MODE_CREATE.\r
-    //\r
-    if (EFI_ERROR (Status) && (OpenMode & EFI_FILE_MODE_CREATE) != 0) {\r
-      Status = LastFile->Open (\r
-                           LastFile,\r
-                           &NextFile,\r
-                           PathName,\r
-                           OpenMode,\r
-                           Attributes\r
-                           );\r
-    }\r
-\r
     //\r
     // Release any AlignedPathName on both error and success paths; PathName is\r
     // no longer needed.\r