mirror of
https://xff.cz/git/u-boot/
synced 2025-09-27 05:21:16 +02:00
common: Move env_get_ip() to net.h
This function relates to networking, so move it out of the common.h header file. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Tom Rini <trini@konsulko.com> Acked-by: Joe Hershberger <joe.hershberger@ni.com>
This commit is contained in:
@@ -319,10 +319,6 @@ int serial_printf (const char *fmt, ...)
|
|||||||
|
|
||||||
/* lib/net_utils.c */
|
/* lib/net_utils.c */
|
||||||
#include <net.h>
|
#include <net.h>
|
||||||
static inline struct in_addr env_get_ip(char *var)
|
|
||||||
{
|
|
||||||
return string_to_ip(env_get(var));
|
|
||||||
}
|
|
||||||
|
|
||||||
#include <bootstage.h>
|
#include <bootstage.h>
|
||||||
|
|
||||||
|
@@ -829,7 +829,13 @@ static inline void net_random_ethaddr(uchar *addr)
|
|||||||
/* Convert an IP address to a string */
|
/* Convert an IP address to a string */
|
||||||
void ip_to_string(struct in_addr x, char *s);
|
void ip_to_string(struct in_addr x, char *s);
|
||||||
|
|
||||||
/* Convert a string to ip address */
|
/**
|
||||||
|
* string_to_ip() - Convert a string to ip address
|
||||||
|
*
|
||||||
|
* @s: String to conver, in the format format a.b.c.d, where each value is a
|
||||||
|
* decimal number from 0 to 255
|
||||||
|
* @return IP address, or 0 if invalid
|
||||||
|
*/
|
||||||
struct in_addr string_to_ip(const char *s);
|
struct in_addr string_to_ip(const char *s);
|
||||||
|
|
||||||
/* Convert a VLAN id to a string */
|
/* Convert a VLAN id to a string */
|
||||||
@@ -887,4 +893,17 @@ int update_tftp(ulong addr, char *interface, char *devstring);
|
|||||||
*/
|
*/
|
||||||
void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr);
|
void eth_parse_enetaddr(const char *addr, uint8_t *enetaddr);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* env_get_ip() - Convert an environment value to to an ip address
|
||||||
|
*
|
||||||
|
* @var: Environment variable to convert. The value of this variable must be
|
||||||
|
* in the format format a.b.c.d, where each value is a decimal number from
|
||||||
|
* 0 to 255
|
||||||
|
* @return IP address, or 0 if invalid
|
||||||
|
*/
|
||||||
|
static inline struct in_addr env_get_ip(char *var)
|
||||||
|
{
|
||||||
|
return string_to_ip(env_get(var));
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* __NET_H__ */
|
#endif /* __NET_H__ */
|
||||||
|
Reference in New Issue
Block a user