Merge branch '2020-05-18-reduce-size-of-common.h'
[oweals/u-boot.git] / include / env.h
index 271cb3e88838cdafcbbde03c2ec73d776f766014..d6c2d751d62b6cc7eb3bbf9a108b36be14a8a486 100644 (file)
@@ -9,6 +9,7 @@
 #ifndef __ENV_H
 #define __ENV_H
 
+#include <compiler.h>
 #include <stdbool.h>
 #include <linux/types.h>
 
@@ -55,6 +56,12 @@ struct env_clbk_tbl {
        {#name, callback}
 #endif
 
+/** enum env_redund_flags - Flags for the redundand_environment */
+enum env_redund_flags {
+       ENV_REDUND_OBSOLETE = 0,
+       ENV_REDUND_ACTIVE = 1,
+};
+
 /**
  * env_get_id() - Gets a sequence number for the environment
  *
@@ -106,6 +113,16 @@ int env_match(unsigned char *name, int index);
  */
 char *env_get(const char *varname);
 
+/*
+ * Like env_get, but prints an error if envvar isn't defined in the
+ * environment.  It always returns what env_get does, so it can be used in
+ * place of env_get without changing error handling otherwise.
+ *
+ * @varname:   Variable to look up
+ * @return value of variable, or NULL if not found
+ */
+char *from_env(const char *envvar);
+
 /**
  * env_get_f() - Look up the value of an environment variable (early)
  *