From 61cf011a4e1aa4221a5e8757b87547fcae4bb1d7 Mon Sep 17 00:00:00 2001 From: mvs Date: Tue, 13 Sep 2022 09:05:47 +0000 Subject: [PATCH] Change pru_rcvd() return type to the type of void. We have no interest on pru_rcvd() return value. Drop "pru_rcvd != NULL" check within pru_rcvd() wrapper. We only call it if the socket's protocol have PR_WANTRCVD flag set. Such sockets are route domain, tcp(4) and unix(4) sockets. ok guenther@ bluhm@ --- sys/kern/uipc_usrreq.c | 6 ++---- sys/net/rtsock.c | 8 +++----- sys/netinet/tcp_usrreq.c | 10 ++++------ sys/netinet/tcp_var.h | 4 ++-- sys/sys/protosw.h | 10 ++++------ sys/sys/unpcb.h | 4 ++-- 6 files changed, 17 insertions(+), 25 deletions(-) diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c index 296d8500bf3..e3f50945593 100644 --- a/sys/kern/uipc_usrreq.c +++ b/sys/kern/uipc_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: uipc_usrreq.c,v 1.185 2022/09/03 22:43:38 mvs Exp $ */ +/* $OpenBSD: uipc_usrreq.c,v 1.186 2022/09/13 09:05:47 mvs Exp $ */ /* $NetBSD: uipc_usrreq.c,v 1.18 1996/02/09 19:00:50 christos Exp $ */ /* @@ -363,7 +363,7 @@ uipc_shutdown(struct socket *so) return (0); } -int +void uipc_rcvd(struct socket *so) { struct socket *so2; @@ -390,8 +390,6 @@ uipc_rcvd(struct socket *so) default: panic("uipc 2"); } - - return (0); } int diff --git a/sys/net/rtsock.c b/sys/net/rtsock.c index f979e90f73f..8da802643e4 100644 --- a/sys/net/rtsock.c +++ b/sys/net/rtsock.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rtsock.c,v 1.355 2022/09/08 10:22:06 kn Exp $ */ +/* $OpenBSD: rtsock.c,v 1.356 2022/09/13 09:05:47 mvs Exp $ */ /* $NetBSD: rtsock.c,v 1.18 1996/03/29 00:32:10 cgd Exp $ */ /* @@ -115,7 +115,7 @@ int route_attach(struct socket *, int); int route_detach(struct socket *); int route_disconnect(struct socket *); int route_shutdown(struct socket *); -int route_rcvd(struct socket *); +void route_rcvd(struct socket *); int route_send(struct socket *, struct mbuf *, struct mbuf *, struct mbuf *); int route_abort(struct socket *); @@ -299,7 +299,7 @@ route_shutdown(struct socket *so) return (0); } -int +void route_rcvd(struct socket *so) { struct rtpcb *rop = sotortpcb(so); @@ -314,8 +314,6 @@ route_rcvd(struct socket *so) ((sbspace(rop->rop_socket, &rop->rop_socket->so_rcv) == rop->rop_socket->so_rcv.sb_hiwat))) rop->rop_flags &= ~ROUTECB_FLAG_FLUSH; - - return (0); } int diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 0edab7d6a7f..7968aacbe3a 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_usrreq.c,v 1.207 2022/09/03 22:43:38 mvs Exp $ */ +/* $OpenBSD: tcp_usrreq.c,v 1.208 2022/09/13 09:05:47 mvs Exp $ */ /* $NetBSD: tcp_usrreq.c,v 1.20 1996/02/13 23:44:16 christos Exp $ */ /* @@ -792,18 +792,17 @@ out: /* * After a receive, possibly send window update to peer. */ -int +void tcp_rcvd(struct socket *so) { struct inpcb *inp; struct tcpcb *tp; - int error; short ostate; soassertlocked(so); - if ((error = tcp_sogetpcb(so, &inp, &tp))) - return (error); + if (tcp_sogetpcb(so, &inp, &tp)) + return; if (so->so_options & SO_DEBUG) ostate = tp->t_state; @@ -820,7 +819,6 @@ tcp_rcvd(struct socket *so) if (so->so_options & SO_DEBUG) tcp_trace(TA_USER, ostate, tp, tp, NULL, PRU_RCVD, 0); - return (0); } /* diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h index cd6bb75fc5c..7939cb3f7e1 100644 --- a/sys/netinet/tcp_var.h +++ b/sys/netinet/tcp_var.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_var.h,v 1.157 2022/09/03 22:43:38 mvs Exp $ */ +/* $OpenBSD: tcp_var.h,v 1.158 2022/09/13 09:05:47 mvs Exp $ */ /* $NetBSD: tcp_var.h,v 1.17 1996/02/13 23:44:24 christos Exp $ */ /* @@ -725,7 +725,7 @@ int tcp_connect(struct socket *, struct mbuf *); int tcp_accept(struct socket *, struct mbuf *); int tcp_disconnect(struct socket *); int tcp_shutdown(struct socket *); -int tcp_rcvd(struct socket *); +void tcp_rcvd(struct socket *); int tcp_send(struct socket *, struct mbuf *, struct mbuf *, struct mbuf *); int tcp_abort(struct socket *); diff --git a/sys/sys/protosw.h b/sys/sys/protosw.h index 34eef0b441b..00a6c754a4f 100644 --- a/sys/sys/protosw.h +++ b/sys/sys/protosw.h @@ -1,4 +1,4 @@ -/* $OpenBSD: protosw.h,v 1.55 2022/09/05 14:56:09 bluhm Exp $ */ +/* $OpenBSD: protosw.h,v 1.56 2022/09/13 09:05:47 mvs Exp $ */ /* $NetBSD: protosw.h,v 1.10 1996/04/09 20:55:32 cgd Exp $ */ /*- @@ -72,7 +72,7 @@ struct pr_usrreqs { int (*pru_accept)(struct socket *, struct mbuf *); int (*pru_disconnect)(struct socket *); int (*pru_shutdown)(struct socket *); - int (*pru_rcvd)(struct socket *); + void (*pru_rcvd)(struct socket *); int (*pru_send)(struct socket *, struct mbuf *, struct mbuf *, struct mbuf *); int (*pru_abort)(struct socket *); @@ -336,12 +336,10 @@ pru_shutdown(struct socket *so) return (*so->so_proto->pr_usrreqs->pru_shutdown)(so); } -static inline int +static inline void pru_rcvd(struct socket *so) { - if (so->so_proto->pr_usrreqs->pru_rcvd) - return (*so->so_proto->pr_usrreqs->pru_rcvd)(so); - return (EOPNOTSUPP); + (*so->so_proto->pr_usrreqs->pru_rcvd)(so); } static inline int diff --git a/sys/sys/unpcb.h b/sys/sys/unpcb.h index ec5a5fd4217..b4f2681bacd 100644 --- a/sys/sys/unpcb.h +++ b/sys/sys/unpcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: unpcb.h,v 1.40 2022/09/03 22:43:39 mvs Exp $ */ +/* $OpenBSD: unpcb.h,v 1.41 2022/09/13 09:05:47 mvs Exp $ */ /* $NetBSD: unpcb.h,v 1.6 1994/06/29 06:46:08 cgd Exp $ */ /* @@ -120,7 +120,7 @@ int uipc_connect(struct socket *, struct mbuf *); int uipc_accept(struct socket *, struct mbuf *); int uipc_disconnect(struct socket *); int uipc_shutdown(struct socket *); -int uipc_rcvd(struct socket *); +void uipc_rcvd(struct socket *); int uipc_send(struct socket *, struct mbuf *, struct mbuf *, struct mbuf *); int uipc_abort(struct socket *); -- 2.20.1