summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2014-01-23 13:58:49 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2014-01-27 09:27:02 +0100
commit25cee7ec176693c40d80c1614e1244624e803a85 (patch)
treef3a4c680270487d3d21b68aa30cca2e0a0c17f89 /common
parentdac65f99e8bf1fbe2e15fa96ef901623bb49dc89 (diff)
downloadbarebox-25cee7ec176693c40d80c1614e1244624e803a85.tar.gz
barebox-25cee7ec176693c40d80c1614e1244624e803a85.tar.xz
environment: Use accessor functions for default environment path
default_environment_path only exists when CONFIG_ENV_HANDLING is enabled. Boards would have to #ifdef this if they wanted to use default_environment_path. Use accessor functions instead which can be ifdeffed on a single place. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/environment.c14
-rw-r--r--common/startup.c1
2 files changed, 14 insertions, 1 deletions
diff --git a/common/environment.c b/common/environment.c
index 24487775d7..3f6f4b3a36 100644
--- a/common/environment.c
+++ b/common/environment.c
@@ -48,7 +48,19 @@ struct action_data {
};
#define PAD4(x) ((x + 3) & ~3)
-char *default_environment_path = "/dev/env0";
+#ifdef __BAREBOX__
+static char *default_environment_path = "/dev/env0";
+
+void default_environment_path_set(char *path)
+{
+ default_environment_path = path;
+}
+
+char *default_environment_path_get(void)
+{
+ return default_environment_path;
+}
+#endif
static int file_size_action(const char *filename, struct stat *statbuf,
void *userdata, int depth)
diff --git a/common/startup.c b/common/startup.c
index 74c7735e31..e8b9ea0216 100644
--- a/common/startup.c
+++ b/common/startup.c
@@ -121,6 +121,7 @@ void __noreturn start_barebox(void)
if (IS_ENABLED(CONFIG_ENV_HANDLING)) {
int ret;
+ char *default_environment_path = default_environment_path_get();
ret = envfs_load(default_environment_path, "/env", 0);