Commit 0ebf04c607b54a352629dcf7e76b76f1785dae54

Authored by Robin Getz
Committed by Ben Warren
1 parent 187af954cf

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>

Showing 8 changed files with 77 additions and 167 deletions Side-by-side Diff

... ... @@ -23,7 +23,7 @@
23 23  
24 24 include $(TOPDIR)/config.mk
25 25  
26   -# CFLAGS += -DET_DEBUG -DDEBUG
  26 +# CFLAGS += -DDEBUG
27 27  
28 28 LIB = $(obj)libnet.a
29 29  
... ... @@ -8,17 +8,6 @@
8 8 * Copyright 2000-2004 Wolfgang Denk, wd@denx.de
9 9 */
10 10  
11   -#if 0
12   -#define DEBUG 1 /* general debug */
13   -#define DEBUG_BOOTP_EXT 1 /* Debug received vendor fields */
14   -#endif
15   -
16   -#ifdef DEBUG_BOOTP_EXT
17   -#define debug_ext(fmt,args...) printf (fmt ,##args)
18   -#else
19   -#define debug_ext(fmt,args...)
20   -#endif
21   -
22 11 #include <common.h>
23 12 #include <command.h>
24 13 #include <net.h>
... ... @@ -107,7 +96,7 @@
107 96 retval = -6;
108 97 }
109 98  
110   - debug ("Filtering pkt = %d\n", retval);
  99 + debug("Filtering pkt = %d\n", retval);
111 100  
112 101 return retval;
113 102 }
... ... @@ -129,7 +118,7 @@
129 118 if (strlen(bp->bp_file) > 0)
130 119 copy_filename (BootFile, bp->bp_file, sizeof(BootFile));
131 120  
132   - debug ("Bootfile: %s\n", BootFile);
  121 + debug("Bootfile: %s\n", BootFile);
133 122  
134 123 /* Propagate to environment:
135 124 * don't delete exising entry when BOOTP / DHCP reply does
... ... @@ -156,7 +145,7 @@
156 145 {
157 146 int size = *(ext + 1);
158 147  
159   - debug_ext ("[BOOTP] Processing extension %d... (%d bytes)\n", *ext,
  148 + debug("[BOOTP] Processing extension %d... (%d bytes)\n", *ext,
160 149 *(ext + 1));
161 150  
162 151 NetBootFileSize = 0;
... ... @@ -255,7 +244,7 @@
255 244 {
256 245 u8 *end = ext + size;
257 246  
258   - debug_ext ("[BOOTP] Checking extension (%d bytes)...\n", size);
  247 + debug("[BOOTP] Checking extension (%d bytes)...\n", size);
259 248  
260 249 while ((ext < end) && (*ext != 0xff)) {
261 250 if (*ext == 0) {
262 251  
263 252  
264 253  
265 254  
266 255  
267 256  
268 257  
... ... @@ -269,34 +258,27 @@
269 258 }
270 259 }
271 260  
272   -#ifdef DEBUG_BOOTP_EXT
273   - puts ("[BOOTP] Received fields: \n");
  261 + debug("[BOOTP] Received fields: \n");
274 262 if (NetOurSubnetMask)
275   - printf ("NetOurSubnetMask : %pI4\n", &NetOurSubnetMask);
  263 + debug("NetOurSubnetMask : %pI4\n", &NetOurSubnetMask);
276 264  
277 265 if (NetOurGatewayIP)
278   - printf ("NetOurGatewayIP : %pI4", &NetOurGatewayIP);
  266 + debug("NetOurGatewayIP : %pI4", &NetOurGatewayIP);
279 267  
280   - if (NetBootFileSize) {
281   - printf ("NetBootFileSize : %d\n", NetBootFileSize);
282   - }
  268 + if (NetBootFileSize)
  269 + debug("NetBootFileSize : %d\n", NetBootFileSize);
283 270  
284   - if (NetOurHostName[0]) {
285   - printf ("NetOurHostName : %s\n", NetOurHostName);
286   - }
  271 + if (NetOurHostName[0])
  272 + debug("NetOurHostName : %s\n", NetOurHostName);
287 273  
288   - if (NetOurRootPath[0]) {
289   - printf ("NetOurRootPath : %s\n", NetOurRootPath);
290   - }
  274 + if (NetOurRootPath[0])
  275 + debug("NetOurRootPath : %s\n", NetOurRootPath);
291 276  
292   - if (NetOurNISDomain[0]) {
293   - printf ("NetOurNISDomain : %s\n", NetOurNISDomain);
294   - }
  277 + if (NetOurNISDomain[0])
  278 + debug("NetOurNISDomain : %s\n", NetOurNISDomain);
295 279  
296   - if (NetBootFileSize) {
297   - printf ("NetBootFileSize: %d\n", NetBootFileSize);
298   - }
299   -#endif /* DEBUG_BOOTP_EXT */
  280 + if (NetBootFileSize)
  281 + debug("NetBootFileSize: %d\n", NetBootFileSize);
300 282 }
301 283 /*
302 284 * Handle a BOOTP received packet.
... ... @@ -307,7 +289,7 @@
307 289 Bootp_t *bp;
308 290 char *s;
309 291  
310   - debug ("got BOOTP packet (src=%d, dst=%d, len=%d want_len=%zu)\n",
  292 + debug("got BOOTP packet (src=%d, dst=%d, len=%d want_len=%zu)\n",
311 293 src, dest, len, sizeof (Bootp_t));
312 294  
313 295 bp = (Bootp_t *)pkt;
... ... @@ -330,7 +312,7 @@
330 312  
331 313 NetSetTimeout(0, (thand_f *)0);
332 314  
333   - debug ("Got good BOOTP\n");
  315 + debug("Got good BOOTP\n");
334 316  
335 317 if ((s = getenv("autoload")) != NULL) {
336 318 if (*s == 'n') {
... ... @@ -579,14 +561,9 @@
579 561 /* get our mac */
580 562 eth_getenv_enetaddr("ethaddr", bi_enetaddr);
581 563  
582   -#ifdef DEBUG
583   - puts ("BootpRequest => Our Mac: ");
584   - for (reg=0; reg<6; reg++) {
585   - printf ("%x%c",
586   - bi_enetaddr[reg],
587   - reg==5 ? '\n' : ':');
588   - }
589   -#endif /* DEBUG */
  564 + debug("BootpRequest => Our Mac: ");
  565 + for (reg=0; reg<6; reg++)
  566 + debug("%x%c", bi_enetaddr[reg], reg==5 ? '\n' : ':');
590 567  
591 568 /* Mac-Manipulation 2 get seed1 */
592 569 tst1=0;
... ... @@ -820,7 +797,7 @@
820 797 int pktlen, iplen, extlen;
821 798 IPaddr_t OfferedIP;
822 799  
823   - debug ("DhcpSendRequestPkt: Sending DHCPREQUEST\n");
  800 + debug("DhcpSendRequestPkt: Sending DHCPREQUEST\n");
824 801 pkt = NetTxPacket;
825 802 memset ((void*)pkt, 0, PKTSIZE);
826 803  
... ... @@ -864,7 +841,7 @@
864 841 iplen = BOOTP_HDR_SIZE - sizeof(bp->bp_vend) + extlen;
865 842 NetSetIP(iphdr, 0xFFFFFFFFL, PORT_BOOTPS, PORT_BOOTPC, iplen);
866 843  
867   - debug ("Transmitting DHCPREQUEST packet: len = %d\n", pktlen);
  844 + debug("Transmitting DHCPREQUEST packet: len = %d\n", pktlen);
868 845 #ifdef CONFIG_BOOTP_DHCP_REQUEST_DELAY
869 846 udelay(CONFIG_BOOTP_DHCP_REQUEST_DELAY);
870 847 #endif /* CONFIG_BOOTP_DHCP_REQUEST_DELAY */
871 848  
... ... @@ -879,13 +856,13 @@
879 856 {
880 857 Bootp_t *bp = (Bootp_t *)pkt;
881 858  
882   - debug ("DHCPHandler: got packet: (src=%d, dst=%d, len=%d) state: %d\n",
  859 + debug("DHCPHandler: got packet: (src=%d, dst=%d, len=%d) state: %d\n",
883 860 src, dest, len, dhcp_state);
884 861  
885 862 if (BootpCheckPkt(pkt, dest, src, len)) /* Filter out pkts we don't want */
886 863 return;
887 864  
888   - debug ("DHCPHandler: got DHCP packet: (src=%d, dst=%d, len=%d) state: %d\n",
  865 + debug("DHCPHandler: got DHCP packet: (src=%d, dst=%d, len=%d) state: %d\n",
889 866 src, dest, len, dhcp_state);
890 867  
891 868 switch (dhcp_state) {
892 869  
... ... @@ -896,14 +873,14 @@
896 873 * If filename is in format we recognize, assume it is a valid
897 874 * OFFER from a server we want.
898 875 */
899   - debug ("DHCP: state=SELECTING bp_file: \"%s\"\n", bp->bp_file);
  876 + debug("DHCP: state=SELECTING bp_file: \"%s\"\n", bp->bp_file);
900 877 #ifdef CONFIG_SYS_BOOTFILE_PREFIX
901 878 if (strncmp(bp->bp_file,
902 879 CONFIG_SYS_BOOTFILE_PREFIX,
903 880 strlen(CONFIG_SYS_BOOTFILE_PREFIX)) == 0 ) {
904 881 #endif /* CONFIG_SYS_BOOTFILE_PREFIX */
905 882  
906   - debug ("TRANSITIONING TO REQUESTING STATE\n");
  883 + debug("TRANSITIONING TO REQUESTING STATE\n");
907 884 dhcp_state = REQUESTING;
908 885  
909 886 if (NetReadLong((ulong*)&bp->bp_vend[0]) == htonl(BOOTP_VENDOR_MAGIC))
... ... @@ -918,7 +895,7 @@
918 895 return;
919 896 break;
920 897 case REQUESTING:
921   - debug ("DHCP State: REQUESTING\n");
  898 + debug("DHCP State: REQUESTING\n");
922 899  
923 900 if ( DhcpMessageType((u8 *)bp->bp_vend) == DHCP_ACK ) {
924 901 char *s;
... ... @@ -263,7 +263,7 @@
263 263 struct eth_device *dev;
264 264 unsigned char enetaddr[6];
265 265  
266   - debug ("eth_set_enetaddr(num=%d, addr=%s)\n", num, addr);
  266 + debug("eth_set_enetaddr(num=%d, addr=%s)\n", num, addr);
267 267  
268 268 if (!eth_devices)
269 269 return;
... ... @@ -278,7 +278,7 @@
278 278 return;
279 279 }
280 280  
281   - debug ( "Setting new HW address on %s\n"
  281 + debug("Setting new HW address on %s\n"
282 282 "New Address is %pM\n",
283 283 dev->name, enetaddr);
284 284  
285 285  
... ... @@ -341,14 +341,14 @@
341 341  
342 342 old_current = eth_current;
343 343 do {
344   - debug ("Trying %s\n", eth_current->name);
  344 + debug("Trying %s\n", eth_current->name);
345 345  
346 346 if (eth_current->init(eth_current,bis) >= 0) {
347 347 eth_current->state = ETH_STATE_ACTIVE;
348 348  
349 349 return 0;
350 350 }
351   - debug ("FAIL\n");
  351 + debug("FAIL\n");
352 352  
353 353 eth_try_another(0);
354 354 } while (old_current != eth_current);
... ... @@ -113,10 +113,6 @@
113 113 # define ARP_TIMEOUT_COUNT CONFIG_NET_RETRY_COUNT
114 114 #endif
115 115  
116   -#if 0
117   -#define ET_DEBUG
118   -#endif
119   -
120 116 /** BOOTP EXTENTIONS **/
121 117  
122 118 IPaddr_t NetOurSubnetMask=0; /* Our subnet mask (0=unknown) */
... ... @@ -218,9 +214,8 @@
218 214 volatile uchar *pkt;
219 215 ARP_t *arp;
220 216  
221   -#ifdef ET_DEBUG
222   - printf ("ARP broadcast %d\n", NetArpWaitTry);
223   -#endif
  217 + debug("ARP broadcast %d\n", NetArpWaitTry);
  218 +
224 219 pkt = NetTxPacket;
225 220  
226 221 pkt += NetSetEther (pkt, NetBcastAddr, PROT_ARP);
... ... @@ -644,9 +639,8 @@
644 639 /* if MAC address was not discovered yet, save the packet and do an ARP request */
645 640 if (memcmp(ether, NetEtherNullAddr, 6) == 0) {
646 641  
647   -#ifdef ET_DEBUG
648   - printf("sending ARP for %08lx\n", dest);
649   -#endif
  642 + debug("sending ARP for %08lx\n", dest);
  643 +
650 644 NetArpWaitPacketIP = dest;
651 645 NetArpWaitPacketMAC = ether;
652 646  
... ... @@ -666,9 +660,7 @@
666 660 return 1; /* waiting */
667 661 }
668 662  
669   -#ifdef ET_DEBUG
670   - printf("sending UDP to %08lx/%pM\n", dest, ether);
671   -#endif
  663 + debug("sending UDP to %08lx/%pM\n", dest, ether);
672 664  
673 665 pkt = (uchar *)NetTxPacket;
674 666 pkt += NetSetEther (pkt, ether, PROT_IP);
... ... @@ -692,9 +684,7 @@
692 684  
693 685 memcpy(mac, NetEtherNullAddr, 6);
694 686  
695   -#ifdef ET_DEBUG
696   - printf("sending ARP for %08lx\n", NetPingIP);
697   -#endif
  687 + debug("sending ARP for %08lx\n", NetPingIP);
698 688  
699 689 NetArpWaitPacketIP = NetPingIP;
700 690 NetArpWaitPacketMAC = mac;
... ... @@ -1132,9 +1122,7 @@
1132 1122 #endif
1133 1123 ushort cti = 0, vlanid = VLAN_NONE, myvlanid, mynvlanid;
1134 1124  
1135   -#ifdef ET_DEBUG
1136   - printf("packet received\n");
1137   -#endif
  1125 + debug("packet received\n");
1138 1126  
1139 1127 NetRxPacket = inpkt;
1140 1128 NetRxPacketLen = len;
... ... @@ -1165,9 +1153,7 @@
1165 1153  
1166 1154 x = ntohs(et->et_protlen);
1167 1155  
1168   -#ifdef ET_DEBUG
1169   - printf("packet received\n");
1170   -#endif
  1156 + debug("packet received\n");
1171 1157  
1172 1158 if (x < 1514) {
1173 1159 /*
... ... @@ -1185,9 +1171,8 @@
1185 1171 } else { /* VLAN packet */
1186 1172 VLAN_Ethernet_t *vet = (VLAN_Ethernet_t *)et;
1187 1173  
1188   -#ifdef ET_DEBUG
1189   - printf("VLAN packet received\n");
1190   -#endif
  1174 + debug("VLAN packet received\n");
  1175 +
1191 1176 /* too small packet? */
1192 1177 if (len < VLAN_ETHER_HDR_SIZE)
1193 1178 return;
... ... @@ -1208,9 +1193,7 @@
1208 1193 len -= VLAN_ETHER_HDR_SIZE;
1209 1194 }
1210 1195  
1211   -#ifdef ET_DEBUG
1212   - printf("Receive from protocol 0x%x\n", x);
1213   -#endif
  1196 + debug("Receive from protocol 0x%x\n", x);
1214 1197  
1215 1198 #if defined(CONFIG_CMD_CDP)
1216 1199 if (iscdp) {
... ... @@ -1239,9 +1222,8 @@
1239 1222 * address; so if we receive such a packet, we set
1240 1223 * the server ethernet address
1241 1224 */
1242   -#ifdef ET_DEBUG
1243   - puts ("Got ARP\n");
1244   -#endif
  1225 + debug("Got ARP\n");
  1226 +
1245 1227 arp = (ARP_t *)ip;
1246 1228 if (len < ARP_HDR_SIZE) {
1247 1229 printf("bad length %d < %d\n", len, ARP_HDR_SIZE);
... ... @@ -1270,9 +1252,7 @@
1270 1252  
1271 1253 switch (ntohs(arp->ar_op)) {
1272 1254 case ARPOP_REQUEST: /* reply with our IP address */
1273   -#ifdef ET_DEBUG
1274   - puts ("Got ARP REQUEST, return our IP\n");
1275   -#endif
  1255 + debug("Got ARP REQUEST, return our IP\n");
1276 1256 pkt = (uchar *)et;
1277 1257 pkt += NetSetEther(pkt, et->et_src, PROT_ARP);
1278 1258 arp->ar_op = htons(ARPOP_REPLY);
1279 1259  
1280 1260  
... ... @@ -1296,18 +1276,14 @@
1296 1276 }
1297 1277 #endif
1298 1278  
1299   -#ifdef ET_DEBUG
1300   - printf("Got ARP REPLY, set server/gtwy eth addr (%pM)\n",
  1279 + debug("Got ARP REPLY, set server/gtwy eth addr (%pM)\n",
1301 1280 arp->ar_data);
1302   -#endif
1303 1281  
1304 1282 tmp = NetReadIP(&arp->ar_data[6]);
1305 1283  
1306 1284 /* matched waiting packet's address */
1307 1285 if (tmp == NetArpWaitReplyIP) {
1308   -#ifdef ET_DEBUG
1309   - puts ("Got it\n");
1310   -#endif
  1286 + debug("Got it\n");
1311 1287 /* save address for later use */
1312 1288 memcpy(NetArpWaitPacketMAC, &arp->ar_data[0], 6);
1313 1289  
1314 1290  
... ... @@ -1326,17 +1302,13 @@
1326 1302 }
1327 1303 return;
1328 1304 default:
1329   -#ifdef ET_DEBUG
1330   - printf("Unexpected ARP opcode 0x%x\n", ntohs(arp->ar_op));
1331   -#endif
  1305 + debug("Unexpected ARP opcode 0x%x\n", ntohs(arp->ar_op));
1332 1306 return;
1333 1307 }
1334 1308 break;
1335 1309  
1336 1310 case PROT_RARP:
1337   -#ifdef ET_DEBUG
1338   - puts ("Got RARP\n");
1339   -#endif
  1311 + debug("Got RARP\n");
1340 1312 arp = (ARP_t *)ip;
1341 1313 if (len < ARP_HDR_SIZE) {
1342 1314 printf("bad length %d < %d\n", len, ARP_HDR_SIZE);
1343 1315  
... ... @@ -1360,11 +1332,9 @@
1360 1332 break;
1361 1333  
1362 1334 case PROT_IP:
1363   -#ifdef ET_DEBUG
1364   - puts ("Got IP\n");
1365   -#endif
  1335 + debug("Got IP\n");
1366 1336 if (len < IP_HDR_SIZE) {
1367   - debug ("len bad %d < %lu\n", len, (ulong)IP_HDR_SIZE);
  1337 + debug("len bad %d < %lu\n", len, (ulong)IP_HDR_SIZE);
1368 1338 return;
1369 1339 }
1370 1340 if (len < ntohs(ip->ip_len)) {
... ... @@ -1372,9 +1342,8 @@
1372 1342 return;
1373 1343 }
1374 1344 len = ntohs(ip->ip_len);
1375   -#ifdef ET_DEBUG
1376   - printf("len=%d, v=%02x\n", len, ip->ip_hl_v & 0xff);
1377   -#endif
  1345 + debug("len=%d, v=%02x\n", len, ip->ip_hl_v & 0xff);
  1346 +
1378 1347 if ((ip->ip_hl_v & 0xf0) != 0x40) {
1379 1348 return;
1380 1349 }
1381 1350  
... ... @@ -1432,10 +1401,9 @@
1432 1401 (*packetHandler)((uchar *)ip, 0, 0, 0);
1433 1402 return;
1434 1403 case ICMP_ECHO_REQUEST:
1435   -#ifdef ET_DEBUG
1436   - printf ("Got ICMP ECHO REQUEST, return %d bytes \n",
  1404 + debug("Got ICMP ECHO REQUEST, return %d bytes \n",
1437 1405 ETHER_HDR_SIZE + len);
1438   -#endif
  1406 +
1439 1407 memcpy (&et->et_dest[0], &et->et_src[0], 6);
1440 1408 memcpy (&et->et_src[ 0], NetOurEther, 6);
1441 1409  
... ... @@ -29,8 +29,6 @@
29 29 #include "nfs.h"
30 30 #include "bootp.h"
31 31  
32   -/*#define NFS_DEBUG*/
33   -
34 32 #if defined(CONFIG_CMD_NET) && defined(CONFIG_CMD_NFS)
35 33  
36 34 #define HASHES_PER_LINE 65 /* Number of "loading" hashes per line */
... ... @@ -357,9 +355,7 @@
357 355 static void
358 356 NfsSend (void)
359 357 {
360   -#ifdef NFS_DEBUG
361   - printf ("%s\n", __FUNCTION__);
362   -#endif
  358 + debug("%s\n", __func__);
363 359  
364 360 switch (NfsState) {
365 361 case STATE_PRCLOOKUP_PROG_MOUNT_REQ:
... ... @@ -397,9 +393,7 @@
397 393  
398 394 memcpy ((unsigned char *)&rpc_pkt, pkt, len);
399 395  
400   -#ifdef NFS_DEBUG
401   - printf ("%s\n", __FUNCTION__);
402   -#endif
  396 + debug("%s\n", __func__);
403 397  
404 398 if (ntohl(rpc_pkt.u.reply.id) != rpc_id)
405 399 return -1;
... ... @@ -427,9 +421,7 @@
427 421 {
428 422 struct rpc_t rpc_pkt;
429 423  
430   -#ifdef NFS_DEBUG
431   - printf ("%s\n", __FUNCTION__);
432   -#endif
  424 + debug("%s\n", __func__);
433 425  
434 426 memcpy ((unsigned char *)&rpc_pkt, pkt, len);
435 427  
... ... @@ -454,9 +446,7 @@
454 446 {
455 447 struct rpc_t rpc_pkt;
456 448  
457   -#ifdef NFS_DEBUG
458   - printf ("%s\n", __FUNCTION__);
459   -#endif
  449 + debug("%s\n", __func__);
460 450  
461 451 memcpy ((unsigned char *)&rpc_pkt, pkt, len);
462 452  
... ... @@ -480,9 +470,7 @@
480 470 {
481 471 struct rpc_t rpc_pkt;
482 472  
483   -#ifdef NFS_DEBUG
484   - printf ("%s\n", __FUNCTION__);
485   -#endif
  473 + debug("%s\n", __func__);
486 474  
487 475 memcpy ((unsigned char *)&rpc_pkt, pkt, len);
488 476  
... ... @@ -507,9 +495,7 @@
507 495 struct rpc_t rpc_pkt;
508 496 int rlen;
509 497  
510   -#ifdef NFS_DEBUG
511   - printf ("%s\n", __FUNCTION__);
512   -#endif
  498 + debug("%s\n", __func__);
513 499  
514 500 memcpy ((unsigned char *)&rpc_pkt, pkt, len);
515 501  
... ... @@ -544,9 +530,7 @@
544 530 struct rpc_t rpc_pkt;
545 531 int rlen;
546 532  
547   -#ifdef NFS_DEBUG_nop
548   - printf ("%s\n", __FUNCTION__);
549   -#endif
  533 + debug("%s\n", __func__);
550 534  
551 535 memcpy ((uchar *)&rpc_pkt, pkt, sizeof(rpc_pkt.u.reply));
552 536  
... ... @@ -601,9 +585,7 @@
601 585 {
602 586 int rlen;
603 587  
604   -#ifdef NFS_DEBUG
605   - printf ("%s\n", __FUNCTION__);
606   -#endif
  588 + debug("%s\n", __func__);
607 589  
608 590 if (dest != NfsOurPort) return;
609 591  
... ... @@ -661,9 +643,7 @@
661 643 NfsState = STATE_UMOUNT_REQ;
662 644 NfsSend ();
663 645 } else {
664   -#ifdef NFS_DEBUG
665   - printf ("Symlink --> %s\n", nfs_path);
666   -#endif
  646 + debug("Symlink --> %s\n", nfs_path);
667 647 nfs_filename = basename (nfs_path);
668 648 nfs_path = dirname (nfs_path);
669 649  
... ... @@ -696,9 +676,7 @@
696 676 void
697 677 NfsStart (void)
698 678 {
699   -#ifdef NFS_DEBUG
700   - printf ("%s\n", __FUNCTION__);
701   -#endif
  679 + debug("%s\n", __func__);
702 680 NfsDownloadState = NETLOOP_FAIL;
703 681  
704 682 NfsServerIP = NetServerIP;
... ... @@ -48,9 +48,7 @@
48 48 RarpHandler(uchar * dummi0, unsigned dummi1, unsigned dummi2, unsigned dummi3)
49 49 {
50 50 char *s;
51   -#ifdef DEBUG
52   - puts ("Got good RARP\n");
53   -#endif
  51 + debug("Got good RARP\n");
54 52 if ((s = getenv("autoload")) != NULL) {
55 53 if (*s == 'n') {
56 54 /*
... ... @@ -23,7 +23,7 @@
23 23 int pktlen = SNTP_PACKET_LEN;
24 24 int sport;
25 25  
26   - debug ("%s\n", __FUNCTION__);
  26 + debug("%s\n", __func__);
27 27  
28 28 memset (&pkt, 0, sizeof(pkt));
29 29  
... ... @@ -54,7 +54,7 @@
54 54 struct rtc_time tm;
55 55 ulong seconds;
56 56  
57   - debug ("%s\n", __FUNCTION__);
  57 + debug("%s\n", __func__);
58 58  
59 59 if (dest != SntpOurPort) return;
60 60  
... ... @@ -78,7 +78,7 @@
78 78 void
79 79 SntpStart (void)
80 80 {
81   - debug ("%s\n", __FUNCTION__);
  81 + debug("%s\n", __func__);
82 82  
83 83 NetSetTimeout (SNTP_TIMEOUT, SntpTimeout);
84 84 NetSetHandler(SntpHandler);
... ... @@ -10,8 +10,6 @@
10 10 #include "tftp.h"
11 11 #include "bootp.h"
12 12  
13   -#undef ET_DEBUG
14   -
15 13 #if defined(CONFIG_CMD_NET)
16 14  
17 15 #define WELL_KNOWN_PORT 69 /* Well known TFTP port # */
... ... @@ -196,9 +194,7 @@
196 194 strcpy ((char *)pkt, "timeout");
197 195 pkt += 7 /*strlen("timeout")*/ + 1;
198 196 sprintf((char *)pkt, "%lu", TIMEOUT / 1000);
199   -#ifdef ET_DEBUG
200   - printf("send option \"timeout %s\"\n", (char *)pkt);
201   -#endif
  197 + debug("send option \"timeout %s\"\n", (char *)pkt);
202 198 pkt += strlen((char *)pkt) + 1;
203 199 /* try for more effic. blk size */
204 200 pkt += sprintf((char *)pkt,"blksize%c%d%c",
... ... @@ -295,9 +291,7 @@
295 291 break;
296 292  
297 293 case TFTP_OACK:
298   -#ifdef ET_DEBUG
299   - printf("Got OACK: %s %s\n", pkt, pkt+strlen(pkt)+1);
300   -#endif
  294 + debug("Got OACK: %s %s\n", pkt, pkt+strlen(pkt)+1);
301 295 TftpState = STATE_OACK;
302 296 TftpServerPort = src;
303 297 /*
304 298  
... ... @@ -309,10 +303,8 @@
309 303 if (strcmp ((char*)pkt+i,"blksize") == 0) {
310 304 TftpBlkSize = (unsigned short)
311 305 simple_strtoul((char*)pkt+i+8,NULL,10);
312   -#ifdef ET_DEBUG
313   - printf ("Blocksize ack: %s, %d\n",
  306 + debug("Blocksize ack: %s, %d\n",
314 307 (char*)pkt+i+8,TftpBlkSize);
315   -#endif
316 308 break;
317 309 }
318 310 }
... ... @@ -348,11 +340,8 @@
348 340 }
349 341 }
350 342  
351   -#ifdef ET_DEBUG
352   - if (TftpState == STATE_RRQ) {
353   - puts ("Server did not acknowledge timeout option!\n");
354   - }
355   -#endif
  343 + if (TftpState == STATE_RRQ)
  344 + debug("Server did not acknowledge timeout option!\n");
356 345  
357 346 if (TftpState == STATE_RRQ || TftpState == STATE_OACK) {
358 347 /* first block received */