From 890feecaab72a630eac3344443e053173f4ad02f Mon Sep 17 00:00:00 2001 From: Marek Vasut Date: Tue, 7 Jul 2020 20:51:35 +0200 Subject: env: Discern environment coming from external storage Add another custom environment flag which discerns environment coming from external storage from environment set by U-Boot itself. Signed-off-by: Marek Vasut Reviewed-by: Tom Rini --- include/env.h | 7 +++++-- include/search.h | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/env.h b/include/env.h index 665857f032..af405955b0 100644 --- a/include/env.h +++ b/include/env.h @@ -302,10 +302,11 @@ int env_select(const char *name); * @buf: Buffer containing the environment (struct environemnt_s *) * @check: non-zero to check the CRC at the start of the environment, 0 to * ignore it + * @flags: Flags controlling matching (H_... - see search.h) * @return 0 if imported successfully, -ENOMSG if the CRC was bad, -EIO if * something else went wrong */ -int env_import(const char *buf, int check); +int env_import(const char *buf, int check, int flags); /** * env_export() - Export the environment to a buffer @@ -324,10 +325,12 @@ int env_export(struct environment_s *env_out); * @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 + * @flags: Flags controlling matching (H_... - see search.h) * @return 0 if OK, -EIO if no environment is valid, -ENOMSG if the CRC was bad */ int env_import_redund(const char *buf1, int buf1_read_fail, - const char *buf2, int buf2_read_fail); + const char *buf2, int buf2_read_fail, + int flags); /** * env_get_default() - Look up a variable from the default environment diff --git a/include/search.h b/include/search.h index c4b50c9630..e56843c26f 100644 --- a/include/search.h +++ b/include/search.h @@ -113,5 +113,6 @@ int hwalk_r(struct hsearch_data *htab, #define H_PROGRAMMATIC (1 << 9) /* indicate that an import is from env_set() */ #define H_ORIGIN_FLAGS (H_INTERACTIVE | H_PROGRAMMATIC) #define H_DEFAULT (1 << 10) /* indicate that an import is default env */ +#define H_EXTERNAL (1 << 11) /* indicate that an import is external env */ #endif /* _SEARCH_H_ */ -- cgit v1.2.3