From 0ebf04c607b54a352629dcf7e76b76f1785dae54 Mon Sep 17 00:00:00 2001 From: Robin Getz Date: Thu, 23 Jul 2009 03:01:03 -0400 Subject: 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 Signed-off-by: Ben Warren --- net/Makefile | 2 +- net/bootp.c | 81 ++++++++++++++++++++++-------------------------------------- net/eth.c | 8 +++--- net/net.c | 80 ++++++++++++++++++----------------------------------------- net/nfs.c | 42 ++++++++----------------------- net/rarp.c | 4 +-- net/sntp.c | 6 ++--- net/tftp.c | 21 ++++------------ 8 files changed, 77 insertions(+), 167 deletions(-) diff --git a/net/Makefile b/net/Makefile index 835a04af45..ff87d87e41 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 d5f9c4be6d..0799ae2b0f 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 #include #include @@ -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 8e1d6921ca..b4f3b1aa85 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 641c37cb8f..d1cc9b2e9b 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 0101629028..27395fbf2e 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 7105696262..d37981bfc8 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 404587e80e..76c10ecd3b 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 b0f1cca0b6..74d9e4215d 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 */ -- cgit v1.2.1