summaryrefslogtreecommitdiffstats
path: root/include/globalvar.h
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2015-06-18 08:45:11 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2015-06-18 09:01:01 +0200
commitacc930f1e9c482dc826bb63a6b9d36463a280210 (patch)
treed2cb09574f004455ee197411816bb90ca2a9af93 /include/globalvar.h
parente544ffd1233eda141ad4b8df481716005c0d403e (diff)
downloadbarebox-acc930f1e9c482dc826bb63a6b9d36463a280210.tar.gz
barebox-acc930f1e9c482dc826bb63a6b9d36463a280210.tar.xz
Add globalvar_add_simple_string function
This adds a globalvar string function to pass a pointer to a string. With this we can directly access the string to get the variable and don't have to getenv() the string first. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include/globalvar.h')
-rw-r--r--include/globalvar.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/globalvar.h b/include/globalvar.h
index 8b2caf1f8b..6e10956b89 100644
--- a/include/globalvar.h
+++ b/include/globalvar.h
@@ -17,6 +17,20 @@ int globalvar_add(const char *name,
char *globalvar_get_match(const char *match, const char *separator);
void globalvar_set_match(const char *match, const char *val);
+static inline int globalvar_add_simple_string(const char *name,
+ char **value)
+{
+ struct param_d *p;
+
+ p = dev_add_param_string(&global_device, name, NULL, NULL,
+ value, NULL);
+
+ if (IS_ERR(p))
+ return PTR_ERR(p);
+
+ return 0;
+}
+
static inline int globalvar_add_simple_int(const char *name,
int *value, const char *format)
{
@@ -85,6 +99,11 @@ static inline int globalvar_add_simple(const char *name, const char *value)
return 0;
}
+static inline int globalvar_add_simple_string(const char *name, char **value)
+{
+ return 0;
+}
+
static inline int globalvar_add_simple_int(const char *name,
int *value, const char *format)
{