summaryrefslogtreecommitdiffstats
path: root/common/env.c
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2011-11-26 13:53:42 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2011-11-29 20:55:50 +0100
commita94db01cdce44acc50c7ad8ebcb9040b0020fabd (patch)
tree7437bd7b7980597970f151772fda2436afe79350 /common/env.c
parent248e5f1cbed581c1bf6288831b6888e2166fb952 (diff)
downloadbarebox-a94db01cdce44acc50c7ad8ebcb9040b0020fabd.tar.gz
introduce some env helpers
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/env.c')
-rw-r--r--common/env.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/common/env.c b/common/env.c
index 05ed714..e57a520 100644
--- a/common/env.c
+++ b/common/env.c
@@ -251,3 +251,25 @@ int export(const char *varname)
return 0;
}
EXPORT_SYMBOL(export);
+
+void export_env_ull(const char *name, unsigned long long val)
+{
+ char *valstr = asprintf("%lld", val);
+
+ setenv(name, valstr);
+ export(name);
+
+ kfree(valstr);
+}
+EXPORT_SYMBOL(export_env_ull);
+
+unsigned long long getenv_ull(const char *name)
+{
+ const char *valstr = getenv(name);
+
+ if (!valstr)
+ return 0;
+
+ return simple_strtoull(valstr, NULL, 0);
+}
+EXPORT_SYMBOL(getenv_ull);