[U-Boot] [RFC PATCH v2 4/7] env: Introduce "transient" and "system" access flags

Joe Hershberger joe.hershberger at gmail.com
Sun Nov 27 19:53:15 CET 2016


On Wed, Nov 16, 2016 at 4:29 AM, Bernhard Nortmann
<bernhard.nortmann at web.de> wrote:
> "transient" (='t') is like "any", but requests that a variable
> should not be exported (ENV_FLAGS_VARACCESS_PREVENT_EXPORT).
>
> "system" (='S') is meant for 'internal' variables that

The flags are positional, so 's' is not in use. It seems it would be
cleaner to use a lower-case 's'.

> aren't supposed to be changed by the user. It corresponds
> to "transient" plus "read-only".
>
> Signed-off-by: Bernhard Nortmann <bernhard.nortmann at web.de>
>
> ---
>
> Changes in v2:
> - Fixed outdated "env_flags_varaccess_lock" to the correct
>   "env_flags_varaccess_system"
>
>  common/env_flags.c  | 11 +++++++++--
>  include/env_flags.h |  2 ++
>  2 files changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/common/env_flags.c b/common/env_flags.c
> index f39d952..2c30c7f 100644
> --- a/common/env_flags.c
> +++ b/common/env_flags.c
> @@ -28,7 +28,7 @@
>  #endif
>
>  static const char env_flags_vartype_rep[] = "sdxb" ENV_FLAGS_NET_VARTYPE_REPS;
> -static const char env_flags_varaccess_rep[] = "aroc";
> +static const char env_flags_varaccess_rep[] = "aroctS";
>  static const int env_flags_varaccess_mask[] = {
>         0,
>         ENV_FLAGS_VARACCESS_PREVENT_DELETE |
> @@ -37,7 +37,12 @@ static const int env_flags_varaccess_mask[] = {
>         ENV_FLAGS_VARACCESS_PREVENT_DELETE |
>                 ENV_FLAGS_VARACCESS_PREVENT_OVERWR,
>         ENV_FLAGS_VARACCESS_PREVENT_DELETE |
> -               ENV_FLAGS_VARACCESS_PREVENT_NONDEF_OVERWR};
> +               ENV_FLAGS_VARACCESS_PREVENT_NONDEF_OVERWR,
> +       ENV_FLAGS_VARACCESS_PREVENT_EXPORT,
> +       ENV_FLAGS_VARACCESS_PREVENT_DELETE |
> +               ENV_FLAGS_VARACCESS_PREVENT_CREATE |
> +               ENV_FLAGS_VARACCESS_PREVENT_OVERWR |
> +               ENV_FLAGS_VARACCESS_PREVENT_EXPORT};
>
>  #ifdef CONFIG_CMD_ENV_FLAGS
>  static const char * const env_flags_vartype_names[] = {
> @@ -55,6 +60,8 @@ static const char * const env_flags_varaccess_names[] = {
>         "read-only",
>         "write-once",
>         "change-default",
> +       "transient",    /* do not export/save */
> +       "system",       /* = "transient" plus "read-only" */

I'm not sure why you are adding "transient" or "volatile" to the
varaccess. It is an orthogonal property of a variable. This is obvious
from the fact that you need to add yet another to compose varaccess
with varlifetime (or something).

I worked on something similar years ago, but never posted an RFC.

http://lists.denx.de/pipermail/u-boot/2010-June/073027.html

>  };
>
>  /*
> diff --git a/include/env_flags.h b/include/env_flags.h
> index 7e2362a..9d66706 100644
> --- a/include/env_flags.h
> +++ b/include/env_flags.h
> @@ -25,6 +25,8 @@ enum env_flags_varaccess {
>         env_flags_varaccess_readonly,
>         env_flags_varaccess_writeonce,
>         env_flags_varaccess_changedefault,
> +       env_flags_varaccess_transient,
> +       env_flags_varaccess_system,
>         env_flags_varaccess_end
>  };
>
> --
> 2.7.3
>
> _______________________________________________
> U-Boot mailing list
> U-Boot at lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot


More information about the U-Boot mailing list