env: Rename some other getenv()-related functions

We are now using an env_ prefix for environment functions. Rename these
other functions as well, for consistency:

   getenv_vlan()
   getenv_bootm_size()
   getenv_bootm_low()
   getenv_bootm_mapsize()
   env_get_default()

Suggested-by: Wolfgang Denk <wd@denx.de>
Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass 2017-08-03 12:22:15 -06:00 committed by Tom Rini
parent 35affd7a2f
commit 723806cc5b
41 changed files with 85 additions and 85 deletions

View file

@ -86,7 +86,7 @@ static void boot_jump_linux(bootm_headers_t *images)
debug (" Booting using OF flat tree...\n");
WATCHDOG_RESET ();
(*kernel) ((bd_t *)of_flat_tree, 0, 0, EPAPR_MAGIC,
getenv_bootm_mapsize(), 0, 0);
env_get_bootm_mapsize(), 0, 0);
/* does not return */
} else
#endif
@ -121,8 +121,8 @@ void arch_lmb_reserve(struct lmb *lmb)
phys_size_t bootm_size;
ulong size, sp, bootmap_base;
bootmap_base = getenv_bootm_low();
bootm_size = getenv_bootm_size();
bootmap_base = env_get_bootm_low();
bootm_size = env_get_bootm_size();
#ifdef DEBUG
if (((u64)bootmap_base + bootm_size) >
@ -340,6 +340,6 @@ void boot_jump_vxworks(bootm_headers_t *images)
((void (*)(void *, ulong, ulong, ulong,
ulong, ulong, ulong))images->ep)(images->ft_addr,
0, 0, EPAPR_MAGIC, getenv_bootm_mapsize(), 0, 0);
0, 0, EPAPR_MAGIC, env_get_bootm_mapsize(), 0, 0);
}
#endif

View file

@ -307,8 +307,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -1197,8 +1197,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -65,8 +65,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);
#ifdef CONFIG_FDT_FIXUP_PARTITIONS

View file

@ -370,8 +370,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
#if defined(CONFIG_PCI)
FT_FSL_PCI_SETUP;

View file

@ -138,8 +138,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
#if defined(CONFIG_PCI)
FT_FSL_PCI_SETUP;

View file

@ -191,8 +191,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -239,8 +239,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -453,8 +453,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
#if defined(CONFIG_PCI)
FT_FSL_PCI_SETUP;

View file

@ -339,8 +339,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -137,8 +137,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -439,8 +439,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -268,8 +268,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -219,8 +219,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -363,8 +363,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -186,8 +186,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -245,8 +245,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -132,8 +132,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -451,8 +451,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -118,8 +118,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -70,8 +70,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -684,8 +684,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -97,8 +97,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -335,8 +335,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -271,8 +271,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -87,8 +87,8 @@ int ft_board_setup(void *blob, bd_t *bd)
ft_cpu_setup(blob, bd);
base = getenv_bootm_low();
size = getenv_bootm_size();
base = env_get_bootm_low();
size = env_get_bootm_size();
fdt_fixup_memory(blob, (u64)base, (u64)size);

View file

@ -300,7 +300,7 @@ int do_bootvx(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
ptr += sprintf(build_buf + ptr, "e=%s", tmp);
tmp = env_get("netmask");
if (tmp) {
u32 mask = getenv_ip("netmask").s_addr;
u32 mask = env_get_ip("netmask").s_addr;
ptr += sprintf(build_buf + ptr,
":%08x ", ntohl(mask));
} else {

View file

@ -1533,7 +1533,7 @@ static int spread_partitions(void)
* @param buf temporary buffer pointer MTDPARTS_MAXLEN long
* @return mtdparts variable string, NULL if not found
*/
static const char *getenv_mtdparts(char *buf)
static const char *env_get_mtdparts(char *buf)
{
if (gd->flags & GD_FLG_ENV_READY)
return env_get("mtdparts");
@ -1565,7 +1565,7 @@ static int parse_mtdparts(const char *const mtdparts)
}
/* re-read 'mtdparts' variable, mtd_devices_init may be updating env */
p = getenv_mtdparts(tmp_parts);
p = env_get_mtdparts(tmp_parts);
if (!p)
p = mtdparts;
@ -1742,7 +1742,7 @@ int mtdparts_init(void)
/* get variables */
ids = env_get("mtdids");
parts = getenv_mtdparts(tmp_parts);
parts = env_get_mtdparts(tmp_parts);
current_partition = env_get("partition");
/* save it for later parsing, cannot rely on current partition pointer

View file

@ -331,7 +331,7 @@ int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
char *toff;
if (argc < 2) {
net_ntp_server = getenv_ip("ntpserverip");
net_ntp_server = env_get_ip("ntpserverip");
if (net_ntp_server.s_addr == 0) {
printf("ntpserverip not set\n");
return CMD_RET_FAILURE;

View file

@ -55,8 +55,8 @@ static void boot_start_lmb(bootm_headers_t *images)
lmb_init(&images->lmb);
mem_start = getenv_bootm_low();
mem_size = getenv_bootm_size();
mem_start = env_get_bootm_low();
mem_size = env_get_bootm_size();
lmb_add(&images->lmb, (phys_addr_t)mem_start, mem_size);

View file

@ -156,8 +156,8 @@ int boot_relocate_fdt(struct lmb *lmb, char **of_flat_tree, ulong *of_size)
} else {
of_start =
(void *)(ulong) lmb_alloc_base(lmb, of_len, 0x1000,
getenv_bootm_mapsize()
+ getenv_bootm_low());
env_get_bootm_mapsize()
+ env_get_bootm_low());
}
if (of_start == NULL) {

View file

@ -465,7 +465,7 @@ static int on_loadaddr(const char *name, const char *value, enum env_op op,
}
U_BOOT_ENV_CALLBACK(loadaddr, on_loadaddr);
ulong getenv_bootm_low(void)
ulong env_get_bootm_low(void)
{
char *s = env_get("bootm_low");
if (s) {
@ -482,7 +482,7 @@ ulong getenv_bootm_low(void)
#endif
}
phys_size_t getenv_bootm_size(void)
phys_size_t env_get_bootm_size(void)
{
phys_size_t tmp, size;
phys_addr_t start;
@ -509,7 +509,7 @@ phys_size_t getenv_bootm_size(void)
return size - (tmp - start);
}
phys_size_t getenv_bootm_mapsize(void)
phys_size_t env_get_bootm_mapsize(void)
{
phys_size_t tmp;
char *s = env_get("bootm_mapsize");
@ -521,7 +521,7 @@ phys_size_t getenv_bootm_mapsize(void)
#if defined(CONFIG_SYS_BOOTMAPSZ)
return CONFIG_SYS_BOOTMAPSZ;
#else
return getenv_bootm_size();
return env_get_bootm_size();
#endif
}
@ -1233,7 +1233,7 @@ int boot_ramdisk_high(struct lmb *lmb, ulong rd_data, ulong rd_len,
if (initrd_high == ~0)
initrd_copy_to_ram = 0;
} else {
initrd_high = getenv_bootm_mapsize() + getenv_bootm_low();
initrd_high = env_get_bootm_mapsize() + env_get_bootm_low();
}
@ -1506,7 +1506,7 @@ int boot_get_loadable(int argc, char * const argv[], bootm_headers_t *images,
* @cmd_end: pointer to a ulong variable, will hold cmdline end
*
* boot_get_cmdline() allocates space for kernel command line below
* BOOTMAPSZ + getenv_bootm_low() address. If "bootargs" U-Boot environemnt
* BOOTMAPSZ + env_get_bootm_low() address. If "bootargs" U-Boot environemnt
* variable is present its contents is copied to allocated kernel
* command line.
*
@ -1520,7 +1520,7 @@ int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
char *s;
cmdline = (char *)(ulong)lmb_alloc_base(lmb, CONFIG_SYS_BARGSIZE, 0xf,
getenv_bootm_mapsize() + getenv_bootm_low());
env_get_bootm_mapsize() + env_get_bootm_low());
if (cmdline == NULL)
return -1;
@ -1547,7 +1547,7 @@ int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
* @kbd: double pointer to board info data
*
* boot_get_kbd() allocates space for kernel copy of board info data below
* BOOTMAPSZ + getenv_bootm_low() address and kernel board info is initialized
* BOOTMAPSZ + env_get_bootm_low() address and kernel board info is initialized
* with the current u-boot board info data.
*
* returns:
@ -1557,7 +1557,7 @@ int boot_get_cmdline(struct lmb *lmb, ulong *cmd_start, ulong *cmd_end)
int boot_get_kbd(struct lmb *lmb, bd_t **kbd)
{
*kbd = (bd_t *)(ulong)lmb_alloc_base(lmb, sizeof(bd_t), 0xf,
getenv_bootm_mapsize() + getenv_bootm_low());
env_get_bootm_mapsize() + env_get_bootm_low());
if (*kbd == NULL)
return -1;

View file

@ -62,8 +62,8 @@ static int is_broadcast(struct in_addr ip)
/* update only when the environment has changed */
if (env_changed_id != env_id) {
netmask = getenv_ip("netmask");
our_ip = getenv_ip("ipaddr");
netmask = env_get_ip("netmask");
our_ip = env_get_ip("ipaddr");
env_changed_id = env_id;
}
@ -83,7 +83,7 @@ static int refresh_settings_from_env(void)
/* update only when the environment has changed */
if (env_changed_id != env_id) {
if (env_get("ncip")) {
nc_ip = getenv_ip("ncip");
nc_ip = env_get_ip("ncip");
if (!nc_ip.s_addr)
return -1; /* ncip is 0.0.0.0 */
p = strchr(env_get("ncip"), ':');

2
env/common.c vendored
View file

@ -44,7 +44,7 @@ int env_get_yesno(const char *var)
/*
* Look up the variable from the default environment
*/
char *getenv_default(const char *name)
char *env_get_default(const char *name)
{
char *ret_val;
unsigned long really_valid = gd->env_valid;

2
env/flags.c vendored
View file

@ -541,7 +541,7 @@ int env_flags_validate(const ENTRY *item, const char *newval, enum env_op op,
return 1;
} else if (item->flags &
ENV_FLAGS_VARACCESS_PREVENT_NONDEF_OVERWR) {
const char *defval = getenv_default(name);
const char *defval = env_get_default(name);
if (defval == NULL)
defval = "";

View file

@ -749,7 +749,7 @@ int zzip(void *dst, unsigned long *lenp, unsigned char *src,
/* lib/net_utils.c */
#include <net.h>
static inline struct in_addr getenv_ip(char *var)
static inline struct in_addr env_get_ip(char *var)
{
return string_to_ip(env_get(var));
}

View file

@ -282,7 +282,7 @@ extern struct hsearch_data env_htab;
void env_crc_update(void);
/* Look up the variable from the default environment */
char *getenv_default(const char *name);
char *env_get_default(const char *name);
/* [re]set to the default environment */
void set_default_env(const char *s);

View file

@ -769,9 +769,9 @@ static inline void image_set_name(image_header_t *hdr, const char *name)
int image_check_hcrc(const image_header_t *hdr);
int image_check_dcrc(const image_header_t *hdr);
#ifndef USE_HOSTCC
ulong getenv_bootm_low(void);
phys_size_t getenv_bootm_size(void);
phys_size_t getenv_bootm_mapsize(void);
ulong env_get_bootm_low(void);
phys_size_t env_get_bootm_size(void);
phys_size_t env_get_bootm_mapsize(void);
#endif
void memmove_wd(void *to, void *from, size_t len, ulong chunksz);

View file

@ -834,7 +834,7 @@ void vlan_to_string(ushort x, char *s);
ushort string_to_vlan(const char *s);
/* read a VLAN id from an environment variable */
ushort getenv_vlan(char *);
ushort env_get_vlan(char *);
/* copy a filename (allow for "..." notation, limit length) */
void copy_filename(char *dst, const char *src, int size);

View file

@ -104,7 +104,7 @@ static void configure_wait(void)
void link_local_start(void)
{
ip = getenv_ip("llipaddr");
ip = env_get_ip("llipaddr");
if (ip.s_addr != 0 &&
(ntohl(ip.s_addr) & IN_CLASSB_NET) != LINKLOCAL_ADDR) {
puts("invalid link address");

View file

@ -1536,7 +1536,7 @@ ushort string_to_vlan(const char *s)
return htons(id);
}
ushort getenv_vlan(char *var)
ushort env_get_vlan(char *var)
{
return string_to_vlan(env_get(var));
}