[PATCH v6 2/3] efi_var: Unify read/write access helper function
Maarten Brock
Maarten.Brock at sttls.nl
Tue Feb 3 10:44:15 CET 2026
Hello Michal,
Why are the new function names non-symmetrical?
efi_var_to_storage <-> efi_var_from ...
Maarten
> -----Original Message-----
> From: U-Boot <u-boot-bounces at lists.denx.de> On Behalf Of Michal Simek
> Sent: Tuesday 3 February 2026 8:58
> To: u-boot at lists.denx.de; git at amd.com
> Cc: Ilias Apalodimas <ilias.apalodimas at linaro.org>; Heinrich Schuchardt
> <xypron.glpk at gmx.de>; Shantur Rathore <i at shantur.com>; Tom Rini
> <trini at konsulko.com>
> Subject: [PATCH v6 2/3] efi_var: Unify read/write access helper function
>
> efi_var_to/from_file() suggest method where variables are placed. But there
> is no reason for it and generic name can be used to wire also different
> locations for variables.
>
> Signed-off-by: Michal Simek <michal.simek at amd.com>
> Reviewed-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
> ---
>
> Changes in v6:
> - sed -i 's/efi_var_read/efi_var_from/g'
> - sed -i 's/efi_var_write/efi_var_to_storage/g'
>
> Changes in v4:
> - New patch based on review comments from v3
>
> include/efi_variable.h | 13 ++++---------
> lib/efi_loader/efi_var_file.c | 8 ++++----
> lib/efi_loader/efi_variable.c | 4 ++--
> 3 files changed, 10 insertions(+), 15 deletions(-)
>
> diff --git a/include/efi_variable.h b/include/efi_variable.h
> index ee68fa4a885f..2b06505b8654 100644
> --- a/include/efi_variable.h
> +++ b/include/efi_variable.h
> @@ -137,13 +137,11 @@ struct efi_var_file {
> };
>
> /**
> - * efi_var_to_file() - save non-volatile variables as file
> - *
> - * File ubootefi.var is created on the EFI system partion.
> + * efi_var_to_storage() - save non-volatile variables
> *
> * Return: status code
> */
> -efi_status_t efi_var_to_file(void);
> +efi_status_t efi_var_to_storage(void);
>
> /**
> * efi_var_collect() - collect variables in buffer
> @@ -178,17 +176,14 @@ efi_status_t __maybe_unused
> efi_var_collect(struct efi_var_file **bufp, loff_t *
> efi_status_t efi_var_restore(struct efi_var_file *buf, bool safe);
>
> /**
> - * efi_var_from_file() - read variables from file
> - *
> - * File ubootefi.var is read from the EFI system partitions and the variables
> - * stored in the file are created.
> + * efi_var_from() - read variables
> *
> * In case the file does not exist yet or a variable cannot be set EFI_SUCCESS
> * is returned.
> *
> * Return: status code
> */
> -efi_status_t efi_var_from_file(void);
> +efi_status_t efi_var_from(void);
>
> /**
> * efi_var_mem_init() - set-up variable list
> diff --git a/lib/efi_loader/efi_var_file.c b/lib/efi_loader/efi_var_file.c
> index d32edaac277d..d012d6a18b02 100644
> --- a/lib/efi_loader/efi_var_file.c
> +++ b/lib/efi_loader/efi_var_file.c
> @@ -43,13 +43,13 @@ static efi_status_t __maybe_unused
> efi_set_blk_dev_to_system_partition(void)
> }
>
> /**
> - * efi_var_to_file() - save non-volatile variables as file
> + * efi_var_to_storage() - save non-volatile variables as file
> *
> * File ubootefi.var is created on the EFI system partion.
> *
> * Return: status code
> */
> -efi_status_t efi_var_to_file(void)
> +efi_status_t efi_var_to_storage(void)
> {
> efi_status_t ret;
> struct efi_var_file *buf;
> @@ -85,7 +85,7 @@ out:
> }
>
> /**
> - * efi_var_from_file() - read variables from file
> + * efi_var_from() - read variables from file
> *
> * File ubootefi.var is read from the EFI system partitions and the variables
> * stored in the file are created.
> @@ -98,7 +98,7 @@ out:
> *
> * Return: status code
> */
> -efi_status_t efi_var_from_file(void)
> +efi_status_t efi_var_from(void)
> {
> struct efi_var_file *buf;
> loff_t len;
> diff --git a/lib/efi_loader/efi_variable.c b/lib/efi_loader/efi_variable.c
> index 6e45134c61bf..42f3ba901556 100644
> --- a/lib/efi_loader/efi_variable.c
> +++ b/lib/efi_loader/efi_variable.c
> @@ -404,7 +404,7 @@ efi_status_t efi_set_variable_int(const u16
> *variable_name,
> if (IS_ENABLED(CONFIG_EFI_VARIABLE_NO_STORE))
> return EFI_SUCCESS;
>
> - efi_var_to_file();
> + efi_var_to_storage();
> }
>
> return EFI_SUCCESS;
> @@ -599,7 +599,7 @@ efi_status_t efi_init_variables(void)
> return ret;
>
> if (!IS_ENABLED(CONFIG_EFI_VARIABLE_NO_STORE)) {
> - ret = efi_var_from_file();
> + ret = efi_var_from();
> if (ret != EFI_SUCCESS)
> return ret;
> }
> --
> 2.43.0
More information about the U-Boot
mailing list