loader: dev_net.c should use __func__ with printf

We have printf calls with function name hardwired to string,
sometimes wrong name. Use __func__ instead.

MFC after:	1 week
This commit is contained in:
Toomas Soome 2021-09-24 17:07:20 +03:00
parent 1605eaa6d2
commit 1a25c51e38
1 changed files with 16 additions and 14 deletions

View File

@ -141,13 +141,14 @@ net_open(struct open_file *f, ...)
if (netdev_sock < 0) { if (netdev_sock < 0) {
netdev_sock = netif_open(dev); netdev_sock = netif_open(dev);
if (netdev_sock < 0) { if (netdev_sock < 0) {
printf("net_open: netif_open() failed\n"); printf("%s: netif_open() failed\n", __func__);
return (ENXIO); return (ENXIO);
} }
netdev_name = strdup(devname); netdev_name = strdup(devname);
#ifdef NETIF_DEBUG #ifdef NETIF_DEBUG
if (debug) if (debug)
printf("net_open: netif_open() succeeded\n"); printf("%s: netif_open() succeeded\n",
__func__);
#endif #endif
} }
/* /*
@ -202,7 +203,7 @@ net_close(struct open_file *f)
#ifdef NETIF_DEBUG #ifdef NETIF_DEBUG
if (debug) if (debug)
printf("net_close: opens=%d\n", netdev_opens); printf("%s: opens=%d\n", __func__, netdev_opens);
#endif #endif
f->f_devdata = NULL; f->f_devdata = NULL;
@ -217,7 +218,7 @@ net_cleanup(void)
if (netdev_sock >= 0) { if (netdev_sock >= 0) {
#ifdef NETIF_DEBUG #ifdef NETIF_DEBUG
if (debug) if (debug)
printf("net_cleanup: calling netif_close()\n"); printf("%s: calling netif_close()\n", __func__);
#endif #endif
rootip.s_addr = 0; rootip.s_addr = 0;
free(netdev_name); free(netdev_name);
@ -272,7 +273,7 @@ net_getparams(int sock)
goto exit; goto exit;
#ifdef NETIF_DEBUG #ifdef NETIF_DEBUG
if (debug) if (debug)
printf("net_open: BOOTP failed, trying RARP/RPC...\n"); printf("%s: BOOTP failed, trying RARP/RPC...\n", __func__);
#endif #endif
#endif #endif
@ -281,19 +282,19 @@ net_getparams(int sock)
* netmask to the "natural" default for our address. * netmask to the "natural" default for our address.
*/ */
if (rarp_getipaddress(sock)) { if (rarp_getipaddress(sock)) {
printf("net_open: RARP failed\n"); printf("%s: RARP failed\n", __func__);
return (EIO); return (EIO);
} }
printf("net_open: client addr: %s\n", inet_ntoa(myip)); printf("%s: client addr: %s\n", __func__, inet_ntoa(myip));
/* Get our hostname, server IP address, gateway. */ /* Get our hostname, server IP address, gateway. */
if (bp_whoami(sock)) { if (bp_whoami(sock)) {
printf("net_open: bootparam/whoami RPC failed\n"); printf("%s: bootparam/whoami RPC failed\n", __func__);
return (EIO); return (EIO);
} }
#ifdef NETIF_DEBUG #ifdef NETIF_DEBUG
if (debug) if (debug)
printf("net_open: client name: %s\n", hostname); printf("%s: client name: %s\n", __func__, hostname);
#endif #endif
/* /*
@ -310,17 +311,18 @@ net_getparams(int sock)
netmask = smask; netmask = smask;
#ifdef NETIF_DEBUG #ifdef NETIF_DEBUG
if (debug) if (debug)
printf("net_open: subnet mask: %s\n", intoa(netmask)); printf("%s: subnet mask: %s\n", __func__,
intoa(netmask));
#endif #endif
} }
#ifdef NETIF_DEBUG #ifdef NETIF_DEBUG
if (gateip.s_addr && debug) if (gateip.s_addr && debug)
printf("net_open: net gateway: %s\n", inet_ntoa(gateip)); printf("%s: net gateway: %s\n", __func__, inet_ntoa(gateip));
#endif #endif
/* Get the root server and pathname. */ /* Get the root server and pathname. */
if (bp_getfile(sock, "root", &rootip, rootpath)) { if (bp_getfile(sock, "root", &rootip, rootpath)) {
printf("net_open: bootparam/getfile RPC failed\n"); printf("%s: bootparam/getfile RPC failed\n", __func__);
return (EIO); return (EIO);
} }
exit: exit:
@ -329,8 +331,8 @@ exit:
#ifdef NETIF_DEBUG #ifdef NETIF_DEBUG
if (debug) { if (debug) {
printf("net_open: server addr: %s\n", inet_ntoa(rootip)); printf("%s: server addr: %s\n", __func__, inet_ntoa(rootip));
printf("net_open: server path: %s\n", rootpath); printf("%s: server path: %s\n", __func__, rootpath);
} }
#endif #endif