]> git.proxmox.com Git - mirror_edk2.git/commit - MdePkg/Include/Library/UefiLib.h
MdePkg/UefiLib: don't special-case EFI_FILE_MODE_CREATE in OpenMode
authorLaszlo Ersek <lersek@redhat.com>
Fri, 17 Aug 2018 12:55:23 +0000 (14:55 +0200)
committerLaszlo Ersek <lersek@redhat.com>
Wed, 22 Aug 2018 08:31:47 +0000 (10:31 +0200)
commit5dbc768f1cd988b87932ba2f176caa006064018d
treec3a82e3703e6bc0d96766f16905123cabe79505c
parente0c93c9b76153bc5a95bf174dab9805ec2f2942c
MdePkg/UefiLib: don't special-case EFI_FILE_MODE_CREATE in OpenMode

While reviewing the patch that would land as 768b611136d0
("MdePkg/UefiLib: introduce EfiOpenFileByDevicePath()", 2018-08-16), Ray
pointed out that distinguishing EFI_FILE_MODE_CREATE was wasteful. Per
spec, if the file to create exists, then EFI_FILE_MODE_CREATE is ignored
by EFI_FILE_PROTOCOL.Open(), and the existent file is opened.

Therefore we don't need an attempt to "open-but-not-create" first, and a
fallback to "open-and-create-too" second -- that behavior is internal to
EFI_FILE_PROTOCOL.Open(). Remove the special-casing of
EFI_FILE_MODE_CREATE.

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>
MdePkg/Include/Library/UefiLib.h
MdePkg/Library/UefiLib/UefiLib.c