From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id A818E210F30C8 for ; Fri, 17 Aug 2018 07:35:40 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E82464059FF7; Fri, 17 Aug 2018 14:35:39 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-113.rdu2.redhat.com [10.10.120.113]) by smtp.corp.redhat.com (Postfix) with ESMTP id 24B521745B; Fri, 17 Aug 2018 14:35:39 +0000 (UTC) From: Laszlo Ersek To: edk2-devel-01 Cc: Liming Gao , Michael D Kinney , Ruiyu Ni Date: Fri, 17 Aug 2018 16:35:32 +0200 Message-Id: <20180817143534.28393-3-lersek@redhat.com> In-Reply-To: <20180817143534.28393-1-lersek@redhat.com> References: <20180817143534.28393-1-lersek@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 17 Aug 2018 14:35:39 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Fri, 17 Aug 2018 14:35:39 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: [PATCH 2/4] IntelFrameworkPkg/FrameworkUefiLib: don't special-case EFI_FILE_MODE_CREATE X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Aug 2018 14:35:41 -0000 Synchronize EfiOpenFileByDevicePath() with the MdePkg/UefiLib instance, as described in the previous patch. Cc: Liming Gao Cc: Michael D Kinney Cc: Ruiyu Ni Suggested-by: Ruiyu Ni Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1074 Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek --- Notes: build-tested with: build -a IA32 -a X64 -b NOOPT -t GCC48 \ -p IntelFrameworkPkg/IntelFrameworkPkg.dsc \ -m IntelFrameworkPkg/Library/FrameworkUefiLib/FrameworkUefiLib.inf IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c | 40 +++----------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c index b283d775b470..45bf4b17c5c3 100644 --- a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c +++ b/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c @@ -1702,12 +1702,7 @@ EfiLocateProtocolBuffer ( On the remaining device path, the longest initial sequence of FILEPATH_DEVICE_PATH nodes is node-wise traversed with - EFI_FILE_PROTOCOL.Open(). For the pathname fragment specified by each - traversed FILEPATH_DEVICE_PATH node, EfiOpenFileByDevicePath() first masks - EFI_FILE_MODE_CREATE out of OpenMode, and passes 0 for Attributes. If - EFI_FILE_PROTOCOL.Open() fails, and OpenMode includes EFI_FILE_MODE_CREATE, - then the operation is retried with the caller's OpenMode and Attributes - unmodified. + EFI_FILE_PROTOCOL.Open(). (As a consequence, if OpenMode includes EFI_FILE_MODE_CREATE, and Attributes includes EFI_FILE_DIRECTORY, and each FILEPATH_DEVICE_PATH specifies a single @@ -1739,18 +1734,10 @@ EfiLocateProtocolBuffer ( the last node in FilePath. @param[in] OpenMode The OpenMode parameter to pass to - EFI_FILE_PROTOCOL.Open(). For each - FILEPATH_DEVICE_PATH node in FilePath, - EfiOpenFileByDevicePath() first opens the specified - pathname fragment with EFI_FILE_MODE_CREATE masked - out of OpenMode and with Attributes set to 0, and - only retries the operation with EFI_FILE_MODE_CREATE - unmasked and Attributes propagated if the first open - attempt fails. + EFI_FILE_PROTOCOL.Open(). @param[in] Attributes The Attributes parameter to pass to - EFI_FILE_PROTOCOL.Open(), when EFI_FILE_MODE_CREATE - is propagated unmasked in OpenMode. + EFI_FILE_PROTOCOL.Open(). @retval EFI_SUCCESS The file or directory has been opened or created. @@ -1861,31 +1848,16 @@ EfiOpenFileByDevicePath ( } // - // Open the next pathname fragment with EFI_FILE_MODE_CREATE masked out and - // with Attributes set to 0. + // Open or create the file corresponding to the next pathname fragment. // Status = LastFile->Open ( LastFile, &NextFile, PathName, - OpenMode & ~(UINT64)EFI_FILE_MODE_CREATE, - 0 + OpenMode, + Attributes ); - // - // Retry with EFI_FILE_MODE_CREATE and the original Attributes if the first - // attempt failed, and the caller specified EFI_FILE_MODE_CREATE. - // - if (EFI_ERROR (Status) && (OpenMode & EFI_FILE_MODE_CREATE) != 0) { - Status = LastFile->Open ( - LastFile, - &NextFile, - PathName, - OpenMode, - Attributes - ); - } - // // Release any AlignedPathName on both error and success paths; PathName is // no longer needed. -- 2.14.1.3.gb7cf6e02401b