summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorHeiko Schocher <hs@denx.de>2020-10-10 10:28:04 +0200
committerTom Rini <trini@konsulko.com>2020-10-30 10:54:38 -0400
commit1229533a2a9cd85fb18a95841e986fca79dece86 (patch)
tree4f3d71bf23252a4d327c5f029beb5680e40eba7f /include
parent8d7f3fcb4a20bade1a940cea3e3b6983587d0fc9 (diff)
downloadu-boot-1229533a2a9cd85fb18a95841e986fca79dece86.tar.gz
u-boot-1229533a2a9cd85fb18a95841e986fca79dece86.tar.bz2
u-boot-1229533a2a9cd85fb18a95841e986fca79dece86.zip
env: split env_import_redund() into 2 functions
split from env_import_redund() the part which checks which Environment is valid into a separate function called env_check_redund() and call it from env_import_redund(). So env_check_redund() can be used from places which also need to do this checks. Signed-off-by: Heiko Schocher <hs@denx.de> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/env.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/include/env.h b/include/env.h
index af405955b0..c15339a93f 100644
--- a/include/env.h
+++ b/include/env.h
@@ -319,6 +319,24 @@ int env_import(const char *buf, int check, int flags);
int env_export(struct environment_s *env_out);
/**
+ * env_check_redund() - check the two redundant environments
+ * and find out, which is the valid one.
+ *
+ * @buf1: First environment (struct environemnt_s *)
+ * @buf1_read_fail: 0 if buf1 is valid, non-zero if invalid
+ * @buf2: Second environment (struct environemnt_s *)
+ * @buf2_read_fail: 0 if buf2 is valid, non-zero if invalid
+ * @return 0 if OK,
+ * -EIO if no environment is valid,
+ * -EINVAL if read of second entry is good
+ * -ENOENT if read of first entry is good
+ * -ENOMSG if the CRC was bad
+ */
+
+int env_check_redund(const char *buf1, int buf1_read_fail,
+ const char *buf2, int buf2_read_fail);
+
+/**
* env_import_redund() - Select and import one of two redundant environments
*
* @buf1: First environment (struct environemnt_s *)