summaryrefslogtreecommitdiff
path: root/common/env_common.c
diff options
context:
space:
mode:
authorJoe Hershberger <joe.hershberger@ni.com>2012-12-11 22:16:34 -0600
committerTom Rini <trini@ti.com>2012-12-13 11:46:56 -0700
commit267541f776f1e2bec21681c6e39a4c93af9621cf (patch)
tree861ff411eab98193f9914d30ec420628e79912e0 /common/env_common.c
parentfffad71bc489cf224eda6d826a1645423852ee45 (diff)
downloadu-boot-imx-267541f776f1e2bec21681c6e39a4c93af9621cf.zip
u-boot-imx-267541f776f1e2bec21681c6e39a4c93af9621cf.tar.gz
u-boot-imx-267541f776f1e2bec21681c6e39a4c93af9621cf.tar.bz2
env: Add support for access control to .flags
Add support for read-only, write-once, and change-default. Signed-off-by: Joe Hershberger <joe.hershberger@ni.com>
Diffstat (limited to 'common/env_common.c')
-rw-r--r--common/env_common.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/common/env_common.c b/common/env_common.c
index bb18070..906b41f 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -95,6 +95,24 @@ int getenv_yesno(const char *var)
1 : 0;
}
+/*
+ * Look up the variable from the default environment
+ */
+char *getenv_default(const char *name)
+{
+ char *ret_val;
+ unsigned long really_valid = gd->env_valid;
+ unsigned long real_gd_flags = gd->flags;
+
+ /* Pretend that the image is bad. */
+ gd->flags &= ~GD_FLG_ENV_READY;
+ gd->env_valid = 0;
+ ret_val = getenv(name);
+ gd->env_valid = really_valid;
+ gd->flags = real_gd_flags;
+ return ret_val;
+}
+
void set_default_env(const char *s)
{
int flags = 0;