I am ok with this with a small nit.
Can we rename efi_var_read/write to efi_var_from/to_storage? I want to
make it clealer what these functions are used for

With the changes above
Reviewed-by: Ilias Apalodimas <[email protected]>

On Fri, 23 Jan 2026 at 16:17, Michal Simek <[email protected]> wrote:
>
> 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 <[email protected]>
> ---
>
> (no changes since v4)
>
> 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..ae542c597129 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_write() - save non-volatile variables
>   *
>   * Return:     status code
>   */
> -efi_status_t efi_var_to_file(void);
> +efi_status_t efi_var_write(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_read() - 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_read(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..01ac7cc20e1f 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_write() - 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_write(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_read() - 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_read(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 13db6eae882a..124281c29c7d 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_NOT_READY;
>
> -               efi_var_to_file();
> +               efi_var_write();
>         }
>
>         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_read();
>                 if (ret != EFI_SUCCESS)
>                         return ret;
>         }
> --
> 2.43.0
>

Reply via email to