[U-Boot] [PATCH v2 01/25] net: cosmetic: Change IPaddr_t to struct in_addr

2015-04-08 Thread Joe Hershberger
This patch is simply clean-up to make the IPv4 type that is used match
what Linux uses. It also attempts to move all variables that are IP
addresses use good naming instead of CamelCase. No functional change.

Signed-off-by: Joe Hershberger joe.hershber...@ni.com
---

Changes in v2:
-Fixed build failures in ip conversion patch

 common/cmd_net.c  |  50 +--
 common/cmd_pxe.c  |   2 +-
 drivers/net/netconsole.c  |  37 +++---
 drivers/net/sandbox-raw.c |   8 +--
 drivers/net/sandbox.c |  14 +++---
 include/common.h  |   2 +-
 include/net.h |  63 ---
 lib/net_utils.c   |  16 +++---
 net/arp.c |  56 ++---
 net/arp.h |   6 +--
 net/bootp.c   | 125 +-
 net/bootp.h   |   8 +--
 net/dns.c |  18 +++
 net/eth.c |   8 +--
 net/link_local.c  |  27 ++
 net/net.c | 100 +++--
 net/nfs.c |  40 ---
 net/ping.c|  22 
 net/rarp.c|   8 +--
 net/sntp.c|  11 ++--
 net/tftp.c|  69 +
 test/dm/eth.c |  10 ++--
 22 files changed, 363 insertions(+), 337 deletions(-)

diff --git a/common/cmd_net.c b/common/cmd_net.c
index 3f52edc..53760a2 100644
--- a/common/cmd_net.c
+++ b/common/cmd_net.c
@@ -114,13 +114,13 @@ static void netboot_update_env(void)
 {
char tmp[22];
 
-   if (NetOurGatewayIP) {
-   ip_to_string(NetOurGatewayIP, tmp);
+   if (net_gateway.s_addr) {
+   ip_to_string(net_gateway, tmp);
setenv(gatewayip, tmp);
}
 
-   if (NetOurSubnetMask) {
-   ip_to_string(NetOurSubnetMask, tmp);
+   if (net_netmask.s_addr) {
+   ip_to_string(net_netmask, tmp);
setenv(netmask, tmp);
}
 
@@ -130,8 +130,8 @@ static void netboot_update_env(void)
if (NetOurRootPath[0])
setenv(rootpath, NetOurRootPath);
 
-   if (NetOurIP) {
-   ip_to_string(NetOurIP, tmp);
+   if (net_ip.s_addr) {
+   ip_to_string(net_ip, tmp);
setenv(ipaddr, tmp);
}
 #if !defined(CONFIG_BOOTP_SERVERIP)
@@ -139,18 +139,18 @@ static void netboot_update_env(void)
 * Only attempt to change serverip if net/bootp.c:BootpCopyNetParams()
 * could have set it
 */
-   if (NetServerIP) {
-   ip_to_string(NetServerIP, tmp);
+   if (net_server_ip.s_addr) {
+   ip_to_string(net_server_ip, tmp);
setenv(serverip, tmp);
}
 #endif
-   if (NetOurDNSIP) {
-   ip_to_string(NetOurDNSIP, tmp);
+   if (net_dns_server.s_addr) {
+   ip_to_string(net_dns_server, tmp);
setenv(dnsip, tmp);
}
 #if defined(CONFIG_BOOTP_DNS2)
-   if (NetOurDNS2IP) {
-   ip_to_string(NetOurDNS2IP, tmp);
+   if (net_dns_server2.s_addr) {
+   ip_to_string(net_dns_server2, tmp);
setenv(dnsip2, tmp);
}
 #endif
@@ -166,8 +166,8 @@ static void netboot_update_env(void)
 #endif
 #if defined(CONFIG_CMD_SNTP) \
  defined(CONFIG_BOOTP_NTPSERVER)
-   if (NetNtpServerIP) {
-   ip_to_string(NetNtpServerIP, tmp);
+   if (net_ntp_server.s_addr) {
+   ip_to_string(net_ntp_server, tmp);
setenv(ntpserverip, tmp);
}
 #endif
@@ -260,8 +260,8 @@ static int do_ping(cmd_tbl_t *cmdtp, int flag, int argc, 
char * const argv[])
if (argc  2)
return CMD_RET_USAGE;
 
-   NetPingIP = string_to_ip(argv[1]);
-   if (NetPingIP == 0)
+   net_ping_ip = string_to_ip(argv[1]);
+   if (net_ping_ip.s_addr == 0)
return CMD_RET_USAGE;
 
if (NetLoop(PING)  0) {
@@ -331,14 +331,14 @@ int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
char *toff;
 
if (argc  2) {
-   NetNtpServerIP = getenv_IPaddr(ntpserverip);
-   if (NetNtpServerIP == 0) {
+   net_ntp_server = getenv_ip(ntpserverip);
+   if (net_ntp_server.s_addr == 0) {
printf(ntpserverip not set\n);
return CMD_RET_FAILURE;
}
} else {
-   NetNtpServerIP = string_to_ip(argv[1]);
-   if (NetNtpServerIP == 0) {
+   net_ntp_server = string_to_ip(argv[1]);
+   if (net_ntp_server.s_addr == 0) {
printf(Bad NTP server IP address\n);
return CMD_RET_FAILURE;
}
@@ -352,7 +352,7 @@ int do_sntp(cmd_tbl_t *cmdtp, int flag, int argc, char * 
const argv[])
 
if (NetLoop(SNTP)  0) {
printf(SNTP failed: 

Re: [U-Boot] [PATCH v2 01/25] net: cosmetic: Change IPaddr_t to struct in_addr

2015-04-08 Thread Simon Glass
On 8 April 2015 at 06:45, Simon Glass s...@chromium.org wrote:
 On 8 April 2015 at 00:41, Joe Hershberger joe.hershber...@ni.com wrote:
 This patch is simply clean-up to make the IPv4 type that is used match
 what Linux uses. It also attempts to move all variables that are IP
 addresses use good naming instead of CamelCase. No functional change.

 Signed-off-by: Joe Hershberger joe.hershber...@ni.com
 ---

 Changes in v2:
 -Fixed build failures in ip conversion patch

 Acked-by: Simon Glass s...@chromium.org

Applied to u-boot-dm/next, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 01/25] net: cosmetic: Change IPaddr_t to struct in_addr

2015-04-08 Thread Simon Glass
On 8 April 2015 at 00:41, Joe Hershberger joe.hershber...@ni.com wrote:
 This patch is simply clean-up to make the IPv4 type that is used match
 what Linux uses. It also attempts to move all variables that are IP
 addresses use good naming instead of CamelCase. No functional change.

 Signed-off-by: Joe Hershberger joe.hershber...@ni.com
 ---

 Changes in v2:
 -Fixed build failures in ip conversion patch

Acked-by: Simon Glass s...@chromium.org
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot