[U-Boot] [RFC, PATCH v4 10/16] env: save non-volatile variables only

AKASHI Takahiro takahiro.akashi at linaro.org
Wed Jul 17 08:25:19 UTC 2019


Once variable storage attribute is introduced, only NON_VOLATILE or
NON_VOLATILE_AUTOSAVE variables should be saved to backing storage.

In addition, NON_VOLATILE_AUTOSAVE variables are saved immediately
at env_set[_ext]().

Signed-off-by: AKASHI Takahiro <takahiro.akashi at linaro.org>
---
 env/common.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/env/common.c b/env/common.c
index c2a2d9f22feb..832a54e9faa2 100644
--- a/env/common.c
+++ b/env/common.c
@@ -230,6 +230,7 @@ int env_export_ext(env_hdr_t **env_out, enum env_context ctx)
 	size_t size;
 	ssize_t	len;
 	env_hdr_t *envp;
+	char * const match[] = {"..n", "..a",};
 
 	if (*env_out) {
 		data = (*env_out)->data;
@@ -238,8 +239,9 @@ int env_export_ext(env_hdr_t **env_out, enum env_context ctx)
 		data = NULL;
 		size = 0;
 	}
-	len = hexport_ext(&env_htab, ctx, '\0', 0, (char **)&data, size,
-			  0, NULL);
+	/* TODO: H_MATCH_REGEX */
+	len = hexport_ext(&env_htab, ctx, '\0', H_MATCH_FLAGS | H_MATCH_IDENT,
+			  (char **)&data, size, 2, match);
 	if (len < 0) {
 		pr_err("Cannot export environment: errno = %d\n",
 		       errno);
-- 
2.21.0



More information about the U-Boot mailing list