From 382bee57f19b4454e2015bc19a010bc2d0ab9337 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 3 Aug 2017 12:22:09 -0600 Subject: env: Rename setenv() to env_set() We are now using an env_ prefix for environment functions. Rename setenv() for consistency. Also add function comments in common.h. Suggested-by: Wolfgang Denk Signed-off-by: Simon Glass --- include/_exports.h | 2 +- include/common.h | 14 +++++++++++++- include/configs/tam3517-common.h | 2 +- include/dataflash.h | 2 +- include/exports.h | 2 +- include/search.h | 2 +- 6 files changed, 18 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/_exports.h b/include/_exports.h index 6ff4364..9deed77 100644 --- a/include/_exports.h +++ b/include/_exports.h @@ -32,7 +32,7 @@ EXPORT_FUNC(do_reset, int, do_reset, cmd_tbl_t *, int , int , char * const []) EXPORT_FUNC(getenv, char *, getenv, const char*) - EXPORT_FUNC(setenv, int, setenv, const char *, const char *) + EXPORT_FUNC(env_set, int, env_set, const char *, const char *) EXPORT_FUNC(simple_strtoul, unsigned long, simple_strtoul, const char *, char **, unsigned int) EXPORT_FUNC(strict_strtoul, int, strict_strtoul, diff --git a/include/common.h b/include/common.h index 030c179..0b543f3 100644 --- a/include/common.h +++ b/include/common.h @@ -336,7 +336,19 @@ ulong getenv_hex(const char *varname, ulong default_val); * Return -1 if variable does not exist (default to true) */ int getenv_yesno(const char *var); -int setenv (const char *, const char *); + +/** + * env_set() - set an environment variable + * + * This sets or deletes the value of an environment variable. For setting the + * value the variable is created if it does not already exist. + * + * @varname: Variable to adjust + * @value: Value to set for the variable, or NULL or "" to delete the variable + * @return 0 if OK, 1 on error + */ +int env_set(const char *varname, const char *value); + int setenv_ulong(const char *varname, ulong value); int setenv_hex(const char *varname, ulong value); /** diff --git a/include/configs/tam3517-common.h b/include/configs/tam3517-common.h index 54223c4..4336251 100644 --- a/include/configs/tam3517-common.h +++ b/include/configs/tam3517-common.h @@ -334,7 +334,7 @@ do { \ else \ strcpy(ethname, "ethaddr"); \ printf("Setting %s from EEPROM with %s\n", ethname, buf);\ - setenv(ethname, buf); \ + env_set(ethname, buf); \ } \ } while (0) diff --git a/include/dataflash.h b/include/dataflash.h index 84a56c3..c9f2220 100644 --- a/include/dataflash.h +++ b/include/dataflash.h @@ -197,7 +197,7 @@ extern int AT91F_DataflashInit(void); extern void dataflash_print_info (void); extern void dataflash_perror (int err); -extern void AT91F_DataflashSetEnv (void); +extern void AT91F_Dataflashenv_set(void); extern struct dataflash_addr cs[CONFIG_SYS_MAX_DATAFLASH_BANKS]; extern dataflash_protect_t area_list[NB_DATAFLASH_AREA]; diff --git a/include/exports.h b/include/exports.h index 1d81bc4..6522d78 100644 --- a/include/exports.h +++ b/include/exports.h @@ -28,7 +28,7 @@ int vprintf(const char *, va_list); unsigned long simple_strtoul(const char *cp, char **endp, unsigned int base); int strict_strtoul(const char *cp, unsigned int base, unsigned long *res); char *getenv (const char *name); -int setenv (const char *varname, const char *varvalue); +int env_set(const char *varname, const char *value); long simple_strtol(const char *cp, char **endp, unsigned int base); int strcmp(const char *cs, const char *ct); unsigned long ustrtoul(const char *cp, char **endp, unsigned int base); diff --git a/include/search.h b/include/search.h index 402dfd8..df5d61c 100644 --- a/include/search.h +++ b/include/search.h @@ -118,7 +118,7 @@ extern int hwalk_r(struct hsearch_data *__htab, int (*callback)(ENTRY *)); #define H_MATCH_SUBSTR (1 << 7) /* search for substring matches */ #define H_MATCH_REGEX (1 << 8) /* search for regular expression matches */ #define H_MATCH_METHOD (H_MATCH_IDENT | H_MATCH_SUBSTR | H_MATCH_REGEX) -#define H_PROGRAMMATIC (1 << 9) /* indicate that an import is from setenv() */ +#define H_PROGRAMMATIC (1 << 9) /* indicate that an import is from env_set() */ #define H_ORIGIN_FLAGS (H_INTERACTIVE | H_PROGRAMMATIC) #endif /* _SEARCH_H_ */ -- cgit v1.1