[PATCH 1/6] Add globalvar_add_simple_string function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx>
---
 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


_______________________________________________
barebox mailing list
barebox@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/barebox



[Index of Archives]     [Linux Embedded]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux