[U-Boot] minor debug cleanups in ./net

From: Robin Getz rgetz@blackfin.uclinux.org
Minor ./net cleanups - no functional changes - change #ifdef DEBUG printf(); #endif to just debug() - changed __FUNCTION__ to __func__ - got rid of extra whitespace between function and opening brace - removed unnecessary braces on if statements
gcc dead code elimination should make this functionally/size equivalent when DEBUG is not defined. (confirmed on Blackfin, with gcc 4.3.3).
Signed-off-by: Robin Getz rgetz@blackfin.uclinux.org
---
Most changes are:
-#ifdef DEBUG - printf("packet received\n"); -#endif + debug("packet received\n");
which is just plain nicer to read...
Makefile | 2 - bootp.c | 81 ++++++++++++++++++----------------------------------- eth.c | 8 ++--- net.c | 78 ++++++++++++++++----------------------------------- nfs.c | 42 ++++++--------------------- rarp.c | 4 -- sntp.c | 6 +-- tftp.c | 21 +++---------- 8 files changed, 78 insertions(+), 164 deletions(-)
---
diff --git a/net/Makefile b/net/Makefile index 835a04a..ff87d87 100644 --- a/net/Makefile +++ b/net/Makefile @@ -23,7 +23,7 @@
include $(TOPDIR)/config.mk
-# CFLAGS += -DET_DEBUG -DDEBUG +# CFLAGS += -DDEBUG
LIB = $(obj)libnet.a
diff --git a/net/bootp.c b/net/bootp.c index d5f9c4b..0799ae2 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -8,17 +8,6 @@ * Copyright 2000-2004 Wolfgang Denk, wd@denx.de */
-#if 0 -#define DEBUG 1 /* general debug */ -#define DEBUG_BOOTP_EXT 1 /* Debug received vendor fields */ -#endif - -#ifdef DEBUG_BOOTP_EXT -#define debug_ext(fmt,args...) printf (fmt ,##args) -#else -#define debug_ext(fmt,args...) -#endif - #include <common.h> #include <command.h> #include <net.h> @@ -107,7 +96,7 @@ static int BootpCheckPkt(uchar *pkt, unsigned dest, unsigned src, unsigned len) retval = -6; }
- debug ("Filtering pkt = %d\n", retval); + debug("Filtering pkt = %d\n", retval);
return retval; } @@ -129,7 +118,7 @@ static void BootpCopyNetParams(Bootp_t *bp) if (strlen(bp->bp_file) > 0) copy_filename (BootFile, bp->bp_file, sizeof(BootFile));
- debug ("Bootfile: %s\n", BootFile); + debug("Bootfile: %s\n", BootFile);
/* Propagate to environment: * don't delete exising entry when BOOTP / DHCP reply does @@ -156,7 +145,7 @@ static void BootpVendorFieldProcess (u8 * ext) { int size = *(ext + 1);
- debug_ext ("[BOOTP] Processing extension %d... (%d bytes)\n", *ext, + debug("[BOOTP] Processing extension %d... (%d bytes)\n", *ext, *(ext + 1));
NetBootFileSize = 0; @@ -255,7 +244,7 @@ static void BootpVendorProcess (u8 * ext, int size) { u8 *end = ext + size;
- debug_ext ("[BOOTP] Checking extension (%d bytes)...\n", size); + debug("[BOOTP] Checking extension (%d bytes)...\n", size);
while ((ext < end) && (*ext != 0xff)) { if (*ext == 0) { @@ -269,34 +258,27 @@ static void BootpVendorProcess (u8 * ext, int size) } }
-#ifdef DEBUG_BOOTP_EXT - puts ("[BOOTP] Received fields: \n"); + debug("[BOOTP] Received fields: \n"); if (NetOurSubnetMask) - printf ("NetOurSubnetMask : %pI4\n", &NetOurSubnetMask); + debug("NetOurSubnetMask : %pI4\n", &NetOurSubnetMask);
if (NetOurGatewayIP) - printf ("NetOurGatewayIP : %pI4", &NetOurGatewayIP); + debug("NetOurGatewayIP : %pI4", &NetOurGatewayIP);
- if (NetBootFileSize) { - printf ("NetBootFileSize : %d\n", NetBootFileSize); - } + if (NetBootFileSize) + debug("NetBootFileSize : %d\n", NetBootFileSize);
- if (NetOurHostName[0]) { - printf ("NetOurHostName : %s\n", NetOurHostName); - } + if (NetOurHostName[0]) + debug("NetOurHostName : %s\n", NetOurHostName);
- if (NetOurRootPath[0]) { - printf ("NetOurRootPath : %s\n", NetOurRootPath); - } + if (NetOurRootPath[0]) + debug("NetOurRootPath : %s\n", NetOurRootPath);
- if (NetOurNISDomain[0]) { - printf ("NetOurNISDomain : %s\n", NetOurNISDomain); - } + if (NetOurNISDomain[0]) + debug("NetOurNISDomain : %s\n", NetOurNISDomain);
- if (NetBootFileSize) { - printf ("NetBootFileSize: %d\n", NetBootFileSize); - } -#endif /* DEBUG_BOOTP_EXT */ + if (NetBootFileSize) + debug("NetBootFileSize: %d\n", NetBootFileSize); } /* * Handle a BOOTP received packet. @@ -307,7 +289,7 @@ BootpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) Bootp_t *bp; char *s;
- debug ("got BOOTP packet (src=%d, dst=%d, len=%d want_len=%zu)\n", + debug("got BOOTP packet (src=%d, dst=%d, len=%d want_len=%zu)\n", src, dest, len, sizeof (Bootp_t));
bp = (Bootp_t *)pkt; @@ -330,7 +312,7 @@ BootpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
NetSetTimeout(0, (thand_f *)0);
- debug ("Got good BOOTP\n"); + debug("Got good BOOTP\n");
if ((s = getenv("autoload")) != NULL) { if (*s == 'n') { @@ -579,14 +561,9 @@ BootpRequest (void) /* get our mac */ eth_getenv_enetaddr("ethaddr", bi_enetaddr);
-#ifdef DEBUG - puts ("BootpRequest => Our Mac: "); - for (reg=0; reg<6; reg++) { - printf ("%x%c", - bi_enetaddr[reg], - reg==5 ? '\n' : ':'); - } -#endif /* DEBUG */ + debug("BootpRequest => Our Mac: "); + for (reg=0; reg<6; reg++) + debug("%x%c", bi_enetaddr[reg], reg==5 ? '\n' : ':');
/* Mac-Manipulation 2 get seed1 */ tst1=0; @@ -820,7 +797,7 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer) int pktlen, iplen, extlen; IPaddr_t OfferedIP;
- debug ("DhcpSendRequestPkt: Sending DHCPREQUEST\n"); + debug("DhcpSendRequestPkt: Sending DHCPREQUEST\n"); pkt = NetTxPacket; memset ((void*)pkt, 0, PKTSIZE);
@@ -864,7 +841,7 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer) iplen = BOOTP_HDR_SIZE - sizeof(bp->bp_vend) + extlen; NetSetIP(iphdr, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC, iplen);
- debug ("Transmitting DHCPREQUEST packet: len = %d\n", pktlen); + debug("Transmitting DHCPREQUEST packet: len = %d\n", pktlen); #ifdef CONFIG_BOOTP_DHCP_REQUEST_DELAY udelay(CONFIG_BOOTP_DHCP_REQUEST_DELAY); #endif /* CONFIG_BOOTP_DHCP_REQUEST_DELAY */ @@ -879,13 +856,13 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) { Bootp_t *bp = (Bootp_t *)pkt;
- debug ("DHCPHandler: got packet: (src=%d, dst=%d, len=%d) state: %d\n", + debug("DHCPHandler: got packet: (src=%d, dst=%d, len=%d) state: %d\n", src, dest, len, dhcp_state);
if (BootpCheckPkt(pkt, dest, src, len)) /* Filter out pkts we don't want */ return;
- debug ("DHCPHandler: got DHCP packet: (src=%d, dst=%d, len=%d) state: %d\n", + debug("DHCPHandler: got DHCP packet: (src=%d, dst=%d, len=%d) state: %d\n", src, dest, len, dhcp_state);
switch (dhcp_state) { @@ -896,14 +873,14 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) * If filename is in format we recognize, assume it is a valid * OFFER from a server we want. */ - debug ("DHCP: state=SELECTING bp_file: "%s"\n", bp->bp_file); + debug("DHCP: state=SELECTING bp_file: "%s"\n", bp->bp_file); #ifdef CONFIG_SYS_BOOTFILE_PREFIX if (strncmp(bp->bp_file, CONFIG_SYS_BOOTFILE_PREFIX, strlen(CONFIG_SYS_BOOTFILE_PREFIX)) == 0 ) { #endif /* CONFIG_SYS_BOOTFILE_PREFIX */
- debug ("TRANSITIONING TO REQUESTING STATE\n"); + debug("TRANSITIONING TO REQUESTING STATE\n"); dhcp_state = REQUESTING;
if (NetReadLong((ulong*)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC)) @@ -918,7 +895,7 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) return; break; case REQUESTING: - debug ("DHCP State: REQUESTING\n"); + debug("DHCP State: REQUESTING\n");
if ( DhcpMessageType((u8 *)bp->bp_vend) == DHCP_ACK ) { char *s; diff --git a/net/eth.c b/net/eth.c index 8e1d692..b4f3b1a 100644 --- a/net/eth.c +++ b/net/eth.c @@ -263,7 +263,7 @@ void eth_set_enetaddr(int num, char *addr) { struct eth_device *dev; unsigned char enetaddr[6];
- debug ("eth_set_enetaddr(num=%d, addr=%s)\n", num, addr); + debug("eth_set_enetaddr(num=%d, addr=%s)\n", num, addr);
if (!eth_devices) return; @@ -278,7 +278,7 @@ void eth_set_enetaddr(int num, char *addr) { return; }
- debug ( "Setting new HW address on %s\n" + debug("Setting new HW address on %s\n" "New Address is %pM\n", dev->name, enetaddr);
@@ -341,14 +341,14 @@ int eth_init(bd_t *bis)
old_current = eth_current; do { - debug ("Trying %s\n", eth_current->name); + debug("Trying %s\n", eth_current->name);
if (eth_current->init(eth_current,bis) >= 0) { eth_current->state = ETH_STATE_ACTIVE;
return 0; } - debug ("FAIL\n"); + debug("FAIL\n");
eth_try_another(0); } while (old_current != eth_current); diff --git a/net/net.c b/net/net.c index 7ce947d..a4a0ff9 100644 --- a/net/net.c +++ b/net/net.c @@ -113,10 +113,6 @@ DECLARE_GLOBAL_DATA_PTR; # define ARP_TIMEOUT_COUNT CONFIG_NET_RETRY_COUNT #endif
-#if 0 -#define ET_DEBUG -#endif - /** BOOTP EXTENTIONS **/
IPaddr_t NetOurSubnetMask=0; /* Our subnet mask (0=unknown) */ @@ -218,9 +214,8 @@ void ArpRequest (void) volatile uchar *pkt; ARP_t *arp;
-#ifdef ET_DEBUG - printf ("ARP broadcast %d\n", NetArpWaitTry); -#endif + debug("ARP broadcast %d\n", NetArpWaitTry); + pkt = NetTxPacket;
pkt += NetSetEther (pkt, NetBcastAddr, PROT_ARP); @@ -644,9 +639,8 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len) /* if MAC address was not discovered yet, save the packet and do an ARP request */ if (memcmp(ether, NetEtherNullAddr, 6) == 0) {
-#ifdef ET_DEBUG - printf("sending ARP for %08lx\n", dest); -#endif + debug("sending ARP for %08lx\n", dest); + NetArpWaitPacketIP = dest; NetArpWaitPacketMAC = ether;
@@ -666,9 +660,7 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len) return 1; /* waiting */ }
-#ifdef ET_DEBUG - printf("sending UDP to %08lx/%pM\n", dest, ether); -#endif + debug("sending UDP to %08lx/%pM\n", dest, ether);
pkt = (uchar *)NetTxPacket; pkt += NetSetEther (pkt, ether, PROT_IP); @@ -692,9 +684,7 @@ int PingSend(void)
memcpy(mac, NetEtherNullAddr, 6);
-#ifdef ET_DEBUG - printf("sending ARP for %08lx\n", NetPingIP); -#endif + debug("sending ARP for %08lx\n", NetPingIP);
NetArpWaitPacketIP = NetPingIP; NetArpWaitPacketMAC = mac; @@ -1132,9 +1122,7 @@ NetReceive(volatile uchar * inpkt, int len) #endif ushort cti = 0, vlanid = VLAN_NONE, myvlanid, mynvlanid;
-#ifdef ET_DEBUG - printf("packet received\n"); -#endif + debug("packet received\n");
NetRxPacket = inpkt; NetRxPacketLen = len; @@ -1165,9 +1153,7 @@ NetReceive(volatile uchar * inpkt, int len)
x = ntohs(et->et_protlen);
-#ifdef ET_DEBUG - printf("packet received\n"); -#endif + debug("packet received\n");
if (x < 1514) { /* @@ -1185,9 +1171,8 @@ NetReceive(volatile uchar * inpkt, int len) } else { /* VLAN packet */ VLAN_Ethernet_t *vet = (VLAN_Ethernet_t *)et;
-#ifdef ET_DEBUG - printf("VLAN packet received\n"); -#endif + debug("VLAN packet received\n"); + /* too small packet? */ if (len < VLAN_ETHER_HDR_SIZE) return; @@ -1208,9 +1193,7 @@ NetReceive(volatile uchar * inpkt, int len) len -= VLAN_ETHER_HDR_SIZE; }
-#ifdef ET_DEBUG - printf("Receive from protocol 0x%x\n", x); -#endif + debug("Receive from protocol 0x%x\n", x);
#if defined(CONFIG_CMD_CDP) if (iscdp) { @@ -1239,9 +1222,8 @@ NetReceive(volatile uchar * inpkt, int len) * address; so if we receive such a packet, we set * the server ethernet address */ -#ifdef ET_DEBUG - puts ("Got ARP\n"); -#endif + debug("Got ARP\n"); + arp = (ARP_t *)ip; if (len < ARP_HDR_SIZE) { printf("bad length %d < %d\n", len, ARP_HDR_SIZE); @@ -1270,9 +1252,7 @@ NetReceive(volatile uchar * inpkt, int len)
switch (ntohs(arp->ar_op)) { case ARPOP_REQUEST: /* reply with our IP address */ -#ifdef ET_DEBUG - puts ("Got ARP REQUEST, return our IP\n"); -#endif + debug("Got ARP REQUEST, return our IP\n"); pkt = (uchar *)et; pkt += NetSetEther(pkt, et->et_src, PROT_ARP); arp->ar_op = htons(ARPOP_REPLY); @@ -1287,17 +1267,15 @@ NetReceive(volatile uchar * inpkt, int len) /* are we waiting for a reply */ if (!NetArpWaitPacketIP || !NetArpWaitPacketMAC) break; -#ifdef ET_DEBUG - printf("Got ARP REPLY, set server/gtwy eth addr (%pM)\n", + + debug("Got ARP REPLY, set server/gtwy eth addr (%pM)\n", arp->ar_data); -#endif
tmp = NetReadIP(&arp->ar_data[6]);
/* matched waiting packet's address */ if (tmp == NetArpWaitReplyIP) { -#ifdef ET_DEBUG - puts ("Got it\n"); + debug("Got it\n"); #endif /* save address for later use */ memcpy(NetArpWaitPacketMAC, &arp->ar_data[0], 6); @@ -1317,16 +1295,14 @@ NetReceive(volatile uchar * inpkt, int len) } return; default: -#ifdef ET_DEBUG - printf("Unexpected ARP opcode 0x%x\n", ntohs(arp->ar_op)); + debug("Unexpected ARP opcode 0x%x\n", ntohs(arp->ar_op)); #endif return; } break;
case PROT_RARP: -#ifdef ET_DEBUG - puts ("Got RARP\n"); + debug("Got RARP\n"); #endif arp = (ARP_t *)ip; if (len < ARP_HDR_SIZE) { @@ -1351,11 +1327,9 @@ NetReceive(volatile uchar * inpkt, int len) break;
case PROT_IP: -#ifdef ET_DEBUG - puts ("Got IP\n"); -#endif + debug("Got IP\n"); if (len < IP_HDR_SIZE) { - debug ("len bad %d < %lu\n", len, (ulong)IP_HDR_SIZE); + debug("len bad %d < %lu\n", len, (ulong)IP_HDR_SIZE); return; } if (len < ntohs(ip->ip_len)) { @@ -1363,9 +1337,8 @@ NetReceive(volatile uchar * inpkt, int len) return; } len = ntohs(ip->ip_len); -#ifdef ET_DEBUG - printf("len=%d, v=%02x\n", len, ip->ip_hl_v & 0xff); -#endif + debug("len=%d, v=%02x\n", len, ip->ip_hl_v & 0xff); + if ((ip->ip_hl_v & 0xf0) != 0x40) { return; } @@ -1423,10 +1396,9 @@ NetReceive(volatile uchar * inpkt, int len) (*packetHandler)((uchar *)ip, 0, 0, 0); return; case ICMP_ECHO_REQUEST: -#ifdef ET_DEBUG - printf ("Got ICMP ECHO REQUEST, return %d bytes \n", + debug("Got ICMP ECHO REQUEST, return %d bytes \n", ETHER_HDR_SIZE + len); -#endif + memcpy (&et->et_dest[0], &et->et_src[0], 6); memcpy (&et->et_src[ 0], NetOurEther, 6);
diff --git a/net/nfs.c b/net/nfs.c index 0101629..27395fb 100644 --- a/net/nfs.c +++ b/net/nfs.c @@ -29,8 +29,6 @@ #include "nfs.h" #include "bootp.h"
-/*#define NFS_DEBUG*/ - #if defined(CONFIG_CMD_NET) && defined(CONFIG_CMD_NFS)
#define HASHES_PER_LINE 65 /* Number of "loading" hashes per line */ @@ -357,9 +355,7 @@ RPC request dispatcher static void NfsSend (void) { -#ifdef NFS_DEBUG - printf ("%s\n", __FUNCTION__); -#endif + debug("%s\n", __func__);
switch (NfsState) { case STATE_PRCLOOKUP_PROG_MOUNT_REQ: @@ -397,9 +393,7 @@ rpc_lookup_reply (int prog, uchar *pkt, unsigned len)
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
-#ifdef NFS_DEBUG - printf ("%s\n", __FUNCTION__); -#endif + debug("%s\n", __func__);
if (ntohl(rpc_pkt.u.reply.id) != rpc_id) return -1; @@ -427,9 +421,7 @@ nfs_mount_reply (uchar *pkt, unsigned len) { struct rpc_t rpc_pkt;
-#ifdef NFS_DEBUG - printf ("%s\n", __FUNCTION__); -#endif + debug("%s\n", __func__);
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@@ -454,9 +446,7 @@ nfs_umountall_reply (uchar *pkt, unsigned len) { struct rpc_t rpc_pkt;
-#ifdef NFS_DEBUG - printf ("%s\n", __FUNCTION__); -#endif + debug("%s\n", __func__);
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@@ -480,9 +470,7 @@ nfs_lookup_reply (uchar *pkt, unsigned len) { struct rpc_t rpc_pkt;
-#ifdef NFS_DEBUG - printf ("%s\n", __FUNCTION__); -#endif + debug("%s\n", __func__);
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@@ -507,9 +495,7 @@ nfs_readlink_reply (uchar *pkt, unsigned len) struct rpc_t rpc_pkt; int rlen;
-#ifdef NFS_DEBUG - printf ("%s\n", __FUNCTION__); -#endif + debug("%s\n", __func__);
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@@ -544,9 +530,7 @@ nfs_read_reply (uchar *pkt, unsigned len) struct rpc_t rpc_pkt; int rlen;
-#ifdef NFS_DEBUG_nop - printf ("%s\n", __FUNCTION__); -#endif + debug("%s\n", __func__);
memcpy ((uchar *)&rpc_pkt, pkt, sizeof(rpc_pkt.u.reply));
@@ -601,9 +585,7 @@ NfsHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len) { int rlen;
-#ifdef NFS_DEBUG - printf ("%s\n", __FUNCTION__); -#endif + debug("%s\n", __func__);
if (dest != NfsOurPort) return;
@@ -661,9 +643,7 @@ NfsHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len) NfsState = STATE_UMOUNT_REQ; NfsSend (); } else { -#ifdef NFS_DEBUG - printf ("Symlink --> %s\n", nfs_path); -#endif + debug("Symlink --> %s\n", nfs_path); nfs_filename = basename (nfs_path); nfs_path = dirname (nfs_path);
@@ -696,9 +676,7 @@ NfsHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len) void NfsStart (void) { -#ifdef NFS_DEBUG - printf ("%s\n", __FUNCTION__); -#endif + debug("%s\n", __func__); NfsDownloadState = NETLOOP_FAIL;
NfsServerIP = NetServerIP; diff --git a/net/rarp.c b/net/rarp.c index 7105696..d37981b 100644 --- a/net/rarp.c +++ b/net/rarp.c @@ -48,9 +48,7 @@ static void RarpHandler(uchar * dummi0, unsigned dummi1, unsigned dummi2, unsigned dummi3) { char *s; -#ifdef DEBUG - puts ("Got good RARP\n"); -#endif + debug("Got good RARP\n"); if ((s = getenv("autoload")) != NULL) { if (*s == 'n') { /* diff --git a/net/sntp.c b/net/sntp.c index 404587e..76c10ec 100644 --- a/net/sntp.c +++ b/net/sntp.c @@ -23,7 +23,7 @@ SntpSend (void) int pktlen = SNTP_PACKET_LEN; int sport;
- debug ("%s\n", __FUNCTION__); + debug("%s\n", __func__);
memset (&pkt, 0, sizeof(pkt));
@@ -54,7 +54,7 @@ SntpHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len) struct rtc_time tm; ulong seconds;
- debug ("%s\n", __FUNCTION__); + debug("%s\n", __func__);
if (dest != SntpOurPort) return;
@@ -78,7 +78,7 @@ SntpHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len) void SntpStart (void) { - debug ("%s\n", __FUNCTION__); + debug("%s\n", __func__);
NetSetTimeout (SNTP_TIMEOUT, SntpTimeout); NetSetHandler(SntpHandler); diff --git a/net/tftp.c b/net/tftp.c index b0f1cca..74d9e42 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -10,8 +10,6 @@ #include "tftp.h" #include "bootp.h"
-#undef ET_DEBUG - #if defined(CONFIG_CMD_NET)
#define WELL_KNOWN_PORT 69 /* Well known TFTP port # */ @@ -196,9 +194,7 @@ TftpSend (void) strcpy ((char *)pkt, "timeout"); pkt += 7 /*strlen("timeout")*/ + 1; sprintf((char *)pkt, "%lu", TIMEOUT / 1000); -#ifdef ET_DEBUG - printf("send option "timeout %s"\n", (char *)pkt); -#endif + debug("send option "timeout %s"\n", (char *)pkt); pkt += strlen((char *)pkt) + 1; /* try for more effic. blk size */ pkt += sprintf((char *)pkt,"blksize%c%d%c", @@ -295,9 +291,7 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len) break;
case TFTP_OACK: -#ifdef ET_DEBUG - printf("Got OACK: %s %s\n", pkt, pkt+strlen(pkt)+1); -#endif + debug("Got OACK: %s %s\n", pkt, pkt+strlen(pkt)+1); TftpState = STATE_OACK; TftpServerPort = src; /* @@ -309,10 +303,8 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len) if (strcmp ((char*)pkt+i,"blksize") == 0) { TftpBlkSize = (unsigned short) simple_strtoul((char*)pkt+i+8,NULL,10); -#ifdef ET_DEBUG - printf ("Blocksize ack: %s, %d\n", + debug("Blocksize ack: %s, %d\n", (char*)pkt+i+8,TftpBlkSize); -#endif break; } } @@ -348,11 +340,8 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len) } }
-#ifdef ET_DEBUG - if (TftpState == STATE_RRQ) { - puts ("Server did not acknowledge timeout option!\n"); - } -#endif + if (TftpState == STATE_RRQ) + debug("Server did not acknowledge timeout option!\n");
if (TftpState == STATE_RRQ || TftpState == STATE_OACK) { /* first block received */

Robin,
This won't apply:
bwarren@bwarren-bldsrv:~/src/u-boot-net$ git am -s --whitespace=strip ~/h_drive/patches/minor\ debug\ cleanups\ in\ ._net.eml Applying minor debug cleanups in ./net fatal: patch fragment without header at line 198: @@ -879,13 +856,13 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) Patch failed at 0001. When you have resolved this problem run "git-am --resolved". If you would prefer to skip this patch, instead run "git-am --skip".
More issues below:
Robin Getz wrote:
From: Robin Getz rgetz@blackfin.uclinux.org
Minor ./net cleanups - no functional changes
- change #ifdef DEBUG printf(); #endif to just debug()
- changed __FUNCTION__ to __func__
- got rid of extra whitespace between function and opening brace
- removed unnecessary braces on if statements
gcc dead code elimination should make this functionally/size equivalent when DEBUG is not defined. (confirmed on Blackfin, with gcc 4.3.3).
Signed-off-by: Robin Getz rgetz@blackfin.uclinux.org
<snip>
/* matched waiting packet's address */ if (tmp == NetArpWaitReplyIP) {
-#ifdef ET_DEBUG
puts ("Got it\n");
debug("Got it\n");
#endif
I'm guessing you want to remove this #endif too, right?
/* save address for later use */ memcpy(NetArpWaitPacketMAC, &arp->ar_data[0], 6);
@@ -1317,16 +1295,14 @@ NetReceive(volatile uchar * inpkt, int len) } return; default: -#ifdef ET_DEBUG
printf("Unexpected ARP opcode 0x%x\n", ntohs(arp->ar_op));
debug("Unexpected ARP opcode 0x%x\n", ntohs(arp->ar_op));
#endif
ditto
return; } break;
case PROT_RARP: -#ifdef ET_DEBUG
puts ("Got RARP\n");
debug("Got RARP\n");
#endif
And again...
<snip>
This is good stuff. Please clean it up and re-submit.
regards, Ben

On Thu 23 Jul 2009 02:27, Ben Warren pondered:
Robin,
This won't apply:
bwarren@bwarren-bldsrv:~/src/u-boot-net$ git am -s --whitespace=strip ~/h_drive/patches/minor\ debug\ cleanups\ in\ ._net.eml Applying minor debug cleanups in ./net fatal: patch fragment without header at line 198: @@ -879,13 +856,13 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) Patch failed at 0001. When you have resolved this problem run "git-am --resolved". If you would prefer to skip this patch, instead run "git-am --skip".
OK - this is on
git remote -v origin git://git.denx.de/u-boot-net.git
git log --max-count=1 commit 97cfe86163505ea18e7ff7b71e78df5bb03dad57
(Is there a better way to tell if git is up to date?)
---
From: Robin Getz rgetz@blackfin.uclinux.org
Minor ./net cleanups - no functional changes - change #ifdef DEBUG printf(); #endif to just debug() - changed __FUNCTION__ to __func__ - got rid of extra whitespace between function and opening brace - removed unnecessary braces on if statements
gcc dead code elimination should make this functionally/size equivalent when DEBUG is not defined. (confirmed on Blackfin, with gcc 4.3.3).
Signed-off-by: Robin Getz rgetz@blackfin.uclinux.org
---
diff --git a/net/Makefile b/net/Makefile index 835a04a..ff87d87 100644 --- a/net/Makefile +++ b/net/Makefile @@ -23,7 +23,7 @@
include $(TOPDIR)/config.mk
-# CFLAGS += -DET_DEBUG -DDEBUG +# CFLAGS += -DDEBUG
LIB = $(obj)libnet.a
diff --git a/net/bootp.c b/net/bootp.c index d5f9c4b..0799ae2 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -8,17 +8,6 @@ * Copyright 2000-2004 Wolfgang Denk, wd@denx.de */
-#if 0 -#define DEBUG 1 /* general debug */ -#define DEBUG_BOOTP_EXT 1 /* Debug received vendor fields */ -#endif - -#ifdef DEBUG_BOOTP_EXT -#define debug_ext(fmt,args...) printf (fmt ,##args) -#else -#define debug_ext(fmt,args...) -#endif - #include <common.h> #include <command.h> #include <net.h> @@ -107,7 +96,7 @@ static int BootpCheckPkt(uchar *pkt, unsigned dest, unsigned src, unsigned len) retval = -6; }
- debug ("Filtering pkt = %d\n", retval); + debug("Filtering pkt = %d\n", retval);
return retval; } @@ -129,7 +118,7 @@ static void BootpCopyNetParams(Bootp_t *bp) if (strlen(bp->bp_file) > 0) copy_filename (BootFile, bp->bp_file, sizeof(BootFile));
- debug ("Bootfile: %s\n", BootFile); + debug("Bootfile: %s\n", BootFile);
/* Propagate to environment: * don't delete exising entry when BOOTP / DHCP reply does @@ -156,7 +145,7 @@ static void BootpVendorFieldProcess (u8 * ext) { int size = *(ext + 1);
- debug_ext ("[BOOTP] Processing extension %d... (%d bytes)\n", *ext, + debug("[BOOTP] Processing extension %d... (%d bytes)\n", *ext, *(ext + 1));
NetBootFileSize = 0; @@ -255,7 +244,7 @@ static void BootpVendorProcess (u8 * ext, int size) { u8 *end = ext + size;
- debug_ext ("[BOOTP] Checking extension (%d bytes)...\n", size); + debug("[BOOTP] Checking extension (%d bytes)...\n", size);
while ((ext < end) && (*ext != 0xff)) { if (*ext == 0) { @@ -269,34 +258,27 @@ static void BootpVendorProcess (u8 * ext, int size) } }
-#ifdef DEBUG_BOOTP_EXT - puts ("[BOOTP] Received fields: \n"); + debug("[BOOTP] Received fields: \n"); if (NetOurSubnetMask) - printf ("NetOurSubnetMask : %pI4\n", &NetOurSubnetMask); + debug("NetOurSubnetMask : %pI4\n", &NetOurSubnetMask);
if (NetOurGatewayIP) - printf ("NetOurGatewayIP : %pI4", &NetOurGatewayIP); + debug("NetOurGatewayIP : %pI4", &NetOurGatewayIP);
- if (NetBootFileSize) { - printf ("NetBootFileSize : %d\n", NetBootFileSize); - } + if (NetBootFileSize) + debug("NetBootFileSize : %d\n", NetBootFileSize);
- if (NetOurHostName[0]) { - printf ("NetOurHostName : %s\n", NetOurHostName); - } + if (NetOurHostName[0]) + debug("NetOurHostName : %s\n", NetOurHostName);
- if (NetOurRootPath[0]) { - printf ("NetOurRootPath : %s\n", NetOurRootPath); - } + if (NetOurRootPath[0]) + debug("NetOurRootPath : %s\n", NetOurRootPath);
- if (NetOurNISDomain[0]) { - printf ("NetOurNISDomain : %s\n", NetOurNISDomain); - } + if (NetOurNISDomain[0]) + debug("NetOurNISDomain : %s\n", NetOurNISDomain);
- if (NetBootFileSize) { - printf ("NetBootFileSize: %d\n", NetBootFileSize); - } -#endif /* DEBUG_BOOTP_EXT */ + if (NetBootFileSize) + debug("NetBootFileSize: %d\n", NetBootFileSize); } /* * Handle a BOOTP received packet. @@ -307,7 +289,7 @@ BootpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) Bootp_t *bp; char *s;
- debug ("got BOOTP packet (src=%d, dst=%d, len=%d want_len=%zu)\n", + debug("got BOOTP packet (src=%d, dst=%d, len=%d want_len=%zu)\n", src, dest, len, sizeof (Bootp_t));
bp = (Bootp_t *)pkt; @@ -330,7 +312,7 @@ BootpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
NetSetTimeout(0, (thand_f *)0);
- debug ("Got good BOOTP\n"); + debug("Got good BOOTP\n");
if ((s = getenv("autoload")) != NULL) { if (*s == 'n') { @@ -579,14 +561,9 @@ BootpRequest (void) /* get our mac */ eth_getenv_enetaddr("ethaddr", bi_enetaddr);
-#ifdef DEBUG - puts ("BootpRequest => Our Mac: "); - for (reg=0; reg<6; reg++) { - printf ("%x%c", - bi_enetaddr[reg], - reg==5 ? '\n' : ':'); - } -#endif /* DEBUG */ + debug("BootpRequest => Our Mac: "); + for (reg=0; reg<6; reg++) + debug("%x%c", bi_enetaddr[reg], reg==5 ? '\n' : ':');
/* Mac-Manipulation 2 get seed1 */ tst1=0; @@ -820,7 +797,7 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer) int pktlen, iplen, extlen; IPaddr_t OfferedIP;
- debug ("DhcpSendRequestPkt: Sending DHCPREQUEST\n"); + debug("DhcpSendRequestPkt: Sending DHCPREQUEST\n"); pkt = NetTxPacket; memset ((void*)pkt, 0, PKTSIZE);
@@ -864,7 +841,7 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer) iplen = BOOTP_HDR_SIZE - sizeof(bp->bp_vend) + extlen; NetSetIP(iphdr, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC, iplen);
- debug ("Transmitting DHCPREQUEST packet: len = %d\n", pktlen); + debug("Transmitting DHCPREQUEST packet: len = %d\n", pktlen); #ifdef CONFIG_BOOTP_DHCP_REQUEST_DELAY udelay(CONFIG_BOOTP_DHCP_REQUEST_DELAY); #endif /* CONFIG_BOOTP_DHCP_REQUEST_DELAY */ @@ -879,13 +856,13 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) { Bootp_t *bp = (Bootp_t *)pkt;
- debug ("DHCPHandler: got packet: (src=%d, dst=%d, len=%d) state: %d\n", + debug("DHCPHandler: got packet: (src=%d, dst=%d, len=%d) state: %d\n", src, dest, len, dhcp_state);
if (BootpCheckPkt(pkt, dest, src, len)) /* Filter out pkts we don't want */ return;
- debug ("DHCPHandler: got DHCP packet: (src=%d, dst=%d, len=%d) state: %d\n", + debug("DHCPHandler: got DHCP packet: (src=%d, dst=%d, len=%d) state: %d\n", src, dest, len, dhcp_state);
switch (dhcp_state) { @@ -896,14 +873,14 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) * If filename is in format we recognize, assume it is a valid * OFFER from a server we want. */ - debug ("DHCP: state=SELECTING bp_file: "%s"\n", bp->bp_file); + debug("DHCP: state=SELECTING bp_file: "%s"\n", bp->bp_file); #ifdef CONFIG_SYS_BOOTFILE_PREFIX if (strncmp(bp->bp_file, CONFIG_SYS_BOOTFILE_PREFIX, strlen(CONFIG_SYS_BOOTFILE_PREFIX)) == 0 ) { #endif /* CONFIG_SYS_BOOTFILE_PREFIX */
- debug ("TRANSITIONING TO REQUESTING STATE\n"); + debug("TRANSITIONING TO REQUESTING STATE\n"); dhcp_state = REQUESTING;
if (NetReadLong((ulong*)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC)) @@ -918,7 +895,7 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) return; break; case REQUESTING: - debug ("DHCP State: REQUESTING\n"); + debug("DHCP State: REQUESTING\n");
if ( DhcpMessageType((u8 *)bp->bp_vend) == DHCP_ACK ) { char *s; diff --git a/net/eth.c b/net/eth.c index 8e1d692..b4f3b1a 100644 --- a/net/eth.c +++ b/net/eth.c @@ -263,7 +263,7 @@ void eth_set_enetaddr(int num, char *addr) { struct eth_device *dev; unsigned char enetaddr[6];
- debug ("eth_set_enetaddr(num=%d, addr=%s)\n", num, addr); + debug("eth_set_enetaddr(num=%d, addr=%s)\n", num, addr);
if (!eth_devices) return; @@ -278,7 +278,7 @@ void eth_set_enetaddr(int num, char *addr) { return; }
- debug ( "Setting new HW address on %s\n" + debug("Setting new HW address on %s\n" "New Address is %pM\n", dev->name, enetaddr);
@@ -341,14 +341,14 @@ int eth_init(bd_t *bis)
old_current = eth_current; do { - debug ("Trying %s\n", eth_current->name); + debug("Trying %s\n", eth_current->name);
if (eth_current->init(eth_current,bis) >= 0) { eth_current->state = ETH_STATE_ACTIVE;
return 0; } - debug ("FAIL\n"); + debug("FAIL\n");
eth_try_another(0); } while (old_current != eth_current); diff --git a/net/net.c b/net/net.c index 641c37c..d1cc9b2 100644 --- a/net/net.c +++ b/net/net.c @@ -113,10 +113,6 @@ DECLARE_GLOBAL_DATA_PTR; # define ARP_TIMEOUT_COUNT CONFIG_NET_RETRY_COUNT #endif
-#if 0 -#define ET_DEBUG -#endif - /** BOOTP EXTENTIONS **/
IPaddr_t NetOurSubnetMask=0; /* Our subnet mask (0=unknown) */ @@ -218,9 +214,8 @@ void ArpRequest (void) volatile uchar *pkt; ARP_t *arp;
-#ifdef ET_DEBUG - printf ("ARP broadcast %d\n", NetArpWaitTry); -#endif + debug("ARP broadcast %d\n", NetArpWaitTry); + pkt = NetTxPacket;
pkt += NetSetEther (pkt, NetBcastAddr, PROT_ARP); @@ -644,9 +639,8 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len) /* if MAC address was not discovered yet, save the packet and do an ARP request */ if (memcmp(ether, NetEtherNullAddr, 6) == 0) {
-#ifdef ET_DEBUG - printf("sending ARP for %08lx\n", dest); -#endif + debug("sending ARP for %08lx\n", dest); + NetArpWaitPacketIP = dest; NetArpWaitPacketMAC = ether;
@@ -666,9 +660,7 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len) return 1; /* waiting */ }
-#ifdef ET_DEBUG - printf("sending UDP to %08lx/%pM\n", dest, ether); -#endif + debug("sending UDP to %08lx/%pM\n", dest, ether);
pkt = (uchar *)NetTxPacket; pkt += NetSetEther (pkt, ether, PROT_IP); @@ -692,9 +684,7 @@ int PingSend(void)
memcpy(mac, NetEtherNullAddr, 6);
-#ifdef ET_DEBUG - printf("sending ARP for %08lx\n", NetPingIP); -#endif + debug("sending ARP for %08lx\n", NetPingIP);
NetArpWaitPacketIP = NetPingIP; NetArpWaitPacketMAC = mac; @@ -1132,9 +1122,7 @@ NetReceive(volatile uchar * inpkt, int len) #endif ushort cti = 0, vlanid = VLAN_NONE, myvlanid, mynvlanid;
-#ifdef ET_DEBUG - printf("packet received\n"); -#endif + debug("packet received\n");
NetRxPacket = inpkt; NetRxPacketLen = len; @@ -1165,9 +1153,7 @@ NetReceive(volatile uchar * inpkt, int len)
x = ntohs(et->et_protlen);
-#ifdef ET_DEBUG - printf("packet received\n"); -#endif + debug("packet received\n");
if (x < 1514) { /* @@ -1185,9 +1171,8 @@ NetReceive(volatile uchar * inpkt, int len) } else { /* VLAN packet */ VLAN_Ethernet_t *vet = (VLAN_Ethernet_t *)et;
-#ifdef ET_DEBUG - printf("VLAN packet received\n"); -#endif + debug("VLAN packet received\n"); + /* too small packet? */ if (len < VLAN_ETHER_HDR_SIZE) return; @@ -1208,9 +1193,7 @@ NetReceive(volatile uchar * inpkt, int len) len -= VLAN_ETHER_HDR_SIZE; }
-#ifdef ET_DEBUG - printf("Receive from protocol 0x%x\n", x); -#endif + debug("Receive from protocol 0x%x\n", x);
#if defined(CONFIG_CMD_CDP) if (iscdp) { @@ -1239,9 +1222,8 @@ NetReceive(volatile uchar * inpkt, int len) * address; so if we receive such a packet, we set * the server ethernet address */ -#ifdef ET_DEBUG - puts ("Got ARP\n"); -#endif + debug("Got ARP\n"); + arp = (ARP_t *)ip; if (len < ARP_HDR_SIZE) { printf("bad length %d < %d\n", len, ARP_HDR_SIZE); @@ -1270,9 +1252,7 @@ NetReceive(volatile uchar * inpkt, int len)
switch (ntohs(arp->ar_op)) { case ARPOP_REQUEST: /* reply with our IP address */ -#ifdef ET_DEBUG - puts ("Got ARP REQUEST, return our IP\n"); -#endif + debug("Got ARP REQUEST, return our IP\n"); pkt = (uchar *)et; pkt += NetSetEther(pkt, et->et_src, PROT_ARP); arp->ar_op = htons(ARPOP_REPLY); @@ -1296,18 +1276,14 @@ NetReceive(volatile uchar * inpkt, int len) } #endif
-#ifdef ET_DEBUG - printf("Got ARP REPLY, set server/gtwy eth addr (%pM)\n", + debug("Got ARP REPLY, set server/gtwy eth addr (%pM)\n", arp->ar_data); -#endif
tmp = NetReadIP(&arp->ar_data[6]);
/* matched waiting packet's address */ if (tmp == NetArpWaitReplyIP) { -#ifdef ET_DEBUG - puts ("Got it\n"); -#endif + debug("Got it\n"); /* save address for later use */ memcpy(NetArpWaitPacketMAC, &arp->ar_data[0], 6);
@@ -1326,17 +1302,13 @@ NetReceive(volatile uchar * inpkt, int len) } return; default: -#ifdef ET_DEBUG - printf("Unexpected ARP opcode 0x%x\n", ntohs(arp->ar_op)); -#endif + debug("Unexpected ARP opcode 0x%x\n", ntohs(arp->ar_op)); return; } break;
case PROT_RARP: -#ifdef ET_DEBUG - puts ("Got RARP\n"); -#endif + debug("Got RARP\n"); arp = (ARP_t *)ip; if (len < ARP_HDR_SIZE) { printf("bad length %d < %d\n", len, ARP_HDR_SIZE); @@ -1360,11 +1332,9 @@ NetReceive(volatile uchar * inpkt, int len) break;
case PROT_IP: -#ifdef ET_DEBUG - puts ("Got IP\n"); -#endif + debug("Got IP\n"); if (len < IP_HDR_SIZE) { - debug ("len bad %d < %lu\n", len, (ulong)IP_HDR_SIZE); + debug("len bad %d < %lu\n", len, (ulong)IP_HDR_SIZE); return; } if (len < ntohs(ip->ip_len)) { @@ -1372,9 +1342,8 @@ NetReceive(volatile uchar * inpkt, int len) return; } len = ntohs(ip->ip_len); -#ifdef ET_DEBUG - printf("len=%d, v=%02x\n", len, ip->ip_hl_v & 0xff); -#endif + debug("len=%d, v=%02x\n", len, ip->ip_hl_v & 0xff); + if ((ip->ip_hl_v & 0xf0) != 0x40) { return; } @@ -1432,10 +1401,9 @@ NetReceive(volatile uchar * inpkt, int len) (*packetHandler)((uchar *)ip, 0, 0, 0); return; case ICMP_ECHO_REQUEST: -#ifdef ET_DEBUG - printf ("Got ICMP ECHO REQUEST, return %d bytes \n", + debug("Got ICMP ECHO REQUEST, return %d bytes \n", ETHER_HDR_SIZE + len); -#endif + memcpy (&et->et_dest[0], &et->et_src[0], 6); memcpy (&et->et_src[ 0], NetOurEther, 6);
diff --git a/net/nfs.c b/net/nfs.c index 0101629..27395fb 100644 --- a/net/nfs.c +++ b/net/nfs.c @@ -29,8 +29,6 @@ #include "nfs.h" #include "bootp.h"
-/*#define NFS_DEBUG*/ - #if defined(CONFIG_CMD_NET) && defined(CONFIG_CMD_NFS)
#define HASHES_PER_LINE 65 /* Number of "loading" hashes per line */ @@ -357,9 +355,7 @@ RPC request dispatcher static void NfsSend (void) { -#ifdef NFS_DEBUG - printf ("%s\n", __FUNCTION__); -#endif + debug("%s\n", __func__);
switch (NfsState) { case STATE_PRCLOOKUP_PROG_MOUNT_REQ: @@ -397,9 +393,7 @@ rpc_lookup_reply (int prog, uchar *pkt, unsigned len)
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
-#ifdef NFS_DEBUG - printf ("%s\n", __FUNCTION__); -#endif + debug("%s\n", __func__);
if (ntohl(rpc_pkt.u.reply.id) != rpc_id) return -1; @@ -427,9 +421,7 @@ nfs_mount_reply (uchar *pkt, unsigned len) { struct rpc_t rpc_pkt;
-#ifdef NFS_DEBUG - printf ("%s\n", __FUNCTION__); -#endif + debug("%s\n", __func__);
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@@ -454,9 +446,7 @@ nfs_umountall_reply (uchar *pkt, unsigned len) { struct rpc_t rpc_pkt;
-#ifdef NFS_DEBUG - printf ("%s\n", __FUNCTION__); -#endif + debug("%s\n", __func__);
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@@ -480,9 +470,7 @@ nfs_lookup_reply (uchar *pkt, unsigned len) { struct rpc_t rpc_pkt;
-#ifdef NFS_DEBUG - printf ("%s\n", __FUNCTION__); -#endif + debug("%s\n", __func__);
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@@ -507,9 +495,7 @@ nfs_readlink_reply (uchar *pkt, unsigned len) struct rpc_t rpc_pkt; int rlen;
-#ifdef NFS_DEBUG - printf ("%s\n", __FUNCTION__); -#endif + debug("%s\n", __func__);
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@@ -544,9 +530,7 @@ nfs_read_reply (uchar *pkt, unsigned len) struct rpc_t rpc_pkt; int rlen;
-#ifdef NFS_DEBUG_nop - printf ("%s\n", __FUNCTION__); -#endif + debug("%s\n", __func__);
memcpy ((uchar *)&rpc_pkt, pkt, sizeof(rpc_pkt.u.reply));
@@ -601,9 +585,7 @@ NfsHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len) { int rlen;
-#ifdef NFS_DEBUG - printf ("%s\n", __FUNCTION__); -#endif + debug("%s\n", __func__);
if (dest != NfsOurPort) return;
@@ -661,9 +643,7 @@ NfsHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len) NfsState = STATE_UMOUNT_REQ; NfsSend (); } else { -#ifdef NFS_DEBUG - printf ("Symlink --> %s\n", nfs_path); -#endif + debug("Symlink --> %s\n", nfs_path); nfs_filename = basename (nfs_path); nfs_path = dirname (nfs_path);
@@ -696,9 +676,7 @@ NfsHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len) void NfsStart (void) { -#ifdef NFS_DEBUG - printf ("%s\n", __FUNCTION__); -#endif + debug("%s\n", __func__); NfsDownloadState = NETLOOP_FAIL;
NfsServerIP = NetServerIP; diff --git a/net/rarp.c b/net/rarp.c index 7105696..d37981b 100644 --- a/net/rarp.c +++ b/net/rarp.c @@ -48,9 +48,7 @@ static void RarpHandler(uchar * dummi0, unsigned dummi1, unsigned dummi2, unsigned dummi3) { char *s; -#ifdef DEBUG - puts ("Got good RARP\n"); -#endif + debug("Got good RARP\n"); if ((s = getenv("autoload")) != NULL) { if (*s == 'n') { /* diff --git a/net/sntp.c b/net/sntp.c index 404587e..76c10ec 100644 --- a/net/sntp.c +++ b/net/sntp.c @@ -23,7 +23,7 @@ SntpSend (void) int pktlen = SNTP_PACKET_LEN; int sport;
- debug ("%s\n", __FUNCTION__); + debug("%s\n", __func__);
memset (&pkt, 0, sizeof(pkt));
@@ -54,7 +54,7 @@ SntpHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len) struct rtc_time tm; ulong seconds;
- debug ("%s\n", __FUNCTION__); + debug("%s\n", __func__);
if (dest != SntpOurPort) return;
@@ -78,7 +78,7 @@ SntpHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len) void SntpStart (void) { - debug ("%s\n", __FUNCTION__); + debug("%s\n", __func__);
NetSetTimeout (SNTP_TIMEOUT, SntpTimeout); NetSetHandler(SntpHandler); diff --git a/net/tftp.c b/net/tftp.c index b0f1cca..74d9e42 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -10,8 +10,6 @@ #include "tftp.h" #include "bootp.h"
-#undef ET_DEBUG - #if defined(CONFIG_CMD_NET)
#define WELL_KNOWN_PORT 69 /* Well known TFTP port # */ @@ -196,9 +194,7 @@ TftpSend (void) strcpy ((char *)pkt, "timeout"); pkt += 7 /*strlen("timeout")*/ + 1; sprintf((char *)pkt, "%lu", TIMEOUT / 1000); -#ifdef ET_DEBUG - printf("send option "timeout %s"\n", (char *)pkt); -#endif + debug("send option "timeout %s"\n", (char *)pkt); pkt += strlen((char *)pkt) + 1; /* try for more effic. blk size */ pkt += sprintf((char *)pkt,"blksize%c%d%c", @@ -295,9 +291,7 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len) break;
case TFTP_OACK: -#ifdef ET_DEBUG - printf("Got OACK: %s %s\n", pkt, pkt+strlen(pkt)+1); -#endif + debug("Got OACK: %s %s\n", pkt, pkt+strlen(pkt)+1); TftpState = STATE_OACK; TftpServerPort = src; /* @@ -309,10 +303,8 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len) if (strcmp ((char*)pkt+i,"blksize") == 0) { TftpBlkSize = (unsigned short) simple_strtoul((char*)pkt+i+8,NULL,10); -#ifdef ET_DEBUG - printf ("Blocksize ack: %s, %d\n", + debug("Blocksize ack: %s, %d\n", (char*)pkt+i+8,TftpBlkSize); -#endif break; } } @@ -348,11 +340,8 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len) } }
-#ifdef ET_DEBUG - if (TftpState == STATE_RRQ) { - puts ("Server did not acknowledge timeout option!\n"); - } -#endif + if (TftpState == STATE_RRQ) + debug("Server did not acknowledge timeout option!\n");
if (TftpState == STATE_RRQ || TftpState == STATE_OACK) { /* first block received */

On Thu 23 Jul 2009 03:01, Robin Getz pondered:
OK - this is on
git remote -v origin git://git.denx.de/u-boot-net.git
git log --max-count=1 commit 97cfe86163505ea18e7ff7b71e78df5bb03dad57
(Is there a better way to tell if git is up to date?)
Was there any problems with this one?
From: Robin Getz rgetz@blackfin.uclinux.org
Minor ./net cleanups - no functional changes
- change #ifdef DEBUG printf(); #endif to just debug()
- changed __FUNCTION__ to __func__
- got rid of extra whitespace between function and opening brace
- removed unnecessary braces on if statements
gcc dead code elimination should make this functionally/size equivalent when DEBUG is not defined. (confirmed on Blackfin, with gcc 4.3.3).
Signed-off-by: Robin Getz rgetz@blackfin.uclinux.org
diff --git a/net/Makefile b/net/Makefile index 835a04a..ff87d87 100644 --- a/net/Makefile +++ b/net/Makefile @@ -23,7 +23,7 @@
include $(TOPDIR)/config.mk
-# CFLAGS += -DET_DEBUG -DDEBUG +# CFLAGS += -DDEBUG
LIB = $(obj)libnet.a
diff --git a/net/bootp.c b/net/bootp.c index d5f9c4b..0799ae2 100644 --- a/net/bootp.c +++ b/net/bootp.c @@ -8,17 +8,6 @@
- Copyright 2000-2004 Wolfgang Denk, wd@denx.de
*/
-#if 0 -#define DEBUG 1 /* general debug */ -#define DEBUG_BOOTP_EXT 1 /* Debug received vendor fields */ -#endif
-#ifdef DEBUG_BOOTP_EXT -#define debug_ext(fmt,args...) printf (fmt ,##args) -#else -#define debug_ext(fmt,args...) -#endif
#include <common.h> #include <command.h> #include <net.h> @@ -107,7 +96,7 @@ static int BootpCheckPkt(uchar *pkt, unsigned dest, unsigned src, unsigned len) retval = -6; }
- debug ("Filtering pkt = %d\n", retval);
debug("Filtering pkt = %d\n", retval);
return retval;
} @@ -129,7 +118,7 @@ static void BootpCopyNetParams(Bootp_t *bp) if (strlen(bp->bp_file) > 0) copy_filename (BootFile, bp->bp_file, sizeof(BootFile));
- debug ("Bootfile: %s\n", BootFile);
debug("Bootfile: %s\n", BootFile);
/* Propagate to environment:
- don't delete exising entry when BOOTP / DHCP reply does
@@ -156,7 +145,7 @@ static void BootpVendorFieldProcess (u8 * ext) { int size = *(ext + 1);
- debug_ext ("[BOOTP] Processing extension %d... (%d bytes)\n",
*ext,
debug("[BOOTP] Processing extension %d... (%d bytes)\n", *ext, *(ext + 1));
NetBootFileSize = 0;
@@ -255,7 +244,7 @@ static void BootpVendorProcess (u8 * ext, int size) { u8 *end = ext + size;
- debug_ext ("[BOOTP] Checking extension (%d bytes)...\n", size);
debug("[BOOTP] Checking extension (%d bytes)...\n", size);
while ((ext < end) && (*ext != 0xff)) { if (*ext == 0) {
@@ -269,34 +258,27 @@ static void BootpVendorProcess (u8 * ext, int size) } }
-#ifdef DEBUG_BOOTP_EXT
- puts ("[BOOTP] Received fields: \n");
- debug("[BOOTP] Received fields: \n"); if (NetOurSubnetMask)
printf ("NetOurSubnetMask : %pI4\n", &NetOurSubnetMask);
debug("NetOurSubnetMask : %pI4\n", &NetOurSubnetMask);
if (NetOurGatewayIP)
printf ("NetOurGatewayIP : %pI4",
&NetOurGatewayIP);
debug("NetOurGatewayIP : %pI4", &NetOurGatewayIP);
- if (NetBootFileSize) {
printf ("NetBootFileSize : %d\n", NetBootFileSize);
- }
- if (NetBootFileSize)
debug("NetBootFileSize : %d\n", NetBootFileSize);
- if (NetOurHostName[0]) {
printf ("NetOurHostName : %s\n", NetOurHostName);
- }
- if (NetOurHostName[0])
debug("NetOurHostName : %s\n", NetOurHostName);
- if (NetOurRootPath[0]) {
printf ("NetOurRootPath : %s\n", NetOurRootPath);
- }
- if (NetOurRootPath[0])
debug("NetOurRootPath : %s\n", NetOurRootPath);
- if (NetOurNISDomain[0]) {
printf ("NetOurNISDomain : %s\n", NetOurNISDomain);
- }
- if (NetOurNISDomain[0])
debug("NetOurNISDomain : %s\n", NetOurNISDomain);
- if (NetBootFileSize) {
printf ("NetBootFileSize: %d\n", NetBootFileSize);
- }
-#endif /* DEBUG_BOOTP_EXT */
- if (NetBootFileSize)
debug("NetBootFileSize: %d\n", NetBootFileSize);
} /*
- Handle a BOOTP received packet.
@@ -307,7 +289,7 @@ BootpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) Bootp_t *bp; char *s;
- debug ("got BOOTP packet (src=%d, dst=%d, len=%d
want_len=%zu)\n",
- debug("got BOOTP packet (src=%d, dst=%d, len=%d
want_len=%zu)\n", src, dest, len, sizeof (Bootp_t));
bp = (Bootp_t *)pkt; @@ -330,7 +312,7 @@ BootpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
NetSetTimeout(0, (thand_f *)0);
- debug ("Got good BOOTP\n");
debug("Got good BOOTP\n");
if ((s = getenv("autoload")) != NULL) { if (*s == 'n') {
@@ -579,14 +561,9 @@ BootpRequest (void) /* get our mac */ eth_getenv_enetaddr("ethaddr", bi_enetaddr);
-#ifdef DEBUG
puts ("BootpRequest => Our Mac: ");
for (reg=0; reg<6; reg++) {
printf ("%x%c",
bi_enetaddr[reg],
reg==5 ? '\n' : ':');
}
-#endif /* DEBUG */
debug("BootpRequest => Our Mac: ");
for (reg=0; reg<6; reg++)
debug("%x%c", bi_enetaddr[reg], reg==5 ? '\n' :
':');
/* Mac-Manipulation 2 get seed1 */ tst1=0;
@@ -820,7 +797,7 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer) int pktlen, iplen, extlen; IPaddr_t OfferedIP;
- debug ("DhcpSendRequestPkt: Sending DHCPREQUEST\n");
- debug("DhcpSendRequestPkt: Sending DHCPREQUEST\n"); pkt = NetTxPacket; memset ((void*)pkt, 0, PKTSIZE);
@@ -864,7 +841,7 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer) iplen = BOOTP_HDR_SIZE - sizeof(bp->bp_vend) + extlen; NetSetIP(iphdr, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC, iplen);
- debug ("Transmitting DHCPREQUEST packet: len = %d\n", pktlen);
- debug("Transmitting DHCPREQUEST packet: len = %d\n", pktlen);
#ifdef CONFIG_BOOTP_DHCP_REQUEST_DELAY udelay(CONFIG_BOOTP_DHCP_REQUEST_DELAY); #endif /* CONFIG_BOOTP_DHCP_REQUEST_DELAY */ @@ -879,13 +856,13 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) { Bootp_t *bp = (Bootp_t *)pkt;
- debug ("DHCPHandler: got packet: (src=%d, dst=%d, len=%d) state:
%d\n",
- debug("DHCPHandler: got packet: (src=%d, dst=%d, len=%d) state:
%d\n", src, dest, len, dhcp_state);
if (BootpCheckPkt(pkt, dest, src, len)) /* Filter out pkts we don't want */ return;
- debug ("DHCPHandler: got DHCP packet: (src=%d, dst=%d, len=%d)
state: %d\n",
- debug("DHCPHandler: got DHCP packet: (src=%d, dst=%d, len=%d)
state: %d\n", src, dest, len, dhcp_state);
switch (dhcp_state) { @@ -896,14 +873,14 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) * If filename is in format we recognize, assume it is a valid * OFFER from a server we want. */
debug ("DHCP: state=SELECTING bp_file: \"%s\"\n",
bp->bp_file);
debug("DHCP: state=SELECTING bp_file: \"%s\"\n",
bp->bp_file); #ifdef CONFIG_SYS_BOOTFILE_PREFIX if (strncmp(bp->bp_file, CONFIG_SYS_BOOTFILE_PREFIX, strlen(CONFIG_SYS_BOOTFILE_PREFIX)) == 0 ) { #endif /* CONFIG_SYS_BOOTFILE_PREFIX */
debug ("TRANSITIONING TO REQUESTING STATE\n");
debug("TRANSITIONING TO REQUESTING STATE\n"); dhcp_state = REQUESTING; if (NetReadLong((ulong*)&bp->bp_vend[0]) ==
htonl(BOOTP_VENDOR_MAGIC)) @@ -918,7 +895,7 @@ DhcpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len) return; break; case REQUESTING:
debug ("DHCP State: REQUESTING\n");
debug("DHCP State: REQUESTING\n");
if ( DhcpMessageType((u8 *)bp->bp_vend) == DHCP_ACK ) { char *s;
diff --git a/net/eth.c b/net/eth.c index 8e1d692..b4f3b1a 100644 --- a/net/eth.c +++ b/net/eth.c @@ -263,7 +263,7 @@ void eth_set_enetaddr(int num, char *addr) { struct eth_device *dev; unsigned char enetaddr[6];
- debug ("eth_set_enetaddr(num=%d, addr=%s)\n", num, addr);
debug("eth_set_enetaddr(num=%d, addr=%s)\n", num, addr);
if (!eth_devices) return;
@@ -278,7 +278,7 @@ void eth_set_enetaddr(int num, char *addr) { return; }
- debug ( "Setting new HW address on %s\n"
- debug("Setting new HW address on %s\n" "New Address is %pM\n", dev->name, enetaddr);
@@ -341,14 +341,14 @@ int eth_init(bd_t *bis)
old_current = eth_current; do {
debug ("Trying %s\n", eth_current->name);
debug("Trying %s\n", eth_current->name);
if (eth_current->init(eth_current,bis) >= 0) { eth_current->state = ETH_STATE_ACTIVE;
return 0;
}
debug ("FAIL\n");
debug("FAIL\n");
eth_try_another(0); } while (old_current != eth_current);
diff --git a/net/net.c b/net/net.c index 641c37c..d1cc9b2 100644 --- a/net/net.c +++ b/net/net.c @@ -113,10 +113,6 @@ DECLARE_GLOBAL_DATA_PTR; # define ARP_TIMEOUT_COUNT CONFIG_NET_RETRY_COUNT #endif
-#if 0 -#define ET_DEBUG -#endif
/** BOOTP EXTENTIONS **/
IPaddr_t NetOurSubnetMask=0; /* Our subnet mask (0=unknown) */ @@ -218,9 +214,8 @@ void ArpRequest (void) volatile uchar *pkt; ARP_t *arp;
-#ifdef ET_DEBUG
- printf ("ARP broadcast %d\n", NetArpWaitTry);
-#endif
debug("ARP broadcast %d\n", NetArpWaitTry);
pkt = NetTxPacket;
pkt += NetSetEther (pkt, NetBcastAddr, PROT_ARP);
@@ -644,9 +639,8 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len) /* if MAC address was not discovered yet, save the packet and do an ARP request */ if (memcmp(ether, NetEtherNullAddr, 6) == 0) {
-#ifdef ET_DEBUG
printf("sending ARP for %08lx\n", dest);
-#endif
debug("sending ARP for %08lx\n", dest);
- NetArpWaitPacketIP = dest; NetArpWaitPacketMAC = ether;
@@ -666,9 +660,7 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len) return 1; /* waiting */ }
-#ifdef ET_DEBUG
- printf("sending UDP to %08lx/%pM\n", dest, ether);
-#endif
debug("sending UDP to %08lx/%pM\n", dest, ether);
pkt = (uchar *)NetTxPacket; pkt += NetSetEther (pkt, ether, PROT_IP);
@@ -692,9 +684,7 @@ int PingSend(void)
memcpy(mac, NetEtherNullAddr, 6);
-#ifdef ET_DEBUG
- printf("sending ARP for %08lx\n", NetPingIP);
-#endif
debug("sending ARP for %08lx\n", NetPingIP);
NetArpWaitPacketIP = NetPingIP; NetArpWaitPacketMAC = mac;
@@ -1132,9 +1122,7 @@ NetReceive(volatile uchar * inpkt, int len) #endif ushort cti = 0, vlanid = VLAN_NONE, myvlanid, mynvlanid;
-#ifdef ET_DEBUG
- printf("packet received\n");
-#endif
debug("packet received\n");
NetRxPacket = inpkt; NetRxPacketLen = len;
@@ -1165,9 +1153,7 @@ NetReceive(volatile uchar * inpkt, int len)
x = ntohs(et->et_protlen);
-#ifdef ET_DEBUG
- printf("packet received\n");
-#endif
debug("packet received\n");
if (x < 1514) { /*
@@ -1185,9 +1171,8 @@ NetReceive(volatile uchar * inpkt, int len) } else { /* VLAN packet */ VLAN_Ethernet_t *vet = (VLAN_Ethernet_t *)et;
-#ifdef ET_DEBUG
printf("VLAN packet received\n");
-#endif
debug("VLAN packet received\n");
- /* too small packet? */ if (len < VLAN_ETHER_HDR_SIZE) return;
@@ -1208,9 +1193,7 @@ NetReceive(volatile uchar * inpkt, int len) len -= VLAN_ETHER_HDR_SIZE; }
-#ifdef ET_DEBUG
- printf("Receive from protocol 0x%x\n", x);
-#endif
- debug("Receive from protocol 0x%x\n", x);
#if defined(CONFIG_CMD_CDP) if (iscdp) { @@ -1239,9 +1222,8 @@ NetReceive(volatile uchar * inpkt, int len) * address; so if we receive such a packet, we set * the server ethernet address */ -#ifdef ET_DEBUG
puts ("Got ARP\n");
-#endif
debug("Got ARP\n");
- arp = (ARP_t *)ip; if (len < ARP_HDR_SIZE) { printf("bad length %d < %d\n", len,
ARP_HDR_SIZE); @@ -1270,9 +1252,7 @@ NetReceive(volatile uchar * inpkt, int len)
switch (ntohs(arp->ar_op)) { case ARPOP_REQUEST: /* reply with our IP
address */ -#ifdef ET_DEBUG
puts ("Got ARP REQUEST, return our IP\n");
-#endif
debug("Got ARP REQUEST, return our IP\n"); pkt = (uchar *)et; pkt += NetSetEther(pkt, et->et_src, PROT_ARP); arp->ar_op = htons(ARPOP_REPLY);
@@ -1296,18 +1276,14 @@ NetReceive(volatile uchar * inpkt, int len) } #endif
-#ifdef ET_DEBUG
printf("Got ARP REPLY, set server/gtwy eth addr
(%pM)\n",
debug("Got ARP REPLY, set server/gtwy eth addr
(%pM)\n", arp->ar_data); -#endif
tmp = NetReadIP(&arp->ar_data[6]); /* matched waiting packet's address */ if (tmp == NetArpWaitReplyIP) {
-#ifdef ET_DEBUG
puts ("Got it\n");
-#endif
debug("Got it\n"); /* save address for later use */ memcpy(NetArpWaitPacketMAC,
&arp->ar_data[0], 6);
@@ -1326,17 +1302,13 @@ NetReceive(volatile uchar * inpkt, int len) } return; default: -#ifdef ET_DEBUG
printf("Unexpected ARP opcode 0x%x\n",
ntohs(arp->ar_op)); -#endif
debug("Unexpected ARP opcode 0x%x\n",
ntohs(arp->ar_op)); return; } break;
case PROT_RARP: -#ifdef ET_DEBUG
puts ("Got RARP\n");
-#endif
arp = (ARP_t *)ip; if (len < ARP_HDR_SIZE) { printf("bad length %d < %d\n", len,debug("Got RARP\n");
ARP_HDR_SIZE); @@ -1360,11 +1332,9 @@ NetReceive(volatile uchar * inpkt, int len) break;
case PROT_IP: -#ifdef ET_DEBUG
puts ("Got IP\n");
-#endif
if (len < IP_HDR_SIZE) {debug("Got IP\n");
debug ("len bad %d < %lu\n", len,
(ulong)IP_HDR_SIZE);
debug("len bad %d < %lu\n", len,
(ulong)IP_HDR_SIZE); return; } if (len < ntohs(ip->ip_len)) { @@ -1372,9 +1342,8 @@ NetReceive(volatile uchar * inpkt, int len) return; } len = ntohs(ip->ip_len); -#ifdef ET_DEBUG
printf("len=%d, v=%02x\n", len, ip->ip_hl_v & 0xff);
-#endif
debug("len=%d, v=%02x\n", len, ip->ip_hl_v & 0xff);
- if ((ip->ip_hl_v & 0xf0) != 0x40) { return; }
@@ -1432,10 +1401,9 @@ NetReceive(volatile uchar * inpkt, int len) (*packetHandler)((uchar *)ip, 0, 0, 0); return; case ICMP_ECHO_REQUEST: -#ifdef ET_DEBUG
printf ("Got ICMP ECHO REQUEST, return
%d bytes \n",
debug("Got ICMP ECHO REQUEST, return %d
bytes \n", ETHER_HDR_SIZE + len); -#endif
memcpy (&et->et_dest[0], &et->et_src[0],
6); memcpy (&et->et_src[ 0], NetOurEther, 6);
diff --git a/net/nfs.c b/net/nfs.c index 0101629..27395fb 100644 --- a/net/nfs.c +++ b/net/nfs.c @@ -29,8 +29,6 @@ #include "nfs.h" #include "bootp.h"
-/*#define NFS_DEBUG*/
#if defined(CONFIG_CMD_NET) && defined(CONFIG_CMD_NFS)
#define HASHES_PER_LINE 65 /* Number of "loading" hashes per line */ @@ -357,9 +355,7 @@ RPC request dispatcher static void NfsSend (void) { -#ifdef NFS_DEBUG
- printf ("%s\n", __FUNCTION__);
-#endif
debug("%s\n", __func__);
switch (NfsState) { case STATE_PRCLOOKUP_PROG_MOUNT_REQ:
@@ -397,9 +393,7 @@ rpc_lookup_reply (int prog, uchar *pkt, unsigned len)
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
-#ifdef NFS_DEBUG
- printf ("%s\n", __FUNCTION__);
-#endif
debug("%s\n", __func__);
if (ntohl(rpc_pkt.u.reply.id) != rpc_id) return -1;
@@ -427,9 +421,7 @@ nfs_mount_reply (uchar *pkt, unsigned len) { struct rpc_t rpc_pkt;
-#ifdef NFS_DEBUG
- printf ("%s\n", __FUNCTION__);
-#endif
debug("%s\n", __func__);
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@@ -454,9 +446,7 @@ nfs_umountall_reply (uchar *pkt, unsigned len) { struct rpc_t rpc_pkt;
-#ifdef NFS_DEBUG
- printf ("%s\n", __FUNCTION__);
-#endif
debug("%s\n", __func__);
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@@ -480,9 +470,7 @@ nfs_lookup_reply (uchar *pkt, unsigned len) { struct rpc_t rpc_pkt;
-#ifdef NFS_DEBUG
- printf ("%s\n", __FUNCTION__);
-#endif
debug("%s\n", __func__);
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@@ -507,9 +495,7 @@ nfs_readlink_reply (uchar *pkt, unsigned len) struct rpc_t rpc_pkt; int rlen;
-#ifdef NFS_DEBUG
- printf ("%s\n", __FUNCTION__);
-#endif
debug("%s\n", __func__);
memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@@ -544,9 +530,7 @@ nfs_read_reply (uchar *pkt, unsigned len) struct rpc_t rpc_pkt; int rlen;
-#ifdef NFS_DEBUG_nop
- printf ("%s\n", __FUNCTION__);
-#endif
debug("%s\n", __func__);
memcpy ((uchar *)&rpc_pkt, pkt, sizeof(rpc_pkt.u.reply));
@@ -601,9 +585,7 @@ NfsHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len) { int rlen;
-#ifdef NFS_DEBUG
- printf ("%s\n", __FUNCTION__);
-#endif
debug("%s\n", __func__);
if (dest != NfsOurPort) return;
@@ -661,9 +643,7 @@ NfsHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len) NfsState = STATE_UMOUNT_REQ; NfsSend (); } else { -#ifdef NFS_DEBUG
printf ("Symlink --> %s\n", nfs_path);
-#endif
debug("Symlink --> %s\n", nfs_path); nfs_filename = basename (nfs_path); nfs_path = dirname (nfs_path);
@@ -696,9 +676,7 @@ NfsHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len) void NfsStart (void) { -#ifdef NFS_DEBUG
- printf ("%s\n", __FUNCTION__);
-#endif
debug("%s\n", __func__); NfsDownloadState = NETLOOP_FAIL;
NfsServerIP = NetServerIP;
diff --git a/net/rarp.c b/net/rarp.c index 7105696..d37981b 100644 --- a/net/rarp.c +++ b/net/rarp.c @@ -48,9 +48,7 @@ static void RarpHandler(uchar * dummi0, unsigned dummi1, unsigned dummi2, unsigned dummi3) { char *s; -#ifdef DEBUG
- puts ("Got good RARP\n");
-#endif
- debug("Got good RARP\n"); if ((s = getenv("autoload")) != NULL) { if (*s == 'n') { /*
diff --git a/net/sntp.c b/net/sntp.c index 404587e..76c10ec 100644 --- a/net/sntp.c +++ b/net/sntp.c @@ -23,7 +23,7 @@ SntpSend (void) int pktlen = SNTP_PACKET_LEN; int sport;
- debug ("%s\n", __FUNCTION__);
debug("%s\n", __func__);
memset (&pkt, 0, sizeof(pkt));
@@ -54,7 +54,7 @@ SntpHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len) struct rtc_time tm; ulong seconds;
- debug ("%s\n", __FUNCTION__);
debug("%s\n", __func__);
if (dest != SntpOurPort) return;
@@ -78,7 +78,7 @@ SntpHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len) void SntpStart (void) {
- debug ("%s\n", __FUNCTION__);
debug("%s\n", __func__);
NetSetTimeout (SNTP_TIMEOUT, SntpTimeout); NetSetHandler(SntpHandler);
diff --git a/net/tftp.c b/net/tftp.c index b0f1cca..74d9e42 100644 --- a/net/tftp.c +++ b/net/tftp.c @@ -10,8 +10,6 @@ #include "tftp.h" #include "bootp.h"
-#undef ET_DEBUG
#if defined(CONFIG_CMD_NET)
#define WELL_KNOWN_PORT 69 /* Well known TFTP port # */ @@ -196,9 +194,7 @@ TftpSend (void) strcpy ((char *)pkt, "timeout"); pkt += 7 /*strlen("timeout")*/ + 1; sprintf((char *)pkt, "%lu", TIMEOUT / 1000); -#ifdef ET_DEBUG
printf("send option \"timeout %s\"\n", (char *)pkt);
-#endif
pkt += strlen((char *)pkt) + 1; /* try for more effic. blk size */ pkt += sprintf((char *)pkt,"blksize%c%d%c",debug("send option \"timeout %s\"\n", (char *)pkt);
@@ -295,9 +291,7 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len) break;
case TFTP_OACK: -#ifdef ET_DEBUG
printf("Got OACK: %s %s\n", pkt, pkt+strlen(pkt)+1);
-#endif
TftpState = STATE_OACK; TftpServerPort = src; /*debug("Got OACK: %s %s\n", pkt, pkt+strlen(pkt)+1);
@@ -309,10 +303,8 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len) if (strcmp ((char*)pkt+i,"blksize") == 0) { TftpBlkSize = (unsigned short)
simple_strtoul((char*)pkt+i+8,NULL,10); -#ifdef ET_DEBUG
printf ("Blocksize ack: %s, %d\n",
debug("Blocksize ack: %s, %d\n", (char*)pkt+i+8,TftpBlkSize);
-#endif break; } } @@ -348,11 +340,8 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len) } }
-#ifdef ET_DEBUG
if (TftpState == STATE_RRQ) {
puts ("Server did not acknowledge timeout
option!\n");
}
-#endif
if (TftpState == STATE_RRQ)
debug("Server did not acknowledge timeout
option!\n");
if (TftpState == STATE_RRQ || TftpState == STATE_OACK) { /* first block received */
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

Robin Getz wrote:
On Thu 23 Jul 2009 03:01, Robin Getz pondered:
OK - this is on
git remote -v origin git://git.denx.de/u-boot-net.git
git log --max-count=1 commit 97cfe86163505ea18e7ff7b71e78df5bb03dad57
(Is there a better way to tell if git is up to date?)
Was there any problems with this one?
Nothing wrong with the content, I'm just having git problems. It's probably on my end, and will try to apply it soon.
regards, Ben

Dear Robin Getz,
In message 200908061427.10961.rgetz@blackfin.uclinux.org you wrote:
On Thu 23 Jul 2009 03:01, Robin Getz pondered:
OK - this is on
git remote -v origin git://git.denx.de/u-boot-net.git
git log --max-count=1 commit 97cfe86163505ea18e7ff7b71e78df5bb03dad57
(Is there a better way to tell if git is up to date?)
Was there any problems with this one?
Well, "git describe" needs less typing, and gives better information.
Best regards,
Wolfgang Denk

On Thu 6 Aug 2009 15:40, Wolfgang Denk pondered:
Dear Robin Getz,
In message 200908061427.10961.rgetz@blackfin.uclinux.org you wrote:
On Thu 23 Jul 2009 03:01, Robin Getz pondered:
OK - this is on
git remote -v origin git://git.denx.de/u-boot-net.git
git log --max-count=1 commit 97cfe86163505ea18e7ff7b71e78df5bb03dad57
(Is there a better way to tell if git is up to date?)
Was there any problems with this one?
Well, "git describe" needs less typing, and gives better information.
Thanks for the tip.
rgetz@pinky:~/blackfin/mainline/u-boot/master> git remote -v origin git://git.denx.de/u-boot.git rgetz@pinky:~/blackfin/mainline/u-boot/master> git describe --all HEAD^ warning: tag 'v2009.08-rc1' is really 'tags/v2009.08-rc1' here v2009.08-rc1-29-gc3fa4f0
when I switch to the net tree, I get:
rgetz@pinky:~/blackfin/mainline/u-boot/net> git remote -v origin git://git.denx.de/u-boot-net.git rgetz@pinky:~/blackfin/mainline/u-boot/net> git describe --all HEAD^ warning: tag 'U-Boot-1_2_0' is really 'tags/U-Boot-1_2_0' here U-Boot-1_2_0-6291-g0b23fb3
That is because Ben hasn't done a git pull from the master since U-Boot-1_2_0? Or have I don't something wrong on my end?
-robin

Robin Getz wrote:
On Thu 6 Aug 2009 15:40, Wolfgang Denk pondered:
Dear Robin Getz,
In message 200908061427.10961.rgetz@blackfin.uclinux.org you wrote:
On Thu 23 Jul 2009 03:01, Robin Getz pondered:
OK - this is on
git remote -v origin git://git.denx.de/u-boot-net.git
git log --max-count=1 commit 97cfe86163505ea18e7ff7b71e78df5bb03dad57
(Is there a better way to tell if git is up to date?)
Was there any problems with this one?
Well, "git describe" needs less typing, and gives better information.
Thanks for the tip.
rgetz@pinky:~/blackfin/mainline/u-boot/master> git remote -v origin git://git.denx.de/u-boot.git rgetz@pinky:~/blackfin/mainline/u-boot/master> git describe --all HEAD^ warning: tag 'v2009.08-rc1' is really 'tags/v2009.08-rc1' here v2009.08-rc1-29-gc3fa4f0
when I switch to the net tree, I get:
rgetz@pinky:~/blackfin/mainline/u-boot/net> git remote -v origin git://git.denx.de/u-boot-net.git rgetz@pinky:~/blackfin/mainline/u-boot/net> git describe --all HEAD^ warning: tag 'U-Boot-1_2_0' is really 'tags/U-Boot-1_2_0' here U-Boot-1_2_0-6291-g0b23fb3
That is because Ben hasn't done a git pull from the master since U-Boot-1_2_0? Or have I don't something wrong on my end?
-robin
I never pull from the master, but follow the workflow described here:
http://www.denx.de/wiki/U-Boot/CustodianGitTrees
I have a local 'u-boot' branch that pulls from the master, then re-base the net branch to that one. I'm very far from being a git master, but thus far I've never seen problems.
regards, Ben

Dear Robin Getz,
In message 200908061557.30782.rgetz@blackfin.uclinux.org you wrote:
when I switch to the net tree, I get:
rgetz@pinky:~/blackfin/mainline/u-boot/net> git remote -v origin git://git.denx.de/u-boot-net.git rgetz@pinky:~/blackfin/mainline/u-boot/net> git describe --all HEAD^ warning: tag 'U-Boot-1_2_0' is really 'tags/U-Boot-1_2_0' here U-Boot-1_2_0-6291-g0b23fb3
That is because Ben hasn't done a git pull from the master since U-Boot-1_2_0? Or have I don't something wrong on my end?
Hm.. I have a "custodians" repo with all the custodian repos in it; this looks as follows:
-> git remote -v origin /home/wd/git/u-boot/master/.git u-boot-74xx-7xx git://git.denx.de/u-boot-74xx-7xx u-boot-arm git://git.denx.de/u-boot-arm u-boot-at91 git://git.denx.de/u-boot-at91 u-boot-avr32 git://git.denx.de/u-boot-avr32 u-boot-blackfin git://git.denx.de/u-boot-blackfin u-boot-cfi-flash git://git.denx.de/u-boot-cfi-flash u-boot-coldfire git://git.denx.de/u-boot-coldfire u-boot-fdt git://git.denx.de/u-boot-fdt u-boot-freebsd git://git.denx.de/u-boot-freebsd u-boot-i2c git://git.denx.de/u-boot-i2c u-boot-ixp git://git.denx.de/u-boot-ixp u-boot-microblaze git://git.denx.de/u-boot-microblaze u-boot-mips git://git.denx.de/u-boot-mips u-boot-mmc git://git.denx.de/u-boot-mmc u-boot-mpc5xxx git://git.denx.de/u-boot-mpc5xxx u-boot-mpc82xx git://git.denx.de/u-boot-mpc82xx u-boot-mpc83xx git://git.denx.de/u-boot-mpc83xx u-boot-mpc85xx git://git.denx.de/u-boot-mpc85xx u-boot-mpc86xx git://git.denx.de/u-boot-mpc86xx u-boot-mpc8xx git://git.denx.de/u-boot-mpc8xx u-boot-nand-flash git://git.denx.de/u-boot-nand-flash u-boot-net git://git.denx.de/u-boot-net u-boot-nios git://git.denx.de/u-boot-nios u-boot-ppc4xx git://git.denx.de/u-boot-ppc4xx u-boot-pxa git://git.denx.de/u-boot-pxa u-boot-s3c24xx git://git.denx.de/u-boot-s3c24xx u-boot-sh git://git.denx.de/u-boot-sh u-boot-sparc git://git.denx.de/u-boot-sparc u-boot-testing git://git.denx.de/u-boot-testing u-boot-tq-group git://git.denx.de/u-boot-tq-group u-boot-ubi git://git.denx.de/u-boot-ubi u-boot-usb git://git.denx.de/u-boot-usb u-boot-video git://git.denx.de/u-boot-video
-> git describe u-boot-net v2009.06-510-g97cfe86
Best regards,
Wolfgang Denk
participants (3)
-
Ben Warren
-
Robin Getz
-
Wolfgang Denk