git: a0da2f73b6ef - main - Remove remaining mentions of pr_usrreq.

From: Dag-Erling Smørgrav <des_at_FreeBSD.org>
Date: Thu, 08 May 2025 14:29:39 UTC
The branch main has been updated by des:

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

commit a0da2f73b6ef12db95d5391d380b0b04507b4778
Author:     Dag-Erling Smørgrav <des@FreeBSD.org>
AuthorDate: 2025-05-08 14:28:39 +0000
Commit:     Dag-Erling Smørgrav <des@FreeBSD.org>
CommitDate: 2025-05-08 14:29:15 +0000

    Remove remaining mentions of pr_usrreq.
    
    When struct pr_usrreq was folded into struct protosw and the function
    pointers it contained were renamed from pru_* to pr_* in 2022, a
    number of references to the old names in comments and error messages
    were missed.  Chase them down and fix them.
    
    Sponsored by:   Klara, Inc.
    Sponsored by:   NetApp, Inc.
    Reviewed by:    kevans, glebius
    Differential Revision:  https://reviews.freebsd.org/D50190
---
 sys/dev/hyperv/hvsock/hv_sock.c                    |  2 +-
 sys/kern/kern_sendfile.c                           |  4 ++--
 sys/kern/uipc_socket.c                             | 26 +++++++++++-----------
 sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c  |  4 ++--
 sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c |  2 +-
 sys/netgraph/bluetooth/socket/ng_btsocket_sco.c    |  4 ++--
 sys/netinet/tcp_usrreq.c                           |  6 ++---
 sys/netinet/tcp_var.h                              |  9 --------
 sys/netinet/toecore.c                              |  2 +-
 sys/netinet/toecore.h                              |  2 +-
 10 files changed, 26 insertions(+), 35 deletions(-)

diff --git a/sys/dev/hyperv/hvsock/hv_sock.c b/sys/dev/hyperv/hvsock/hv_sock.c
index 8072765f2d5b..5a69eaa2b47b 100644
--- a/sys/dev/hyperv/hvsock/hv_sock.c
+++ b/sys/dev/hyperv/hvsock/hv_sock.c
@@ -1461,7 +1461,7 @@ hvsock_open_conn_passive(struct vmbus_channel *chan, struct socket *so,
 	}
 
 	/*
-	 * Create a new socket. This will call pru_attach to complete
+	 * Create a new socket. This will call pr_attach() to complete
 	 * the socket initialization and put the new socket onto
 	 * listening socket's sol_incomp list, waiting to be promoted
 	 * to sol_comp list.
diff --git a/sys/kern/kern_sendfile.c b/sys/kern/kern_sendfile.c
index cfacfe40b832..25c1f357dfd4 100644
--- a/sys/kern/kern_sendfile.c
+++ b/sys/kern/kern_sendfile.c
@@ -83,7 +83,7 @@ static MALLOC_DEFINE(M_SENDFILE, "sendfile", "sendfile dynamic memory");
  * Every I/O completion calls sendfile_iodone(), which decrements the 'nios',
  * and the syscall also calls sendfile_iodone() after allocating all mbufs,
  * linking them and sending to socket.  Whoever reaches zero 'nios' is
- * responsible to * call pru_ready on the socket, to notify it of readyness
+ * responsible to call pr_ready() on the socket, to notify it of readyness
  * of the data.
  */
 struct sf_io {
@@ -353,7 +353,7 @@ sendfile_iodone(void *arg, vm_page_t *pa, int count, int error)
 		 * Either I/O operation failed, or we failed to allocate
 		 * buffers, or we bailed out on first busy page, or we
 		 * succeeded filling the request without any I/Os. Anyway,
-		 * pru_send hadn't been executed - nothing had been sent
+		 * pr_send() hadn't been executed - nothing had been sent
 		 * to the socket yet.
 		 */
 		MPASS((curthread->td_pflags & TDP_KTHREAD) == 0);
diff --git a/sys/kern/uipc_socket.c b/sys/kern/uipc_socket.c
index 03a2c532f053..d478b09ca71c 100644
--- a/sys/kern/uipc_socket.c
+++ b/sys/kern/uipc_socket.c
@@ -41,18 +41,18 @@
  * sodealloc() tears down socket layer state for a socket, called only by
  * sofree() and sonewconn().  Socket layer private.
  *
- * pru_attach() associates protocol layer state with an allocated socket;
+ * pr_attach() associates protocol layer state with an allocated socket;
  * called only once, may fail, aborting socket allocation.  This is called
  * from socreate() and sonewconn().  Socket layer private.
  *
- * pru_detach() disassociates protocol layer state from an attached socket,
- * and will be called exactly once for sockets in which pru_attach() has
- * been successfully called.  If pru_attach() returned an error,
- * pru_detach() will not be called.  Socket layer private.
+ * pr_detach() disassociates protocol layer state from an attached socket,
+ * and will be called exactly once for sockets in which pr_attach() has
+ * been successfully called.  If pr_attach() returned an error,
+ * pr_detach() will not be called.  Socket layer private.
  *
- * pru_abort() and pru_close() notify the protocol layer that the last
+ * pr_abort() and pr_close() notify the protocol layer that the last
  * consumer of a socket is starting to tear down the socket, and that the
- * protocol should terminate the connection.  Historically, pru_abort() also
+ * protocol should terminate the connection.  Historically, pr_abort() also
  * detached protocol state from the socket state, but this is no longer the
  * case.
  *
@@ -969,7 +969,7 @@ socreate(int dom, struct socket **aso, int type, int proto,
 	}
 	/*
 	 * Auto-sizing of socket buffers is managed by the protocols and
-	 * the appropriate flags must be set in the pru_attach function.
+	 * the appropriate flags must be set in the pr_attach() method.
 	 */
 	CURVNET_SET(so->so_vnet);
 	error = prp->pr_attach(so, proto, td);
@@ -1338,9 +1338,9 @@ sopeeloff(struct socket *head)
 		    __func__, head->so_pcb);
 		return (NULL);
 	}
-	if ((*so->so_proto->pr_attach)(so, 0, NULL)) {
+	if (so->so_proto->pr_attach(so, 0, NULL)) {
 		sodealloc(so);
-		log(LOG_DEBUG, "%s: pcb %p: pru_attach() failed\n",
+		log(LOG_DEBUG, "%s: pcb %p: pr_attach() failed\n",
 		    __func__, head->so_pcb);
 		return (NULL);
 	}
@@ -3826,7 +3826,7 @@ sosetopt(struct socket *so, struct sockopt *sopt)
 	CURVNET_SET(so->so_vnet);
 	error = 0;
 	if (sopt->sopt_level != SOL_SOCKET) {
-		error = (*so->so_proto->pr_ctloutput)(so, sopt);
+		error = so->so_proto->pr_ctloutput(so, sopt);
 	} else {
 		switch (sopt->sopt_name) {
 		case SO_ACCEPTFILTER:
@@ -4037,7 +4037,7 @@ sosetopt(struct socket *so, struct sockopt *sopt)
 			break;
 		}
 		if (error == 0)
-			(void)(*so->so_proto->pr_ctloutput)(so, sopt);
+			(void)so->so_proto->pr_ctloutput(so, sopt);
 	}
 bad:
 	CURVNET_RESTORE();
@@ -4087,7 +4087,7 @@ sogetopt(struct socket *so, struct sockopt *sopt)
 	CURVNET_SET(so->so_vnet);
 	error = 0;
 	if (sopt->sopt_level != SOL_SOCKET) {
-		error = (*so->so_proto->pr_ctloutput)(so, sopt);
+		error = so->so_proto->pr_ctloutput(so, sopt);
 		CURVNET_RESTORE();
 		return (error);
 	} else {
diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
index 9fc26f53e9c6..1f0c5f1b4751 100644
--- a/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
+++ b/sys/netgraph/bluetooth/socket/ng_btsocket_l2cap.c
@@ -1984,7 +1984,7 @@ ng_btsocket_l2cap_attach(struct socket *so, int proto, struct thread *td)
 	if (so->so_type != SOCK_SEQPACKET)
 		return (ESOCKTNOSUPPORT);
 
-#if 0 /* XXX sonewconn() calls "pru_attach" with proto == 0 */
+#if 0 /* XXX sonewconn() calls pr_attach() with proto == 0 */
 	if (proto != 0) 
 		if (proto != BLUETOOTH_PROTO_L2CAP)
 			return (EPROTONOSUPPORT);
@@ -2055,7 +2055,7 @@ ng_btsocket_l2cap_attach(struct socket *so, int proto, struct thread *td)
 	 * In the second case we hold ng_btsocket_l2cap_sockets_mtx already.
 	 * So we now need to distinguish between these cases. From reading
 	 * /sys/kern/uipc_socket.c we can find out that sonewconn() calls
-	 * pru_attach with proto == 0 and td == NULL. For now use this fact
+	 * pr_attach() with proto == 0 and td == NULL. For now use this fact
 	 * to figure out if we were called from socket() or from sonewconn().
 	 */
 
diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c b/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
index 4780227a66f1..6c0a6fda1fb1 100644
--- a/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
+++ b/sys/netgraph/bluetooth/socket/ng_btsocket_rfcomm.c
@@ -384,7 +384,7 @@ ng_btsocket_rfcomm_attach(struct socket *so, int proto, struct thread *td)
 	if (so->so_type != SOCK_STREAM)
 		return (ESOCKTNOSUPPORT);
 
-#if 0 /* XXX sonewconn() calls "pru_attach" with proto == 0 */
+#if 0 /* XXX sonewconn() calls pr_attach() with proto == 0 */
 	if (proto != 0) 
 		if (proto != BLUETOOTH_PROTO_RFCOMM)
 			return (EPROTONOSUPPORT);
diff --git a/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c b/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c
index 115dd6d87ec4..400ec05c87eb 100644
--- a/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c
+++ b/sys/netgraph/bluetooth/socket/ng_btsocket_sco.c
@@ -1192,7 +1192,7 @@ ng_btsocket_sco_attach(struct socket *so, int proto, struct thread *td)
 	if (so->so_type != SOCK_SEQPACKET)
 		return (ESOCKTNOSUPPORT);
 
-#if 0 /* XXX sonewconn() calls "pru_attach" with proto == 0 */
+#if 0 /* XXX sonewconn() calls pr_attach() with proto == 0 */
 	if (proto != 0) 
 		if (proto != BLUETOOTH_PROTO_SCO)
 			return (EPROTONOSUPPORT);
@@ -1247,7 +1247,7 @@ ng_btsocket_sco_attach(struct socket *so, int proto, struct thread *td)
 	 * In the second case we hold ng_btsocket_sco_sockets_mtx already.
 	 * So we now need to distinguish between these cases. From reading
 	 * /sys/kern/uipc_socket2.c we can find out that sonewconn() calls
-	 * pru_attach with proto == 0 and td == NULL. For now use this fact
+	 * pr_attach() with proto == 0 and td == NULL. For now use this fact
 	 * to figure out if we were called from socket() or from sonewconn().
 	 */
 
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index c64d25f0fa87..61ca29dc0ad2 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -146,7 +146,7 @@ tcp_bblog_pru(struct tcpcb *tp, uint32_t pru, int error)
 }
 
 /*
- * TCP attaches to socket via pru_attach(), reserving space,
+ * TCP attaches to socket via pr_attach(), reserving space,
  * and an internet control block.
  */
 static int
@@ -907,8 +907,8 @@ out:
 /*
  * Do a send by putting data in output queue and updating urgent
  * marker if URG set.  Possibly send more data.  Unlike the other
- * pru_*() routines, the mbuf chains are our responsibility.  We
- * must either enqueue them or free them.  The other pru_* routines
+ * pr_*() routines, the mbuf chains are our responsibility.  We
+ * must either enqueue them or free them.  The other pr_*() routines
  * generally are caller-frees.
  */
 static int
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index 5be024ededc7..ddc701581f90 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -528,15 +528,6 @@ typedef enum {
 /* Minimum map entries limit value, if set */
 #define TCP_MIN_MAP_ENTRIES_LIMIT	128
 
-/*
- * TODO: We yet need to brave plowing in
- * to tcp_input() and the pru_usrreq() block.
- * Right now these go to the old standards which
- * are somewhat ok, but in the long term may
- * need to be changed. If we do tackle tcp_input()
- * then we need to get rid of the tcp_do_segment()
- * function below.
- */
 /* Flags for tcp functions */
 #define	TCP_FUNC_BEING_REMOVED	0x01   	/* Can no longer be referenced */
 #define	TCP_FUNC_OUTPUT_CANDROP	0x02   	/* tfb_tcp_output may ask tcp_drop */
diff --git a/sys/netinet/toecore.c b/sys/netinet/toecore.c
index 76aadad9a3b9..4203029ff7c3 100644
--- a/sys/netinet/toecore.c
+++ b/sys/netinet/toecore.c
@@ -525,7 +525,7 @@ toe_connect_failed(struct toedev *tod, struct inpcb *inp, int err)
 			/*
 			 * Temporary failure during offload, take this PCB back.
 			 * Detach from the TOE driver and do the rest of what
-			 * TCP's pru_connect would have done if the connection
+			 * TCP's pr_connect() would have done if the connection
 			 * wasn't offloaded.
 			 */
 
diff --git a/sys/netinet/toecore.h b/sys/netinet/toecore.h
index 612c2fe1caf5..843b261ec162 100644
--- a/sys/netinet/toecore.h
+++ b/sys/netinet/toecore.h
@@ -66,7 +66,7 @@ struct toedev {
 	void (*tod_input)(struct toedev *, struct tcpcb *, struct mbuf *);
 
 	/*
-	 * This is called by the kernel during pru_rcvd for an offloaded TCP
+	 * This is called by the kernel during pr_rcvd() for an offloaded TCP
 	 * connection and provides an opportunity for the TOE driver to manage
 	 * its rx window and credits.
 	 */