env: Move env_valid to env.h
[oweals/u-boot.git] / include / env.h
index 0b03f8aa427298aa33e69841b0935aa8e5dfb7bb..b59c3c36f20238ccd61f38cb1a3772c45e925b24 100644 (file)
@@ -1,6 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0+ */
 /*
- * Common environment functions
+ * Common environment functions and definitions
  *
  * (C) Copyright 2000-2009
  * Wolfgang Denk, DENX Software Engineering, wd@denx.de.
 
 struct environment_s;
 
+/* 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 */
+};
+
 /**
  * env_get_id() - Gets a sequence number for the environment
  *
@@ -257,4 +264,32 @@ int env_export(struct environment_s *env_out);
 int env_import_redund(const char *buf1, int buf1_read_fail,
                      const char *buf2, int buf2_read_fail);
 
+/**
+ * env_get_default() - Look up a variable from the default environment
+ *
+ * @name: Variable to look up
+ * @return value if found, NULL if not found in default environment
+ */
+char *env_get_default(const char *name);
+
+/* [re]set to the default environment */
+void env_set_default(const char *s, int flags);
+
+/**
+ * env_get_char() - Get a character from the early environment
+ *
+ * This reads from the pre-relocation environment
+ *
+ * @index: Index of character to read (0 = first)
+ * @return character read, or -ve on error
+ */
+int env_get_char(int index);
+
+/**
+ * env_reloc() - Relocate the 'env' sub-commands
+ *
+ * This is used for those unfortunate archs with crappy toolchains
+ */
+void env_reloc(void);
+
 #endif