aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2017-08-03 12:22:03 -0600
committerTom Rini <trini@konsulko.com>2017-08-15 20:50:28 -0400
commitac358beb85362fb2fac47aaec40a7e1bca49656c (patch)
tree1d2b77ef10563b86d63255e6a1b3870e48e78199 /include
parent7938822a6b75b69fff9793b6b1769dddf1249525 (diff)
downloadu-boot-ac358beb85362fb2fac47aaec40a7e1bca49656c.zip
u-boot-ac358beb85362fb2fac47aaec40a7e1bca49656c.tar.gz
u-boot-ac358beb85362fb2fac47aaec40a7e1bca49656c.tar.bz2
env: Drop the env_name_spec global
Add a name to the driver and use that instead of the global variable declared by each driver. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'include')
-rw-r--r--include/environment.h19
1 files changed, 15 insertions, 4 deletions
diff --git a/include/environment.h b/include/environment.h
index 7eaba72..584fd72 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -143,10 +143,6 @@ extern unsigned long nand_env_oob_offset;
# define ENV_HEADER_SIZE (sizeof(uint32_t))
#endif
-#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
-extern char *env_name_spec;
-#endif
-
#ifdef CONFIG_ENV_AES
/* Make sure the payload is multiple of AES block size */
#define ENV_SIZE ((CONFIG_ENV_SIZE - ENV_HEADER_SIZE) & ~(16 - 1))
@@ -224,6 +220,7 @@ enum env_location {
};
struct env_driver {
+ const char *name;
enum env_location location;
/**
@@ -269,6 +266,13 @@ struct env_driver {
#define U_BOOT_ENV_LOCATION(__name) \
ll_entry_declare(struct env_driver, __name, env_driver)
+/* Declare the name of a location */
+#ifdef CONFIG_CMD_SAVEENV
+#define ENV_NAME(_name) .name = _name,
+#else
+#define ENV_NAME(_name)
+#endif
+
#ifdef CONFIG_CMD_SAVEENV
#define env_save_ptr(x) x
#else
@@ -303,6 +307,13 @@ int env_export(env_t *env_out);
int env_import_redund(const char *buf1, const char *buf2);
#endif
+/**
+ * env_driver_lookup_default() - Look up the default environment driver
+ *
+ * @return pointer to driver, or NULL if none (which should not happen)
+ */
+struct env_driver *env_driver_lookup_default(void);
+
#endif /* DO_DEPS_ONLY */
#endif /* _ENVIRONMENT_H_ */