From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=liming.gao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (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 CD65D210F48CF for ; Fri, 17 Aug 2018 13:36:59 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 17 Aug 2018 13:36:59 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.53,251,1531810800"; d="scan'208";a="225549724" Received: from fmsmsx105.amr.corp.intel.com ([10.18.124.203]) by orsmga004.jf.intel.com with ESMTP; 17 Aug 2018 13:35:16 -0700 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by FMSMSX105.amr.corp.intel.com (10.18.124.203) with Microsoft SMTP Server (TLS) id 14.3.319.2; Fri, 17 Aug 2018 13:35:10 -0700 Received: from shsmsx104.ccr.corp.intel.com ([169.254.5.143]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.150]) with mapi id 14.03.0319.002; Sat, 18 Aug 2018 04:35:09 +0800 From: "Gao, Liming" To: Laszlo Ersek , edk2-devel-01 CC: "Kinney, Michael D" , "Ni, Ruiyu" Thread-Topic: [PATCH 2/4] IntelFrameworkPkg/FrameworkUefiLib: don't special-case EFI_FILE_MODE_CREATE Thread-Index: AQHUNjeU7J2gjYolcEGkjZ5vJsJe7aTEZxzQ Date: Fri, 17 Aug 2018 20:35:08 +0000 Message-ID: <4A89E2EF3DFEDB4C8BFDE51014F606A14E2E52D5@SHSMSX104.ccr.corp.intel.com> References: <20180817143534.28393-1-lersek@redhat.com> <20180817143534.28393-3-lersek@redhat.com> In-Reply-To: <20180817143534.28393-3-lersek@redhat.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ctpclassification: CTP_NT x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMmNlODc2MmMtOGU3Ny00MGE2LThlMDYtYjM1MTE0ODEyOTRiIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoicXF0SlhCSjdJUjBLTzI5OEsyZnNTXC9qV3NMUHY1a1Z5eTlcL29Na2NKSDl2cDl6U1RTNmQ5RkxQT1RcL2F2RDV4RCJ9 dlp-product: dlpe-windows dlp-version: 11.0.400.15 dlp-reaction: no-action x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [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.29 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 20:37:00 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Liming Gao > -----Original Message----- > From: Laszlo Ersek [mailto:lersek@redhat.com] > Sent: Friday, August 17, 2018 7:36 AM > To: edk2-devel-01 > Cc: Gao, Liming ; Kinney, Michael D ; Ni, Ruiyu > Subject: [PATCH 2/4] IntelFrameworkPkg/FrameworkUefiLib: don't special-ca= se EFI_FILE_MODE_CREATE >=20 > Synchronize EfiOpenFileByDevicePath() with the MdePkg/UefiLib instance, a= s > described in the previous patch. >=20 > Cc: Liming Gao > Cc: Michael D Kinney > Cc: Ruiyu Ni > Suggested-by: Ruiyu Ni > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D1074 > Contributed-under: TianoCore Contribution Agreement 1.1 > Signed-off-by: Laszlo Ersek > --- >=20 > Notes: > build-tested with: >=20 > build -a IA32 -a X64 -b NOOPT -t GCC48 \ > -p IntelFrameworkPkg/IntelFrameworkPkg.dsc \ > -m IntelFrameworkPkg/Library/FrameworkUefiLib/FrameworkUefiLib.inf >=20 > IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c | 40 +++-----------= ------ > 1 file changed, 6 insertions(+), 34 deletions(-) >=20 > diff --git a/IntelFrameworkPkg/Library/FrameworkUefiLib/UefiLib.c b/Intel= FrameworkPkg/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 ( >=20 > 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 m= asks > - EFI_FILE_MODE_CREATE out of OpenMode, and passes 0 for Attributes. If > - EFI_FILE_PROTOCOL.Open() fails, and OpenMode includes EFI_FILE_MODE_CR= EATE, > - then the operation is retried with the caller's OpenMode and Attribute= s > - unmodified. > + EFI_FILE_PROTOCOL.Open(). >=20 > (As a consequence, if OpenMode includes EFI_FILE_MODE_CREATE, and Attr= ibutes > includes EFI_FILE_DIRECTORY, and each FILEPATH_DEVICE_PATH specifies a= single > @@ -1739,18 +1734,10 @@ EfiLocateProtocolBuffer ( > the last node in FilePath. >=20 > @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 spe= cified > - pathname fragment with EFI_FILE_MODE_CREATE m= asked > - 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 fir= st open > - attempt fails. > + EFI_FILE_PROTOCOL.Open(). >=20 > @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(). >=20 > @retval EFI_SUCCESS The file or directory has been opened o= r > created. > @@ -1861,31 +1848,16 @@ EfiOpenFileByDevicePath ( > } >=20 > // > - // 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 fragme= nt. > // > Status =3D LastFile->Open ( > LastFile, > &NextFile, > PathName, > - OpenMode & ~(UINT64)EFI_FILE_MODE_CREATE, > - 0 > + OpenMode, > + Attributes > ); >=20 > - // > - // Retry with EFI_FILE_MODE_CREATE and the original Attributes if th= e first > - // attempt failed, and the caller specified EFI_FILE_MODE_CREATE. > - // > - if (EFI_ERROR (Status) && (OpenMode & EFI_FILE_MODE_CREATE) !=3D 0) = { > - Status =3D LastFile->Open ( > - LastFile, > - &NextFile, > - PathName, > - OpenMode, > - Attributes > - ); > - } > - > // > // Release any AlignedPathName on both error and success paths; Path= Name is > // no longer needed. > -- > 2.14.1.3.gb7cf6e02401b >=20