summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2012-04-29 20:21:16 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2012-05-14 08:57:01 +0200
commitb8c94a15611ce7e191d022a3cd9f3ba23930a9c8 (patch)
treef0daa10332462b729219562cfca592c0f9268770 /include
parent9b42dfff0f2cecb6a9c7581c4c0c59ed9c9c586d (diff)
downloadbarebox-b8c94a15611ce7e191d022a3cd9f3ba23930a9c8.tar.gz
barebox-b8c94a15611ce7e191d022a3cd9f3ba23930a9c8.tar.xz
add 'global' command
This implements global shell variable support. This is done by registering a new device named 'global', so global variables are just plain device parameters. Global variables are useful for storing the global state in the environment. Currently we do this by sourcing scripts instead of executing them which is quite limiting. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r--include/globalvar.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/globalvar.h b/include/globalvar.h
new file mode 100644
index 0000000000..7cc3976f6b
--- /dev/null
+++ b/include/globalvar.h
@@ -0,0 +1,12 @@
+#ifndef __GLOBALVAR_H
+#define __GLOBALVAR_H
+
+int globalvar_add_simple(const char *name);
+
+int globalvar_add(const char *name,
+ int (*set)(struct device_d *dev, struct param_d *p, const char *val),
+ const char *(*get)(struct device_d *, struct param_d *p),
+ unsigned long flags);
+char *globalvar_get_match(const char *match, const char *seperator);
+
+#endif /* __GLOBALVAR_H */