minor debug cleanups in ./net

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>

Signed-off-by: Ben Warren <biggerbadderben@gmail.com>
This commit is contained in:
Robin Getz 2009-07-23 03:01:03 -04:00 committed by Ben Warren
parent 187af954cf
commit 0ebf04c607
8 changed files with 77 additions and 167 deletions

View File

@ -23,7 +23,7 @@
include $(TOPDIR)/config.mk include $(TOPDIR)/config.mk
# CFLAGS += -DET_DEBUG -DDEBUG # CFLAGS += -DDEBUG
LIB = $(obj)libnet.a LIB = $(obj)libnet.a

View File

@ -8,17 +8,6 @@
* Copyright 2000-2004 Wolfgang Denk, wd@denx.de * 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 <common.h>
#include <command.h> #include <command.h>
#include <net.h> #include <net.h>
@ -107,7 +96,7 @@ static int BootpCheckPkt(uchar *pkt, unsigned dest, unsigned src, unsigned len)
retval = -6; retval = -6;
} }
debug ("Filtering pkt = %d\n", retval); debug("Filtering pkt = %d\n", retval);
return retval; return retval;
} }
@ -129,7 +118,7 @@ static void BootpCopyNetParams(Bootp_t *bp)
if (strlen(bp->bp_file) > 0) if (strlen(bp->bp_file) > 0)
copy_filename (BootFile, bp->bp_file, sizeof(BootFile)); copy_filename (BootFile, bp->bp_file, sizeof(BootFile));
debug ("Bootfile: %s\n", BootFile); debug("Bootfile: %s\n", BootFile);
/* Propagate to environment: /* Propagate to environment:
* don't delete exising entry when BOOTP / DHCP reply does * don't delete exising entry when BOOTP / DHCP reply does
@ -156,7 +145,7 @@ static void BootpVendorFieldProcess (u8 * ext)
{ {
int size = *(ext + 1); 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)); *(ext + 1));
NetBootFileSize = 0; NetBootFileSize = 0;
@ -255,7 +244,7 @@ static void BootpVendorProcess (u8 * ext, int size)
{ {
u8 *end = ext + 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)) { while ((ext < end) && (*ext != 0xff)) {
if (*ext == 0) { if (*ext == 0) {
@ -269,34 +258,27 @@ static void BootpVendorProcess (u8 * ext, int size)
} }
} }
#ifdef DEBUG_BOOTP_EXT debug("[BOOTP] Received fields: \n");
puts ("[BOOTP] Received fields: \n");
if (NetOurSubnetMask) if (NetOurSubnetMask)
printf ("NetOurSubnetMask : %pI4\n", &NetOurSubnetMask); debug("NetOurSubnetMask : %pI4\n", &NetOurSubnetMask);
if (NetOurGatewayIP) if (NetOurGatewayIP)
printf ("NetOurGatewayIP : %pI4", &NetOurGatewayIP); debug("NetOurGatewayIP : %pI4", &NetOurGatewayIP);
if (NetBootFileSize) { if (NetBootFileSize)
printf ("NetBootFileSize : %d\n", NetBootFileSize); debug("NetBootFileSize : %d\n", NetBootFileSize);
}
if (NetOurHostName[0]) { if (NetOurHostName[0])
printf ("NetOurHostName : %s\n", NetOurHostName); debug("NetOurHostName : %s\n", NetOurHostName);
}
if (NetOurRootPath[0]) { if (NetOurRootPath[0])
printf ("NetOurRootPath : %s\n", NetOurRootPath); debug("NetOurRootPath : %s\n", NetOurRootPath);
}
if (NetOurNISDomain[0]) { if (NetOurNISDomain[0])
printf ("NetOurNISDomain : %s\n", NetOurNISDomain); debug("NetOurNISDomain : %s\n", NetOurNISDomain);
}
if (NetBootFileSize) { if (NetBootFileSize)
printf ("NetBootFileSize: %d\n", NetBootFileSize); debug("NetBootFileSize: %d\n", NetBootFileSize);
}
#endif /* DEBUG_BOOTP_EXT */
} }
/* /*
* Handle a BOOTP received packet. * Handle a BOOTP received packet.
@ -307,7 +289,7 @@ BootpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
Bootp_t *bp; Bootp_t *bp;
char *s; 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)); src, dest, len, sizeof (Bootp_t));
bp = (Bootp_t *)pkt; bp = (Bootp_t *)pkt;
@ -330,7 +312,7 @@ BootpHandler(uchar * pkt, unsigned dest, unsigned src, unsigned len)
NetSetTimeout(0, (thand_f *)0); NetSetTimeout(0, (thand_f *)0);
debug ("Got good BOOTP\n"); debug("Got good BOOTP\n");
if ((s = getenv("autoload")) != NULL) { if ((s = getenv("autoload")) != NULL) {
if (*s == 'n') { if (*s == 'n') {
@ -579,14 +561,9 @@ BootpRequest (void)
/* get our mac */ /* get our mac */
eth_getenv_enetaddr("ethaddr", bi_enetaddr); eth_getenv_enetaddr("ethaddr", bi_enetaddr);
#ifdef DEBUG debug("BootpRequest => Our Mac: ");
puts ("BootpRequest => Our Mac: "); for (reg=0; reg<6; reg++)
for (reg=0; reg<6; reg++) { debug("%x%c", bi_enetaddr[reg], reg==5 ? '\n' : ':');
printf ("%x%c",
bi_enetaddr[reg],
reg==5 ? '\n' : ':');
}
#endif /* DEBUG */
/* Mac-Manipulation 2 get seed1 */ /* Mac-Manipulation 2 get seed1 */
tst1=0; tst1=0;
@ -820,7 +797,7 @@ static void DhcpSendRequestPkt(Bootp_t *bp_offer)
int pktlen, iplen, extlen; int pktlen, iplen, extlen;
IPaddr_t OfferedIP; IPaddr_t OfferedIP;
debug ("DhcpSendRequestPkt: Sending DHCPREQUEST\n"); debug("DhcpSendRequestPkt: Sending DHCPREQUEST\n");
pkt = NetTxPacket; pkt = NetTxPacket;
memset ((void*)pkt, 0, PKTSIZE); 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; iplen = BOOTP_HDR_SIZE - sizeof(bp->bp_vend) + extlen;
NetSetIP(iphdr, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC, iplen); 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 #ifdef CONFIG_BOOTP_DHCP_REQUEST_DELAY
udelay(CONFIG_BOOTP_DHCP_REQUEST_DELAY); udelay(CONFIG_BOOTP_DHCP_REQUEST_DELAY);
#endif /* 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; 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); src, dest, len, dhcp_state);
if (BootpCheckPkt(pkt, dest, src, len)) /* Filter out pkts we don't want */ if (BootpCheckPkt(pkt, dest, src, len)) /* Filter out pkts we don't want */
return; 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); src, dest, len, dhcp_state);
switch (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 * If filename is in format we recognize, assume it is a valid
* OFFER from a server we want. * 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 #ifdef CONFIG_SYS_BOOTFILE_PREFIX
if (strncmp(bp->bp_file, if (strncmp(bp->bp_file,
CONFIG_SYS_BOOTFILE_PREFIX, CONFIG_SYS_BOOTFILE_PREFIX,
strlen(CONFIG_SYS_BOOTFILE_PREFIX)) == 0 ) { strlen(CONFIG_SYS_BOOTFILE_PREFIX)) == 0 ) {
#endif /* CONFIG_SYS_BOOTFILE_PREFIX */ #endif /* CONFIG_SYS_BOOTFILE_PREFIX */
debug ("TRANSITIONING TO REQUESTING STATE\n"); debug("TRANSITIONING TO REQUESTING STATE\n");
dhcp_state = REQUESTING; dhcp_state = REQUESTING;
if (NetReadLong((ulong*)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC)) 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; return;
break; break;
case REQUESTING: case REQUESTING:
debug ("DHCP State: REQUESTING\n"); debug("DHCP State: REQUESTING\n");
if ( DhcpMessageType((u8 *)bp->bp_vend) == DHCP_ACK ) { if ( DhcpMessageType((u8 *)bp->bp_vend) == DHCP_ACK ) {
char *s; char *s;

View File

@ -263,7 +263,7 @@ void eth_set_enetaddr(int num, char *addr) {
struct eth_device *dev; struct eth_device *dev;
unsigned char enetaddr[6]; 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) if (!eth_devices)
return; return;
@ -278,7 +278,7 @@ void eth_set_enetaddr(int num, char *addr) {
return; return;
} }
debug ( "Setting new HW address on %s\n" debug("Setting new HW address on %s\n"
"New Address is %pM\n", "New Address is %pM\n",
dev->name, enetaddr); dev->name, enetaddr);
@ -341,14 +341,14 @@ int eth_init(bd_t *bis)
old_current = eth_current; old_current = eth_current;
do { do {
debug ("Trying %s\n", eth_current->name); debug("Trying %s\n", eth_current->name);
if (eth_current->init(eth_current,bis) >= 0) { if (eth_current->init(eth_current,bis) >= 0) {
eth_current->state = ETH_STATE_ACTIVE; eth_current->state = ETH_STATE_ACTIVE;
return 0; return 0;
} }
debug ("FAIL\n"); debug("FAIL\n");
eth_try_another(0); eth_try_another(0);
} while (old_current != eth_current); } while (old_current != eth_current);

View File

@ -113,10 +113,6 @@ DECLARE_GLOBAL_DATA_PTR;
# define ARP_TIMEOUT_COUNT CONFIG_NET_RETRY_COUNT # define ARP_TIMEOUT_COUNT CONFIG_NET_RETRY_COUNT
#endif #endif
#if 0
#define ET_DEBUG
#endif
/** BOOTP EXTENTIONS **/ /** BOOTP EXTENTIONS **/
IPaddr_t NetOurSubnetMask=0; /* Our subnet mask (0=unknown) */ IPaddr_t NetOurSubnetMask=0; /* Our subnet mask (0=unknown) */
@ -218,9 +214,8 @@ void ArpRequest (void)
volatile uchar *pkt; volatile uchar *pkt;
ARP_t *arp; ARP_t *arp;
#ifdef ET_DEBUG debug("ARP broadcast %d\n", NetArpWaitTry);
printf ("ARP broadcast %d\n", NetArpWaitTry);
#endif
pkt = NetTxPacket; pkt = NetTxPacket;
pkt += NetSetEther (pkt, NetBcastAddr, PROT_ARP); 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 MAC address was not discovered yet, save the packet and do an ARP request */
if (memcmp(ether, NetEtherNullAddr, 6) == 0) { if (memcmp(ether, NetEtherNullAddr, 6) == 0) {
#ifdef ET_DEBUG debug("sending ARP for %08lx\n", dest);
printf("sending ARP for %08lx\n", dest);
#endif
NetArpWaitPacketIP = dest; NetArpWaitPacketIP = dest;
NetArpWaitPacketMAC = ether; NetArpWaitPacketMAC = ether;
@ -666,9 +660,7 @@ NetSendUDPPacket(uchar *ether, IPaddr_t dest, int dport, int sport, int len)
return 1; /* waiting */ return 1; /* waiting */
} }
#ifdef ET_DEBUG debug("sending UDP to %08lx/%pM\n", dest, ether);
printf("sending UDP to %08lx/%pM\n", dest, ether);
#endif
pkt = (uchar *)NetTxPacket; pkt = (uchar *)NetTxPacket;
pkt += NetSetEther (pkt, ether, PROT_IP); pkt += NetSetEther (pkt, ether, PROT_IP);
@ -692,9 +684,7 @@ int PingSend(void)
memcpy(mac, NetEtherNullAddr, 6); memcpy(mac, NetEtherNullAddr, 6);
#ifdef ET_DEBUG debug("sending ARP for %08lx\n", NetPingIP);
printf("sending ARP for %08lx\n", NetPingIP);
#endif
NetArpWaitPacketIP = NetPingIP; NetArpWaitPacketIP = NetPingIP;
NetArpWaitPacketMAC = mac; NetArpWaitPacketMAC = mac;
@ -1132,9 +1122,7 @@ NetReceive(volatile uchar * inpkt, int len)
#endif #endif
ushort cti = 0, vlanid = VLAN_NONE, myvlanid, mynvlanid; ushort cti = 0, vlanid = VLAN_NONE, myvlanid, mynvlanid;
#ifdef ET_DEBUG debug("packet received\n");
printf("packet received\n");
#endif
NetRxPacket = inpkt; NetRxPacket = inpkt;
NetRxPacketLen = len; NetRxPacketLen = len;
@ -1165,9 +1153,7 @@ NetReceive(volatile uchar * inpkt, int len)
x = ntohs(et->et_protlen); x = ntohs(et->et_protlen);
#ifdef ET_DEBUG debug("packet received\n");
printf("packet received\n");
#endif
if (x < 1514) { if (x < 1514) {
/* /*
@ -1185,9 +1171,8 @@ NetReceive(volatile uchar * inpkt, int len)
} else { /* VLAN packet */ } else { /* VLAN packet */
VLAN_Ethernet_t *vet = (VLAN_Ethernet_t *)et; VLAN_Ethernet_t *vet = (VLAN_Ethernet_t *)et;
#ifdef ET_DEBUG debug("VLAN packet received\n");
printf("VLAN packet received\n");
#endif
/* too small packet? */ /* too small packet? */
if (len < VLAN_ETHER_HDR_SIZE) if (len < VLAN_ETHER_HDR_SIZE)
return; return;
@ -1208,9 +1193,7 @@ NetReceive(volatile uchar * inpkt, int len)
len -= VLAN_ETHER_HDR_SIZE; len -= VLAN_ETHER_HDR_SIZE;
} }
#ifdef ET_DEBUG debug("Receive from protocol 0x%x\n", x);
printf("Receive from protocol 0x%x\n", x);
#endif
#if defined(CONFIG_CMD_CDP) #if defined(CONFIG_CMD_CDP)
if (iscdp) { if (iscdp) {
@ -1239,9 +1222,8 @@ NetReceive(volatile uchar * inpkt, int len)
* address; so if we receive such a packet, we set * address; so if we receive such a packet, we set
* the server ethernet address * the server ethernet address
*/ */
#ifdef ET_DEBUG debug("Got ARP\n");
puts ("Got ARP\n");
#endif
arp = (ARP_t *)ip; arp = (ARP_t *)ip;
if (len < ARP_HDR_SIZE) { if (len < ARP_HDR_SIZE) {
printf("bad length %d < %d\n", 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)) { switch (ntohs(arp->ar_op)) {
case ARPOP_REQUEST: /* reply with our IP address */ case ARPOP_REQUEST: /* reply with our IP address */
#ifdef ET_DEBUG debug("Got ARP REQUEST, return our IP\n");
puts ("Got ARP REQUEST, return our IP\n");
#endif
pkt = (uchar *)et; pkt = (uchar *)et;
pkt += NetSetEther(pkt, et->et_src, PROT_ARP); pkt += NetSetEther(pkt, et->et_src, PROT_ARP);
arp->ar_op = htons(ARPOP_REPLY); arp->ar_op = htons(ARPOP_REPLY);
@ -1296,18 +1276,14 @@ NetReceive(volatile uchar * inpkt, int len)
} }
#endif #endif
#ifdef ET_DEBUG debug("Got ARP REPLY, set server/gtwy eth addr (%pM)\n",
printf("Got ARP REPLY, set server/gtwy eth addr (%pM)\n",
arp->ar_data); arp->ar_data);
#endif
tmp = NetReadIP(&arp->ar_data[6]); tmp = NetReadIP(&arp->ar_data[6]);
/* matched waiting packet's address */ /* matched waiting packet's address */
if (tmp == NetArpWaitReplyIP) { if (tmp == NetArpWaitReplyIP) {
#ifdef ET_DEBUG debug("Got it\n");
puts ("Got it\n");
#endif
/* save address for later use */ /* save address for later use */
memcpy(NetArpWaitPacketMAC, &arp->ar_data[0], 6); memcpy(NetArpWaitPacketMAC, &arp->ar_data[0], 6);
@ -1326,17 +1302,13 @@ NetReceive(volatile uchar * inpkt, int len)
} }
return; return;
default: default:
#ifdef ET_DEBUG debug("Unexpected ARP opcode 0x%x\n", ntohs(arp->ar_op));
printf("Unexpected ARP opcode 0x%x\n", ntohs(arp->ar_op));
#endif
return; return;
} }
break; break;
case PROT_RARP: case PROT_RARP:
#ifdef ET_DEBUG debug("Got RARP\n");
puts ("Got RARP\n");
#endif
arp = (ARP_t *)ip; arp = (ARP_t *)ip;
if (len < ARP_HDR_SIZE) { if (len < ARP_HDR_SIZE) {
printf("bad length %d < %d\n", 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; break;
case PROT_IP: case PROT_IP:
#ifdef ET_DEBUG debug("Got IP\n");
puts ("Got IP\n");
#endif
if (len < IP_HDR_SIZE) { 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; return;
} }
if (len < ntohs(ip->ip_len)) { if (len < ntohs(ip->ip_len)) {
@ -1372,9 +1342,8 @@ NetReceive(volatile uchar * inpkt, int len)
return; return;
} }
len = ntohs(ip->ip_len); len = ntohs(ip->ip_len);
#ifdef ET_DEBUG debug("len=%d, v=%02x\n", len, ip->ip_hl_v & 0xff);
printf("len=%d, v=%02x\n", len, ip->ip_hl_v & 0xff);
#endif
if ((ip->ip_hl_v & 0xf0) != 0x40) { if ((ip->ip_hl_v & 0xf0) != 0x40) {
return; return;
} }
@ -1432,10 +1401,9 @@ NetReceive(volatile uchar * inpkt, int len)
(*packetHandler)((uchar *)ip, 0, 0, 0); (*packetHandler)((uchar *)ip, 0, 0, 0);
return; return;
case ICMP_ECHO_REQUEST: case ICMP_ECHO_REQUEST:
#ifdef ET_DEBUG debug("Got ICMP ECHO REQUEST, return %d bytes \n",
printf ("Got ICMP ECHO REQUEST, return %d bytes \n",
ETHER_HDR_SIZE + len); ETHER_HDR_SIZE + len);
#endif
memcpy (&et->et_dest[0], &et->et_src[0], 6); memcpy (&et->et_dest[0], &et->et_src[0], 6);
memcpy (&et->et_src[ 0], NetOurEther, 6); memcpy (&et->et_src[ 0], NetOurEther, 6);

View File

@ -29,8 +29,6 @@
#include "nfs.h" #include "nfs.h"
#include "bootp.h" #include "bootp.h"
/*#define NFS_DEBUG*/
#if defined(CONFIG_CMD_NET) && defined(CONFIG_CMD_NFS) #if defined(CONFIG_CMD_NET) && defined(CONFIG_CMD_NFS)
#define HASHES_PER_LINE 65 /* Number of "loading" hashes per line */ #define HASHES_PER_LINE 65 /* Number of "loading" hashes per line */
@ -357,9 +355,7 @@ RPC request dispatcher
static void static void
NfsSend (void) NfsSend (void)
{ {
#ifdef NFS_DEBUG debug("%s\n", __func__);
printf ("%s\n", __FUNCTION__);
#endif
switch (NfsState) { switch (NfsState) {
case STATE_PRCLOOKUP_PROG_MOUNT_REQ: 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); memcpy ((unsigned char *)&rpc_pkt, pkt, len);
#ifdef NFS_DEBUG debug("%s\n", __func__);
printf ("%s\n", __FUNCTION__);
#endif
if (ntohl(rpc_pkt.u.reply.id) != rpc_id) if (ntohl(rpc_pkt.u.reply.id) != rpc_id)
return -1; return -1;
@ -427,9 +421,7 @@ nfs_mount_reply (uchar *pkt, unsigned len)
{ {
struct rpc_t rpc_pkt; struct rpc_t rpc_pkt;
#ifdef NFS_DEBUG debug("%s\n", __func__);
printf ("%s\n", __FUNCTION__);
#endif
memcpy ((unsigned char *)&rpc_pkt, pkt, len); memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@ -454,9 +446,7 @@ nfs_umountall_reply (uchar *pkt, unsigned len)
{ {
struct rpc_t rpc_pkt; struct rpc_t rpc_pkt;
#ifdef NFS_DEBUG debug("%s\n", __func__);
printf ("%s\n", __FUNCTION__);
#endif
memcpy ((unsigned char *)&rpc_pkt, pkt, len); memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@ -480,9 +470,7 @@ nfs_lookup_reply (uchar *pkt, unsigned len)
{ {
struct rpc_t rpc_pkt; struct rpc_t rpc_pkt;
#ifdef NFS_DEBUG debug("%s\n", __func__);
printf ("%s\n", __FUNCTION__);
#endif
memcpy ((unsigned char *)&rpc_pkt, pkt, len); memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@ -507,9 +495,7 @@ nfs_readlink_reply (uchar *pkt, unsigned len)
struct rpc_t rpc_pkt; struct rpc_t rpc_pkt;
int rlen; int rlen;
#ifdef NFS_DEBUG debug("%s\n", __func__);
printf ("%s\n", __FUNCTION__);
#endif
memcpy ((unsigned char *)&rpc_pkt, pkt, len); memcpy ((unsigned char *)&rpc_pkt, pkt, len);
@ -544,9 +530,7 @@ nfs_read_reply (uchar *pkt, unsigned len)
struct rpc_t rpc_pkt; struct rpc_t rpc_pkt;
int rlen; int rlen;
#ifdef NFS_DEBUG_nop debug("%s\n", __func__);
printf ("%s\n", __FUNCTION__);
#endif
memcpy ((uchar *)&rpc_pkt, pkt, sizeof(rpc_pkt.u.reply)); 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; int rlen;
#ifdef NFS_DEBUG debug("%s\n", __func__);
printf ("%s\n", __FUNCTION__);
#endif
if (dest != NfsOurPort) return; if (dest != NfsOurPort) return;
@ -661,9 +643,7 @@ NfsHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len)
NfsState = STATE_UMOUNT_REQ; NfsState = STATE_UMOUNT_REQ;
NfsSend (); NfsSend ();
} else { } else {
#ifdef NFS_DEBUG debug("Symlink --> %s\n", nfs_path);
printf ("Symlink --> %s\n", nfs_path);
#endif
nfs_filename = basename (nfs_path); nfs_filename = basename (nfs_path);
nfs_path = dirname (nfs_path); nfs_path = dirname (nfs_path);
@ -696,9 +676,7 @@ NfsHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len)
void void
NfsStart (void) NfsStart (void)
{ {
#ifdef NFS_DEBUG debug("%s\n", __func__);
printf ("%s\n", __FUNCTION__);
#endif
NfsDownloadState = NETLOOP_FAIL; NfsDownloadState = NETLOOP_FAIL;
NfsServerIP = NetServerIP; NfsServerIP = NetServerIP;

View File

@ -48,9 +48,7 @@ static void
RarpHandler(uchar * dummi0, unsigned dummi1, unsigned dummi2, unsigned dummi3) RarpHandler(uchar * dummi0, unsigned dummi1, unsigned dummi2, unsigned dummi3)
{ {
char *s; char *s;
#ifdef DEBUG debug("Got good RARP\n");
puts ("Got good RARP\n");
#endif
if ((s = getenv("autoload")) != NULL) { if ((s = getenv("autoload")) != NULL) {
if (*s == 'n') { if (*s == 'n') {
/* /*

View File

@ -23,7 +23,7 @@ SntpSend (void)
int pktlen = SNTP_PACKET_LEN; int pktlen = SNTP_PACKET_LEN;
int sport; int sport;
debug ("%s\n", __FUNCTION__); debug("%s\n", __func__);
memset (&pkt, 0, sizeof(pkt)); memset (&pkt, 0, sizeof(pkt));
@ -54,7 +54,7 @@ SntpHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len)
struct rtc_time tm; struct rtc_time tm;
ulong seconds; ulong seconds;
debug ("%s\n", __FUNCTION__); debug("%s\n", __func__);
if (dest != SntpOurPort) return; if (dest != SntpOurPort) return;
@ -78,7 +78,7 @@ SntpHandler (uchar *pkt, unsigned dest, unsigned src, unsigned len)
void void
SntpStart (void) SntpStart (void)
{ {
debug ("%s\n", __FUNCTION__); debug("%s\n", __func__);
NetSetTimeout (SNTP_TIMEOUT, SntpTimeout); NetSetTimeout (SNTP_TIMEOUT, SntpTimeout);
NetSetHandler(SntpHandler); NetSetHandler(SntpHandler);

View File

@ -10,8 +10,6 @@
#include "tftp.h" #include "tftp.h"
#include "bootp.h" #include "bootp.h"
#undef ET_DEBUG
#if defined(CONFIG_CMD_NET) #if defined(CONFIG_CMD_NET)
#define WELL_KNOWN_PORT 69 /* Well known TFTP port # */ #define WELL_KNOWN_PORT 69 /* Well known TFTP port # */
@ -196,9 +194,7 @@ TftpSend (void)
strcpy ((char *)pkt, "timeout"); strcpy ((char *)pkt, "timeout");
pkt += 7 /*strlen("timeout")*/ + 1; pkt += 7 /*strlen("timeout")*/ + 1;
sprintf((char *)pkt, "%lu", TIMEOUT / 1000); sprintf((char *)pkt, "%lu", TIMEOUT / 1000);
#ifdef ET_DEBUG debug("send option \"timeout %s\"\n", (char *)pkt);
printf("send option \"timeout %s\"\n", (char *)pkt);
#endif
pkt += strlen((char *)pkt) + 1; pkt += strlen((char *)pkt) + 1;
/* try for more effic. blk size */ /* try for more effic. blk size */
pkt += sprintf((char *)pkt,"blksize%c%d%c", pkt += sprintf((char *)pkt,"blksize%c%d%c",
@ -295,9 +291,7 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len)
break; break;
case TFTP_OACK: case TFTP_OACK:
#ifdef ET_DEBUG debug("Got OACK: %s %s\n", pkt, pkt+strlen(pkt)+1);
printf("Got OACK: %s %s\n", pkt, pkt+strlen(pkt)+1);
#endif
TftpState = STATE_OACK; TftpState = STATE_OACK;
TftpServerPort = src; TftpServerPort = src;
/* /*
@ -309,10 +303,8 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len)
if (strcmp ((char*)pkt+i,"blksize") == 0) { if (strcmp ((char*)pkt+i,"blksize") == 0) {
TftpBlkSize = (unsigned short) TftpBlkSize = (unsigned short)
simple_strtoul((char*)pkt+i+8,NULL,10); simple_strtoul((char*)pkt+i+8,NULL,10);
#ifdef ET_DEBUG debug("Blocksize ack: %s, %d\n",
printf ("Blocksize ack: %s, %d\n",
(char*)pkt+i+8,TftpBlkSize); (char*)pkt+i+8,TftpBlkSize);
#endif
break; break;
} }
} }
@ -348,11 +340,8 @@ TftpHandler (uchar * pkt, unsigned dest, unsigned src, unsigned len)
} }
} }
#ifdef ET_DEBUG if (TftpState == STATE_RRQ)
if (TftpState == STATE_RRQ) { debug("Server did not acknowledge timeout option!\n");
puts ("Server did not acknowledge timeout option!\n");
}
#endif
if (TftpState == STATE_RRQ || TftpState == STATE_OACK) { if (TftpState == STATE_RRQ || TftpState == STATE_OACK) {
/* first block received */ /* first block received */