[PATCH 1/6] Add globalvar_add_simple_string function

Sascha Hauer s.hauer at pengutronix.de
Thu Jun 18 00:43:39 PDT 2015


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 at pengutronix.de>
---
 include/globalvar.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/include/globalvar.h b/include/globalvar.h
index 8b2caf1..6e10956 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)
 {
-- 
2.1.4




More information about the barebox mailing list