]> git.ipfire.org Git - thirdparty/systemd.git/commit
sd-boot: introduce and use efivar_unset()
authorEmil Velikov <emil.velikov@collabora.com>
Wed, 4 Oct 2023 10:51:47 +0000 (11:51 +0100)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 5 Oct 2023 08:13:37 +0000 (09:13 +0100)
commit5ee3c914a4e904567e66654177b07777dde0d100
tree1dd74f3b096a0bdfdedf9a12bbd4c89690ae4dff
parent3b3abf80f1f5436bd47b84430444fc8ac613e39d
sd-boot: introduce and use efivar_unset()

Currently some of the code base check for the variable presence before
removing it, and some do not.

More so, in all cases (being updated) we're dealing with non-volatile
variables where changing those attribute to NVRAM wear out.

From what information I could find, there is no definitive answer if the
UEFI implementation will write to the NVRAM even when the variable is
missing.

So add a simple helper that checks for the variable presence before
removing it. While also having a bit cleaner API than the current
efivar_set(..., NULL, ...);

efivar_unset() follows the design from efivar_set*() where it returns an
EFI_STATUS even though its (presently) unused.

v2:
 - add inline comment, use early return

v3:
 - typos? typos!

Signed-off-by: Emil Velikov <emil.velikov@collabora.com>
src/boot/efi/boot.c
src/boot/efi/util.c
src/boot/efi/util.h