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.65; helo=mga03.intel.com; envelope-from=ruiyu.ni@intel.com; receiver=edk2-devel@lists.01.org Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (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 18369209831C7 for ; Fri, 27 Jul 2018 02:15:06 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Jul 2018 02:15:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,408,1526367600"; d="scan'208";a="75002424" Received: from ray-dev.ccr.corp.intel.com (HELO [10.239.9.4]) ([10.239.9.4]) by fmsmga004.fm.intel.com with ESMTP; 27 Jul 2018 02:14:46 -0700 To: Laszlo Ersek , edk2-devel-01 Cc: Chao Zhang , Eric Dong , Jaben Carsey , Jiaxin Wu , Jiewen Yao , Liming Gao , Michael D Kinney , Roman Bacik , Siyuan Fu , Star Zeng References: <20180718205043.17574-1-lersek@redhat.com> <20180718205043.17574-2-lersek@redhat.com> From: "Ni, Ruiyu" Message-ID: <7ab55ec6-58a5-2353-12ec-e048ba4107e9@Intel.com> Date: Fri, 27 Jul 2018 17:15:21 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20180718205043.17574-2-lersek@redhat.com> Subject: Re: [PATCH 1/6] MdePkg/UefiLib: introduce EfiOpenFileByDevicePath() 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, 27 Jul 2018 09:15:07 -0000 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 7/19/2018 4:50 AM, Laszlo Ersek wrote: > + // > + // Open the next pathname fragment with EFI_FILE_MODE_CREATE masked out and > + // with Attributes set to 0. > + // > + Status = LastFile->Open ( > + LastFile, > + &NextFile, > + PathName, > + OpenMode & ~(UINT64)EFI_FILE_MODE_CREATE, > + 0 > + ); > + > + // > + // 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 > + ); > + } Laszlo, Why to open the file firstly with CREATE flag off? Per spec, when CREATE is set but file exists, the file is opened. -- Thanks, Ray