git: 34915d6871d0 - stable/12 - loader: dev_net.c should use __func__ with printf

From: Kyle Evans <kevans_at_FreeBSD.org>
Date: Fri, 08 Oct 2021 16:09:20 UTC
The branch stable/12 has been updated by kevans:

URL: https://cgit.FreeBSD.org/src/commit/?id=34915d6871d09448bac6d2f66bfd56340ae16fd5

commit 34915d6871d09448bac6d2f66bfd56340ae16fd5
Author:     Toomas Soome <tsoome@FreeBSD.org>
AuthorDate: 2021-09-24 14:07:20 +0000
Commit:     Kyle Evans <kevans@FreeBSD.org>
CommitDate: 2021-10-08 08:16:56 +0000

    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
    
    (cherry picked from commit 1a25c51e38a7c9f46ec195836233636616741f06)
---
 stand/common/dev_net.c | 30 ++++++++++++++++--------------
 1 file changed, 16 insertions(+), 14 deletions(-)

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