X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fenv_flags.h;h=313cb8c49a6d203b7b32da71fea65fc2486399fc;hb=f9a48654ee70fbad29f487d074fd36a1548b4209;hp=d1aa1440f704dd2a58aef381c8427d02d746edad;hpb=612404c28a64a6df300642a1550a65dcc8e01f82;p=platform%2Fkernel%2Fu-boot.git diff --git a/include/env_flags.h b/include/env_flags.h index d1aa1440..313cb8c 100644 --- a/include/env_flags.h +++ b/include/env_flags.h @@ -1,24 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ /* * (C) Copyright 2012 * Joe Hershberger, National Instruments, joe.hershberger@ni.com - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA */ #ifndef __ENV_FLAGS_H__ @@ -41,6 +24,9 @@ enum env_flags_varaccess { env_flags_varaccess_readonly, env_flags_varaccess_writeonce, env_flags_varaccess_changedefault, +#ifdef CONFIG_ENV_WRITEABLE_LIST + env_flags_varaccess_writeable, +#endif env_flags_varaccess_end }; @@ -53,18 +39,32 @@ enum env_flags_varaccess { #define CONFIG_ENV_FLAGS_LIST_STATIC "" #endif -#ifdef CONFIG_CMD_NET +#ifdef CONFIG_NET +#ifdef CONFIG_REGEX +#define ETHADDR_WILDCARD "\\d*" +#else +#define ETHADDR_WILDCARD +#endif #ifdef CONFIG_ENV_OVERWRITE -#define ETHADDR_FLAGS "ethaddr:ma," +#define ETHADDR_FLAGS "eth" ETHADDR_WILDCARD "addr:ma," #else #ifdef CONFIG_OVERWRITE_ETHADDR_ONCE -#define ETHADDR_FLAGS "ethaddr:mc," +#define ETHADDR_FLAGS "eth" ETHADDR_WILDCARD "addr:mc," #else -#define ETHADDR_FLAGS "ethaddr:mo," +#define ETHADDR_FLAGS "eth" ETHADDR_WILDCARD "addr:mo," #endif #endif +#define NET_FLAGS \ + "ipaddr:i," \ + "gatewayip:i," \ + "netmask:i," \ + "serverip:i," \ + "nvlan:d," \ + "vlan:d," \ + "dnsip:i," #else -#define ETHADDR_FLAGS "" +#define ETHADDR_FLAGS +#define NET_FLAGS #endif #ifndef CONFIG_ENV_OVERWRITE @@ -75,6 +75,7 @@ enum env_flags_varaccess { #define ENV_FLAGS_LIST_STATIC \ ETHADDR_FLAGS \ + NET_FLAGS \ SERIAL_FLAGS \ CONFIG_ENV_FLAGS_LIST_STATIC @@ -110,6 +111,13 @@ enum env_flags_varaccess env_flags_parse_varaccess(const char *flags); */ enum env_flags_varaccess env_flags_parse_varaccess_from_binflags(int binflags); +#ifdef CONFIG_CMD_NET +/* + * Check if a string has the format of an Ethernet MAC address + */ +int eth_validate_ethaddr_str(const char *addr); +#endif + #ifdef USE_HOSTCC /* * Look up the type of a variable directly from the .flags var. @@ -137,23 +145,24 @@ int env_flags_validate_varaccess(const char *name, int check_mask); /* * Validate the parameters passed to "env set" for type compliance */ -int env_flags_validate_env_set_params(int argc, char * const argv[]); +int env_flags_validate_env_set_params(char *name, char *const val[], int count); #else /* !USE_HOSTCC */ +#include #include /* * When adding a variable to the environment, initialize the flags for that * variable. */ -void env_flags_init(ENTRY *var_entry); +void env_flags_init(struct env_entry *var_entry); /* * Validate the newval for to conform with the requirements defined by its flags */ -int env_flags_validate(const ENTRY *item, const char *newval, enum env_op op, - int flag); +int env_flags_validate(const struct env_entry *item, const char *newval, + enum env_op op, int flag); #endif /* USE_HOSTCC */ @@ -167,6 +176,7 @@ int env_flags_validate(const ENTRY *item, const char *newval, enum env_op op, #define ENV_FLAGS_VARACCESS_PREVENT_CREATE 0x00000010 #define ENV_FLAGS_VARACCESS_PREVENT_OVERWR 0x00000020 #define ENV_FLAGS_VARACCESS_PREVENT_NONDEF_OVERWR 0x00000040 -#define ENV_FLAGS_VARACCESS_BIN_MASK 0x00000078 +#define ENV_FLAGS_VARACCESS_WRITEABLE 0x00000080 +#define ENV_FLAGS_VARACCESS_BIN_MASK 0x000000f8 #endif /* __ENV_FLAGS_H__ */