[PATCH v4 2/3] efi_var: Unify read/write access helper function
Michal Simek
michal.simek at amd.com
Wed Jan 14 16:15:34 CET 2026
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>
---
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 9394ecf6994c..be670a8e7c25 100644
--- a/lib/efi_loader/efi_variable.c
+++ b/lib/efi_loader/efi_variable.c
@@ -402,7 +402,7 @@ efi_status_t efi_set_variable_int(const u16 *variable_name,
*/
if (attributes & EFI_VARIABLE_NON_VOLATILE) {
#if CONFIG_IS_ENABLED(EFI_VARIABLE_FILE_STORE)
- efi_var_to_file();
+ efi_var_write();
#else
return EFI_NOT_READY;
#endif
@@ -600,7 +600,7 @@ efi_status_t efi_init_variables(void)
return ret;
#if CONFIG_IS_ENABLED(EFI_VARIABLE_FILE_STORE)
- ret = efi_var_from_file();
+ ret = efi_var_read();
if (ret != EFI_SUCCESS)
return ret;
#endif
--
2.43.0
More information about the U-Boot
mailing list