[10/11] env: introducing env_info struct for storing info per env

Message ID e6773b4879bd426bab9486a25a8427e4d85e7958.1513975247.git-series.quentin.schulz@free-electrons.com
State New
Headers show
Series
  • Introduce variables whitelisting in environment
Related show

Commit Message

Quentin Schulz Dec. 22, 2017, 9:13 p.m.
To introduce the ability to use multiple environments at the same time,
it is required to store a few information about each of the environment.

Each environment has a different env_addr, "validity" (redund or main)
and status of init (failed or succeeded).

This structure is meant to be used in include/asm-generic/global_data.h
and thus needs to be put out of the #ifndef DO_DEPS_ONLY.

Signed-off-by: Quentin Schulz <quentin.schulz@free-electrons.com>
---
 include/environment.h | 34 ++++++++++++++++++++--------------
 1 file changed, 20 insertions(+), 14 deletions(-)

Patch

diff --git a/include/environment.h b/include/environment.h
index dd6450c..14df43f 100644
--- a/include/environment.h
+++ b/include/environment.h
@@ -183,20 +183,6 @@  extern uint mmc_get_env_part(struct mmc *mmc);
 # endif
 #endif
 
-#ifndef DO_DEPS_ONLY
-
-#include <env_attr.h>
-#include <env_callback.h>
-#include <env_flags.h>
-#include <search.h>
-
-/* Value for environment validity */
-enum env_valid {
-	ENV_INVALID,	/* No valid environment */
-	ENV_VALID,	/* First or only environment is valid */
-	ENV_REDUND,	/* Redundant environment is valid */
-};
-
 enum env_location {
 	ENVL_EEPROM,
 	ENVL_EXT4,
@@ -215,6 +201,26 @@  enum env_location {
 	ENVL_UNKNOWN,
 };
 
+/* Value for environment validity */
+enum env_valid {
+	ENV_INVALID,	/* No valid environment */
+	ENV_VALID,	/* First or only environment is valid */
+	ENV_REDUND,	/* Redundant environment is valid */
+};
+
+struct env_info {
+	unsigned long	env_addr;
+	enum env_valid	env_valid;
+	bool		has_init;
+};
+
+#ifndef DO_DEPS_ONLY
+
+#include <env_attr.h>
+#include <env_callback.h>
+#include <env_flags.h>
+#include <search.h>
+
 extern enum env_location env_locations[];
 
 enum env_operation {