From 3f989e7b0e43402d0a50e19939e4f57374319734 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 1 Aug 2019 09:46:44 -0600 Subject: env: Move env_relocate() to env.h Move env_relocate() over to the new header file. Signed-off-by: Simon Glass Acked-by: Joe Hershberger --- env/common.c | 1 + 1 file changed, 1 insertion(+) (limited to 'env/common.c') diff --git a/env/common.c b/env/common.c index bd340fe9d52..1fbc4a874d8 100644 --- a/env/common.c +++ b/env/common.c @@ -9,6 +9,7 @@ #include #include +#include #include #include #include -- cgit v1.2.3 From 0b9d8a0556e577190876ae756cf1de97104c9b41 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 1 Aug 2019 09:46:56 -0600 Subject: env: Move set_default_vars to env.h Move this function to the new header file and rename it so it has an env_ prefix. Acked-by: Joe Hershberger Signed-off-by: Simon Glass --- env/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'env/common.c') diff --git a/env/common.c b/env/common.c index 1fbc4a874d8..db2a033f686 100644 --- a/env/common.c +++ b/env/common.c @@ -92,7 +92,7 @@ void set_default_env(const char *s, int flags) /* [re]set individual variables to their value in the default environment */ -int set_default_vars(int nvars, char * const vars[], int flags) +int env_set_default_vars(int nvars, char * const vars[], int flags) { /* * Special use-case: import from default environment -- cgit v1.2.3 From 0ac7d722ede8e64973f68dbcd07b9521ba04cb63 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 1 Aug 2019 09:47:00 -0600 Subject: env: Move get/set_default_env() to env.h Move these functions to the new header file and rename set_default_env() to env_set_default() so that it has a consistent env_ prefix. Acked-by: Joe Hershberger Signed-off-by: Simon Glass --- env/common.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'env/common.c') diff --git a/env/common.c b/env/common.c index db2a033f686..1d9d0f934d1 100644 --- a/env/common.c +++ b/env/common.c @@ -62,7 +62,7 @@ char *env_get_default(const char *name) return ret_val; } -void set_default_env(const char *s, int flags) +void env_set_default(const char *s, int flags) { if (sizeof(default_environment) > ENV_SIZE) { puts("*** Error - default environment is too large\n\n"); @@ -118,7 +118,7 @@ int env_import(const char *buf, int check) memcpy(&crc, &ep->crc, sizeof(crc)); if (crc32(0, ep->data, ENV_SIZE) != crc) { - set_default_env("bad CRC", 0); + env_set_default("bad CRC", 0); return -ENOMSG; /* needed for env_load() */ } } @@ -131,7 +131,7 @@ int env_import(const char *buf, int check) pr_err("Cannot import environment: errno = %d\n", errno); - set_default_env("import failed", 0); + env_set_default("import failed", 0); return -EIO; } @@ -156,7 +156,7 @@ int env_import_redund(const char *buf1, int buf1_read_fail, } if (buf1_read_fail && buf2_read_fail) { - set_default_env("bad env area", 0); + env_set_default("bad env area", 0); return -EIO; } else if (!buf1_read_fail && buf2_read_fail) { gd->env_valid = ENV_VALID; @@ -172,7 +172,7 @@ int env_import_redund(const char *buf1, int buf1_read_fail, tmp_env2->crc; if (!crc1_ok && !crc2_ok) { - set_default_env("bad CRC", 0); + env_set_default("bad CRC", 0); return -ENOMSG; /* needed for env_load() */ } else if (crc1_ok && !crc2_ok) { gd->env_valid = ENV_VALID; @@ -236,10 +236,10 @@ void env_relocate(void) if (gd->env_valid == ENV_INVALID) { #if defined(CONFIG_ENV_IS_NOWHERE) || defined(CONFIG_SPL_BUILD) /* Environment not changable */ - set_default_env(NULL, 0); + env_set_default(NULL, 0); #else bootstage_error(BOOTSTAGE_ID_NET_CHECKSUM); - set_default_env("bad CRC", 0); + env_set_default("bad CRC", 0); #endif } else { env_load(); -- cgit v1.2.3 From dd2408cac1ea0f5e9ab4b07539c6edaee57918cb Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 2 Aug 2019 09:44:18 -0600 Subject: env: Drop the ENTRY typedef U-Boot is not supposed to use typedef for structs anymore. Also this name is the same as the ENTRY() macro used in assembler files, and 'entry' itself is widely used in U-Boot (>8k matches). Drop the typedef and rename the struct to env_entry to reduce confusion. Signed-off-by: Simon Glass Acked-by: Joe Hershberger --- env/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'env/common.c') diff --git a/env/common.c b/env/common.c index 1d9d0f934d1..474ea2280b9 100644 --- a/env/common.c +++ b/env/common.c @@ -250,7 +250,7 @@ void env_relocate(void) int env_complete(char *var, int maxv, char *cmdv[], int bufsz, char *buf, bool dollar_comp) { - ENTRY *match; + struct env_entry *match; int found, idx; if (dollar_comp) { -- cgit v1.2.3 From f3998fdc4d0871727d7be6838bac750c6323c0a8 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 2 Aug 2019 09:44:25 -0600 Subject: env: Rename environment.h to env_internal.h This file contains lots of internal details about the environment. Most code can include env.h instead, calling the functions there as needed. Rename this file and add a comment at the top to indicate its internal nature. Signed-off-by: Simon Glass Acked-by: Joe Hershberger Reviewed-by: Simon Goldschmidt [trini: Fixup apalis-tk1.c] Signed-off-by: Tom Rini --- env/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'env/common.c') diff --git a/env/common.c b/env/common.c index 474ea2280b9..3fb60509dd8 100644 --- a/env/common.c +++ b/env/common.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include -- cgit v1.2.3