[PATCH v7 2/3] efi_var: Unify read/write access helper function
Michal Simek
michal.simek at amd.com
Tue Feb 3 12:51:27 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>
Reviewed-by: Ilias Apalodimas <ilias.apalodimas at linaro.org>
---
Changes in v7:
- sed -i 's/efi_var_from/efi_var_from_storage/g'
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..fc1184e5ca1a 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_storage() - 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_storage(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..3b50911215eb 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_storage() - 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_storage(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..8512bc20f11e 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_storage();
if (ret != EFI_SUCCESS)
return ret;
}
--
2.43.0
More information about the U-Boot
mailing list