diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2015-06-18 08:45:11 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2015-06-18 09:01:01 +0200 |
commit | acc930f1e9c482dc826bb63a6b9d36463a280210 (patch) | |
tree | d2cb09574f004455ee197411816bb90ca2a9af93 /include/globalvar.h | |
parent | e544ffd1233eda141ad4b8df481716005c0d403e (diff) | |
download | barebox-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.h | 19 |
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) { |