Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys split PRU_RCVD function out of pr_generic() usrreq switc...
details: https://anonhg.NetBSD.org/src/rev/44c6c1f95261
branches: trunk
changeset: 331301:44c6c1f95261
user: rtr <rtr%NetBSD.org@localhost>
date: Fri Aug 08 03:05:44 2014 +0000
description:
split PRU_RCVD function out of pr_generic() usrreq switches and put into
separate functions
- always KASSERT(solocked(so)) even if not implemented
- replace calls to pr_generic() with req = PRU_RCVD with calls to
pr_rcvd()
diffstat:
sys/dev/kttcp.c | 10 +--
sys/kern/uipc_socket.c | 10 +--
sys/kern/uipc_usrreq.c | 89 ++++++++++++++++++++----------------
sys/net/if_gre.c | 7 +-
sys/net/link_proto.c | 15 +++++-
sys/net/raw_usrreq.c | 9 +--
sys/net/rtsock.c | 14 ++++-
sys/netatalk/ddp_usrreq.c | 21 +++++---
sys/netbt/hci_socket.c | 18 +++++--
sys/netbt/l2cap_socket.c | 21 +++++---
sys/netbt/rfcomm.h | 6 +-
sys/netbt/rfcomm_socket.c | 28 +++++++---
sys/netbt/rfcomm_upper.c | 8 +-
sys/netbt/sco_socket.c | 18 +++++--
sys/netinet/raw_ip.c | 19 +++++--
sys/netinet/tcp_input.c | 6 +-
sys/netinet/tcp_usrreq.c | 56 ++++++++++++++++-------
sys/netinet/udp_usrreq.c | 19 +++++--
sys/netinet6/raw_ip6.c | 22 +++++---
sys/netinet6/udp6_usrreq.c | 18 +++++--
sys/netipsec/keysock.c | 15 +++++-
sys/netmpls/mpls_proto.c | 15 +++++-
sys/netnatm/natm.c | 60 ++++++++++++++++++++++--
sys/rump/net/lib/libsockin/sockin.c | 15 +++++-
sys/sys/protosw.h | 15 +++++-
25 files changed, 366 insertions(+), 168 deletions(-)
diffs (truncated from 1556 to 300 lines):
diff -r e9283485a422 -r 44c6c1f95261 sys/dev/kttcp.c
--- a/sys/dev/kttcp.c Fri Aug 08 02:27:40 2014 +0000
+++ b/sys/dev/kttcp.c Fri Aug 08 03:05:44 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kttcp.c,v 1.36 2014/08/05 07:55:31 rtr Exp $ */
+/* $NetBSD: kttcp.c,v 1.37 2014/08/08 03:05:44 rtr Exp $ */
/*
* Copyright (c) 2002 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kttcp.c,v 1.36 2014/08/05 07:55:31 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kttcp.c,v 1.37 2014/08/08 03:05:44 rtr Exp $");
#include <sys/param.h>
#include <sys/types.h>
@@ -635,8 +635,7 @@
* get it filled again.
*/
if ((pr->pr_flags & PR_WANTRCVD) && so->so_pcb) {
- (*pr->pr_usrreqs->pr_generic)(so, PRU_RCVD, NULL,
- (struct mbuf *)(long)flags, NULL, NULL);
+ (*pr->pr_usrreqs->pr_rcvd)(so, flags, l);
}
SBLASTRECORDCHK(&so->so_rcv,
"kttcp_soreceive sbwait 2");
@@ -675,8 +674,7 @@
SBLASTRECORDCHK(&so->so_rcv, "kttcp_soreceive 4");
SBLASTMBUFCHK(&so->so_rcv, "kttcp_soreceive 4");
if (pr->pr_flags & PR_WANTRCVD && so->so_pcb) {
- (*pr->pr_usrreqs->pr_generic)(so, PRU_RCVD, NULL,
- (struct mbuf *)(long)flags, NULL, NULL);
+ (*pr->pr_usrreqs->pr_rcvd)(so, flags, l);
}
}
if (orig_resid == resid && orig_resid &&
diff -r e9283485a422 -r 44c6c1f95261 sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c Fri Aug 08 02:27:40 2014 +0000
+++ b/sys/kern/uipc_socket.c Fri Aug 08 03:05:44 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_socket.c,v 1.232 2014/08/05 07:55:31 rtr Exp $ */
+/* $NetBSD: uipc_socket.c,v 1.233 2014/08/08 03:05:45 rtr Exp $ */
/*-
* Copyright (c) 2002, 2007, 2008, 2009 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.232 2014/08/05 07:55:31 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.233 2014/08/08 03:05:45 rtr Exp $");
#include "opt_compat_netbsd.h"
#include "opt_sock_counters.h"
@@ -1532,8 +1532,7 @@
* get it filled again.
*/
if ((pr->pr_flags & PR_WANTRCVD) && so->so_pcb)
- (*pr->pr_usrreqs->pr_generic)(so, PRU_RCVD,
- NULL, (struct mbuf *)(long)flags, NULL, l);
+ (*pr->pr_usrreqs->pr_rcvd)(so, flags, l);
SBLASTRECORDCHK(&so->so_rcv, "soreceive sbwait 2");
SBLASTMBUFCHK(&so->so_rcv, "soreceive sbwait 2");
if (wakeup_state & SS_RESTARTSYS)
@@ -1574,8 +1573,7 @@
SBLASTRECORDCHK(&so->so_rcv, "soreceive 4");
SBLASTMBUFCHK(&so->so_rcv, "soreceive 4");
if (pr->pr_flags & PR_WANTRCVD && so->so_pcb)
- (*pr->pr_usrreqs->pr_generic)(so, PRU_RCVD, NULL,
- (struct mbuf *)(long)flags, NULL, l);
+ (*pr->pr_usrreqs->pr_rcvd)(so, flags, l);
}
if (orig_resid == uio->uio_resid && orig_resid &&
(flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == 0) {
diff -r e9283485a422 -r 44c6c1f95261 sys/kern/uipc_usrreq.c
--- a/sys/kern/uipc_usrreq.c Fri Aug 08 02:27:40 2014 +0000
+++ b/sys/kern/uipc_usrreq.c Fri Aug 08 03:05:44 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_usrreq.c,v 1.167 2014/08/05 08:52:10 rtr Exp $ */
+/* $NetBSD: uipc_usrreq.c,v 1.168 2014/08/08 03:05:45 rtr Exp $ */
/*-
* Copyright (c) 1998, 2000, 2004, 2008, 2009 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.167 2014/08/05 08:52:10 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.168 2014/08/08 03:05:45 rtr Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -369,6 +369,52 @@
}
static int
+unp_rcvd(struct socket *so, int flags, struct lwp *l)
+{
+ struct unpcb *unp = sotounpcb(so);
+ struct socket *so2;
+ u_int newhiwat;
+
+ KASSERT(solocked(so));
+ KASSERT(unp != NULL);
+
+ switch (so->so_type) {
+
+ case SOCK_DGRAM:
+ panic("uipc 1");
+ /*NOTREACHED*/
+
+ case SOCK_SEQPACKET: /* FALLTHROUGH */
+ case SOCK_STREAM:
+#define rcv (&so->so_rcv)
+#define snd (&so2->so_snd)
+ if (unp->unp_conn == 0)
+ break;
+ so2 = unp->unp_conn->unp_socket;
+ KASSERT(solocked2(so, so2));
+ /*
+ * Adjust backpressure on sender
+ * and wakeup any waiting to write.
+ */
+ snd->sb_mbmax += unp->unp_mbcnt - rcv->sb_mbcnt;
+ unp->unp_mbcnt = rcv->sb_mbcnt;
+ newhiwat = snd->sb_hiwat + unp->unp_cc - rcv->sb_cc;
+ (void)chgsbsize(so2->so_uidinfo,
+ &snd->sb_hiwat, newhiwat, RLIM_INFINITY);
+ unp->unp_cc = rcv->sb_cc;
+ sowwakeup(so2);
+#undef snd
+#undef rcv
+ break;
+
+ default:
+ panic("uipc 2");
+ }
+
+ return 0;
+}
+
+static int
unp_recvoob(struct socket *so, struct mbuf *m, int flags)
{
KASSERT(solocked(so));
@@ -520,8 +566,6 @@
struct mbuf *control, struct lwp *l)
{
struct unpcb *unp;
- struct socket *so2;
- u_int newhiwat;
int error = 0;
KASSERT(req != PRU_ATTACH);
@@ -537,6 +581,7 @@
KASSERT(req != PRU_SENSE);
KASSERT(req != PRU_PEERADDR);
KASSERT(req != PRU_SOCKADDR);
+ KASSERT(req != PRU_RCVD);
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_SENDOOB);
@@ -555,41 +600,6 @@
error = unp_connect2(so, (struct socket *)nam, PRU_CONNECT2);
break;
- case PRU_RCVD:
- switch (so->so_type) {
-
- case SOCK_DGRAM:
- panic("uipc 1");
- /*NOTREACHED*/
-
- case SOCK_SEQPACKET: /* FALLTHROUGH */
- case SOCK_STREAM:
-#define rcv (&so->so_rcv)
-#define snd (&so2->so_snd)
- if (unp->unp_conn == 0)
- break;
- so2 = unp->unp_conn->unp_socket;
- KASSERT(solocked2(so, so2));
- /*
- * Adjust backpressure on sender
- * and wakeup any waiting to write.
- */
- snd->sb_mbmax += unp->unp_mbcnt - rcv->sb_mbcnt;
- unp->unp_mbcnt = rcv->sb_mbcnt;
- newhiwat = snd->sb_hiwat + unp->unp_cc - rcv->sb_cc;
- (void)chgsbsize(so2->so_uidinfo,
- &snd->sb_hiwat, newhiwat, RLIM_INFINITY);
- unp->unp_cc = rcv->sb_cc;
- sowwakeup(so2);
-#undef snd
-#undef rcv
- break;
-
- default:
- panic("uipc 2");
- }
- break;
-
default:
panic("piusrreq");
}
@@ -1925,6 +1935,7 @@
.pr_stat = unp_stat,
.pr_peeraddr = unp_peeraddr,
.pr_sockaddr = unp_sockaddr,
+ .pr_rcvd = unp_rcvd,
.pr_recvoob = unp_recvoob,
.pr_send = unp_send,
.pr_sendoob = unp_sendoob,
diff -r e9283485a422 -r 44c6c1f95261 sys/net/if_gre.c
--- a/sys/net/if_gre.c Fri Aug 08 02:27:40 2014 +0000
+++ b/sys/net/if_gre.c Fri Aug 08 03:05:44 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_gre.c,v 1.158 2014/08/05 07:55:31 rtr Exp $ */
+/* $NetBSD: if_gre.c,v 1.159 2014/08/08 03:05:45 rtr Exp $ */
/*
* Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.158 2014/08/05 07:55:31 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gre.c,v 1.159 2014/08/08 03:05:45 rtr Exp $");
#include "opt_atalk.h"
#include "opt_gre.h"
@@ -724,8 +724,7 @@
SBLASTRECORDCHK(&so->so_rcv, "soreceive 4");
SBLASTMBUFCHK(&so->so_rcv, "soreceive 4");
if (pr->pr_flags & PR_WANTRCVD && so->so_pcb)
- (*pr->pr_usrreqs->pr_generic)(so, PRU_RCVD, NULL,
- (struct mbuf *)(long)flags, NULL, curlwp);
+ (*pr->pr_usrreqs->pr_rcvd)(so, flags, curlwp);
if (*mp0 == NULL && (flags & MSG_EOR) == 0 &&
(so->so_state & SS_CANTRCVMORE) == 0) {
sbunlock(&so->so_rcv);
diff -r e9283485a422 -r 44c6c1f95261 sys/net/link_proto.c
--- a/sys/net/link_proto.c Fri Aug 08 02:27:40 2014 +0000
+++ b/sys/net/link_proto.c Fri Aug 08 03:05:44 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: link_proto.c,v 1.22 2014/08/05 07:55:31 rtr Exp $ */
+/* $NetBSD: link_proto.c,v 1.23 2014/08/08 03:05:45 rtr Exp $ */
/*-
* Copyright (c) 1982, 1986, 1993
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.22 2014/08/05 07:55:31 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.23 2014/08/08 03:05:45 rtr Exp $");
#include <sys/param.h>
#include <sys/socket.h>
@@ -61,6 +61,7 @@
static int link_stat(struct socket *, struct stat *);
static int link_peeraddr(struct socket *, struct mbuf *);
static int link_sockaddr(struct socket *, struct mbuf *);
+static int link_rcvd(struct socket *, int, struct lwp *);
static int link_recvoob(struct socket *, struct mbuf *, int);
static int link_send(struct socket *, struct mbuf *, struct mbuf *,
struct mbuf *, struct lwp *);
@@ -89,6 +90,7 @@
.pr_stat = link_stat,
.pr_peeraddr = link_peeraddr,
.pr_sockaddr = link_sockaddr,
+ .pr_rcvd = link_rcvd,
.pr_recvoob = link_recvoob,
.pr_send = link_send,
.pr_sendoob = link_sendoob,
@@ -346,6 +348,14 @@
}
static int
+link_rcvd(struct socket *so, int flags, struct lwp *l)
+{
+ KASSERT(solocked(so));
+
+ return EOPNOTSUPP;
+}
+
+static int
link_recvoob(struct socket *so, struct mbuf *m, int flags)
{
KASSERT(solocked(so));
@@ -387,6 +397,7 @@
KASSERT(req != PRU_SENSE);
KASSERT(req != PRU_PEERADDR);
KASSERT(req != PRU_SOCKADDR);
+ KASSERT(req != PRU_RCVD);
KASSERT(req != PRU_RCVOOB);
KASSERT(req != PRU_SEND);
KASSERT(req != PRU_SENDOOB);
diff -r e9283485a422 -r 44c6c1f95261 sys/net/raw_usrreq.c
Home |
Main Index |
Thread Index |
Old Index