diff mbox series

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

Message ID 20190717082525.891-11-takahiro.akashi@linaro.org
State RFC
Delegated to: Heinrich Schuchardt
Headers show
Series efi_loader: non-volatile variables support | expand

Commit Message

AKASHI Takahiro July 17, 2019, 8:25 a.m. UTC
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@linaro.org>
---
 env/common.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

Comments

Wolfgang Denk July 19, 2019, 8:45 a.m. UTC | #1
Dear AKASHI Takahiro,

In message <20190717082525.891-11-takahiro.akashi@linaro.org> you wrote:
> Once variable storage attribute is introduced, only NON_VOLATILE or
> NON_VOLATILE_AUTOSAVE variables should be saved to backing storage.

This logis is wrong.

It should read:

	Variables which have the "volatile" flag set will be skipped
	when savong the environment.

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

This is completely independent, and should eventually even be a
separate commit:

	Variables which have the 'autosave" flag set are saved with
	each (successful) env_set().

Yes, I made up my mind:

Adding "volatile" and "autosave" is two independent features, this
should be relfected in two separate commits / patch series.

Probably even independent from and preceeding the context series.

Best regards,

Wolfgang Denk
diff mbox series

Patch

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);