summaryrefslogtreecommitdiff
path: root/common
diff options
context:
space:
mode:
Diffstat (limited to 'common')
-rw-r--r--common/cmd_nvedit.c18
-rw-r--r--common/env_common.c6
-rw-r--r--common/env_dataflash.c2
-rw-r--r--common/env_eeprom.c2
-rw-r--r--common/env_flash.c4
-rw-r--r--common/env_mmc.c2
-rw-r--r--common/env_nand.c4
-rw-r--r--common/env_nvram.c2
-rw-r--r--common/env_onenand.c2
-rw-r--r--common/env_sf.c4
10 files changed, 24 insertions, 22 deletions
diff --git a/common/cmd_nvedit.c b/common/cmd_nvedit.c
index c3b57f2..f8c7976 100644
--- a/common/cmd_nvedit.c
+++ b/common/cmd_nvedit.c
@@ -111,7 +111,7 @@ static int env_print(char *name)
e.key = name;
e.data = NULL;
- ep = hsearch (e, FIND);
+ hsearch_r(e, FIND, &ep, &env_htab);
if (ep == NULL)
return 0;
len = printf ("%s=%s\n", ep->key, ep->data);
@@ -119,7 +119,7 @@ static int env_print(char *name)
}
/* print whole list */
- len = hexport('\n', &res, 0);
+ len = hexport_r(&env_htab, '\n', &res, 0);
if (len > 0) {
puts(res);
@@ -184,7 +184,7 @@ int _do_env_set (int flag, int argc, char * const argv[])
*/
e.key = name;
e.data = NULL;
- ep = hsearch (e, FIND);
+ hsearch_r(e, FIND, &ep, &env_htab);
/* Check for console redirection */
if (strcmp(name,"stdin") == 0) {
@@ -267,7 +267,7 @@ int _do_env_set (int flag, int argc, char * const argv[])
/* Delete only ? */
if ((argc < 3) || argv[2] == NULL) {
- int rc = hdelete(name);
+ int rc = hdelete_r(name, &env_htab);
return !rc;
}
@@ -293,7 +293,7 @@ int _do_env_set (int flag, int argc, char * const argv[])
e.key = name;
e.data = value;
- ep = hsearch(e, ENTER);
+ hsearch_r(e, ENTER, &ep, &env_htab);
free(value);
if (!ep) {
printf("## Error inserting \"%s\" variable, errno=%d\n",
@@ -456,7 +456,7 @@ char *getenv (char *name)
e.key = name;
e.data = NULL;
- ep = hsearch (e, FIND);
+ hsearch_r(e, FIND, &ep, &env_htab);
return (ep ? ep->data : NULL);
}
@@ -651,7 +651,7 @@ static int do_env_export(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
}
if (sep) { /* export as text file */
- len = hexport(sep, &addr, size);
+ len = hexport_r(&env_htab, sep, &addr, size);
if (len < 0) {
error("Cannot export environment: errno = %d\n",
errno);
@@ -670,7 +670,7 @@ static int do_env_export(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv
else /* export as raw binary data */
res = addr;
- len = hexport('\0', &res, ENV_SIZE);
+ len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
if (len < 0) {
error("Cannot export environment: errno = %d\n",
errno);
@@ -790,7 +790,7 @@ static int do_env_import(cmd_tbl_t * cmdtp, int flag, int argc, char * const arg
addr = (char *)ep->data;
}
- if (himport(addr, size, sep, del ? 0 : H_NOCLEAR) == 0) {
+ if (himport_r(&env_htab, addr, size, sep, del ? 0 : H_NOCLEAR) == 0) {
error("Environment import failed: errno = %d\n", errno);
return 1;
}
diff --git a/common/env_common.c b/common/env_common.c
index a276efc..ae710e5 100644
--- a/common/env_common.c
+++ b/common/env_common.c
@@ -129,6 +129,8 @@ uchar default_environment[] = {
"\0"
};
+struct hsearch_data env_htab;
+
static uchar env_get_char_init (int index)
{
uchar c;
@@ -187,7 +189,7 @@ void set_default_env(const char *s)
puts("Using default environment\n\n");
}
- if (himport((char *)default_environment,
+ if (himport_r(&env_htab, (char *)default_environment,
sizeof(default_environment), '\0', 0) == 0) {
error("Environment import failed: errno = %d\n", errno);
}
@@ -213,7 +215,7 @@ int env_import(const char *buf, int check)
}
}
- if (himport((char *)ep->data, ENV_SIZE, '\0', 0)) {
+ if (himport_r(&env_htab, (char *)ep->data, ENV_SIZE, '\0', 0)) {
gd->flags |= GD_FLG_ENV_READY;
return 1;
}
diff --git a/common/env_dataflash.c b/common/env_dataflash.c
index 270f2b3..1d57079 100644
--- a/common/env_dataflash.c
+++ b/common/env_dataflash.c
@@ -68,7 +68,7 @@ int saveenv(void)
char *res;
res = (char *)&env_new.data;
- len = hexport('\0', &res, ENV_SIZE);
+ len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
if (len < 0) {
error("Cannot export environment: errno = %d\n", errno);
return 1;
diff --git a/common/env_eeprom.c b/common/env_eeprom.c
index 792b44f..0a179ad 100644
--- a/common/env_eeprom.c
+++ b/common/env_eeprom.c
@@ -143,7 +143,7 @@ int saveenv(void)
BUG_ON(env_ptr != NULL);
res = (char *)&env_new.data;
- len = hexport('\0', &res, ENV_SIZE);
+ len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
if (len < 0) {
error("Cannot export environment: errno = %d\n", errno);
return 1;
diff --git a/common/env_flash.c b/common/env_flash.c
index 54c0bfe..456f2e8 100644
--- a/common/env_flash.c
+++ b/common/env_flash.c
@@ -155,7 +155,7 @@ int saveenv(void)
}
res = (char *)&env_new.data;
- len = hexport('\0', &res, ENV_SIZE);
+ len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
if (len < 0) {
error("Cannot export environment: errno = %d\n", errno);
goto done;
@@ -289,7 +289,7 @@ int saveenv(void)
goto done;
res = (char *)&env_new.data;
- len = hexport('\0', &res, ENV_SIZE);
+ len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
if (len < 0) {
error("Cannot export environment: errno = %d\n", errno);
goto done;
diff --git a/common/env_mmc.c b/common/env_mmc.c
index 7c9392c..71dcc4c 100644
--- a/common/env_mmc.c
+++ b/common/env_mmc.c
@@ -107,7 +107,7 @@ int saveenv(void)
return 1;
res = (char *)&env_new.data;
- len = hexport('\0', &res, ENV_SIZE);
+ len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
if (len < 0) {
error("Cannot export environment: errno = %d\n", errno);
return 1;
diff --git a/common/env_nand.c b/common/env_nand.c
index 7f6c917..2682f07 100644
--- a/common/env_nand.c
+++ b/common/env_nand.c
@@ -199,7 +199,7 @@ int saveenv(void)
return 1;
res = (char *)&env_new.data;
- len = hexport('\0', &res, ENV_SIZE);
+ len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
if (len < 0) {
error("Cannot export environment: errno = %d\n", errno);
return 1;
@@ -256,7 +256,7 @@ int saveenv(void)
return 1;
res = (char *)&env_new.data;
- len = hexport('\0', &res, ENV_SIZE);
+ len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
if (len < 0) {
error("Cannot export environment: errno = %d\n", errno);
return 1;
diff --git a/common/env_nvram.c b/common/env_nvram.c
index 6e90f2b..544ce47 100644
--- a/common/env_nvram.c
+++ b/common/env_nvram.c
@@ -94,7 +94,7 @@ int saveenv(void)
int rcode = 0;
res = (char *)&env_new.data;
- len = hexport('\0', &res, ENV_SIZE);
+ len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
if (len < 0) {
error("Cannot export environment: errno = %d\n", errno);
return 1;
diff --git a/common/env_onenand.c b/common/env_onenand.c
index 02cb535..5e04a06 100644
--- a/common/env_onenand.c
+++ b/common/env_onenand.c
@@ -109,7 +109,7 @@ int saveenv(void)
};
res = (char *)&env_new.data;
- len = hexport('\0', &res, ENV_SIZE);
+ len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
if (len < 0) {
error("Cannot export environment: errno = %d\n", errno);
return 1;
diff --git a/common/env_sf.c b/common/env_sf.c
index 47c6a70..41cc00a 100644
--- a/common/env_sf.c
+++ b/common/env_sf.c
@@ -92,7 +92,7 @@ int saveenv(void)
}
res = (char *)&env_new.data;
- len = hexport('\0', &res, ENV_SIZE);
+ len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
if (len < 0) {
error("Cannot export environment: errno = %d\n", errno);
return 1;
@@ -308,7 +308,7 @@ int saveenv(void)
}
res = (char *)&env_new.data;
- len = hexport('\0', &res, ENV_SIZE);
+ len = hexport_r(&env_htab, '\0', &res, ENV_SIZE);
if (len < 0) {
error("Cannot export environment: errno = %d\n", errno);
goto done;