Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys split PRU_CONNECT function out of pr_generic() usrreq sw...
details: https://anonhg.NetBSD.org/src/rev/d63571b5d387
branches: trunk
changeset: 797829:d63571b5d387
user: rtr <rtr%NetBSD.org@localhost>
date: Wed Jul 30 10:04:25 2014 +0000
description:
split PRU_CONNECT function out of pr_generic() usrreq switches and put
into seaparate functions
xxx_listen(struct socket *, struct mbuf *)
- always KASSERT(solocked(so)) and KASSERT(nam != NULL)
- replace calls to pr_generic() with req = PRU_CONNECT with
pr_connect()
- rename existin {l2cap,sco,rfcomm}_connect() to
{l2cap,sco,rfcomm}_connect_pcb() respectively to permit
naming consistency with other protocols functions.
- drop struct lwp * parameter from unp_connect() and at_pcbconnect()
and use curlwp instead where appropriate.
patch reviewed by rmind
diffstat:
sys/dev/bluetooth/bthidev.c | 10 +-
sys/dev/bluetooth/btmagic.c | 10 +-
sys/dev/bluetooth/btsco.c | 6 +-
sys/kern/uipc_socket.c | 7 +-
sys/kern/uipc_usrreq.c | 23 ++--
sys/net/raw_usrreq.c | 6 +-
sys/net/rtsock.c | 14 ++-
sys/netatalk/ddp_usrreq.c | 42 +++++---
sys/netbt/hci_socket.c | 49 ++++++----
sys/netbt/l2cap.h | 6 +-
sys/netbt/l2cap_socket.c | 44 ++++++---
sys/netbt/l2cap_upper.c | 8 +-
sys/netbt/rfcomm.h | 6 +-
sys/netbt/rfcomm_socket.c | 44 ++++++---
sys/netbt/rfcomm_upper.c | 10 +-
sys/netbt/sco.h | 4 +-
sys/netbt/sco_socket.c | 44 ++++++---
sys/netbt/sco_upper.c | 8 +-
sys/netinet/raw_ip.c | 41 ++++++--
sys/netinet/tcp_usrreq.c | 163 ++++++++++++++++++++---------------
sys/netinet/udp_usrreq.c | 32 +++++-
sys/netinet6/raw_ip6.c | 116 +++++++++++++------------
sys/netinet6/udp6_usrreq.c | 40 +++++---
sys/netipsec/keysock.c | 15 ++-
sys/netmpls/mpls_proto.c | 14 ++-
sys/netnatm/natm.c | 151 +++++++++++++++++----------------
sys/rump/net/lib/libsockin/sockin.c | 31 ++++-
sys/sys/protosw.h | 12 ++-
sys/sys/un.h | 4 +-
29 files changed, 574 insertions(+), 386 deletions(-)
diffs (truncated from 2109 to 300 lines):
diff -r 0fcbdeb6d667 -r d63571b5d387 sys/dev/bluetooth/bthidev.c
--- a/sys/dev/bluetooth/bthidev.c Wed Jul 30 07:44:00 2014 +0000
+++ b/sys/dev/bluetooth/bthidev.c Wed Jul 30 10:04:25 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bthidev.c,v 1.26 2014/07/24 15:12:03 rtr Exp $ */
+/* $NetBSD: bthidev.c,v 1.27 2014/07/30 10:04:25 rtr Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.26 2014/07/24 15:12:03 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bthidev.c,v 1.27 2014/07/30 10:04:25 rtr Exp $");
#include <sys/param.h>
#include <sys/condvar.h>
@@ -577,9 +577,9 @@
sa.bt_psm = sc->sc_ctlpsm;
bdaddr_copy(&sa.bt_bdaddr, &sc->sc_raddr);
- err = l2cap_connect(sc->sc_ctl, &sa);
+ err = l2cap_connect_pcb(sc->sc_ctl, &sa);
if (err) {
- aprint_error_dev(sc->sc_dev, "l2cap_connect failed (%d)\n", err);
+ aprint_error_dev(sc->sc_dev, "l2cap_connect_pcb failed (%d)\n", err);
return err;
}
@@ -753,7 +753,7 @@
sa.bt_psm = sc->sc_intpsm;
bdaddr_copy(&sa.bt_bdaddr, &sc->sc_raddr);
- err = l2cap_connect(sc->sc_int, &sa);
+ err = l2cap_connect_pcb(sc->sc_int, &sa);
if (err)
goto fail;
}
diff -r 0fcbdeb6d667 -r d63571b5d387 sys/dev/bluetooth/btmagic.c
--- a/sys/dev/bluetooth/btmagic.c Wed Jul 30 07:44:00 2014 +0000
+++ b/sys/dev/bluetooth/btmagic.c Wed Jul 30 10:04:25 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: btmagic.c,v 1.8 2014/07/24 15:12:03 rtr Exp $ */
+/* $NetBSD: btmagic.c,v 1.9 2014/07/30 10:04:25 rtr Exp $ */
/*-
* Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -85,7 +85,7 @@
*****************************************************************************/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: btmagic.c,v 1.8 2014/07/24 15:12:03 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btmagic.c,v 1.9 2014/07/30 10:04:25 rtr Exp $");
#include <sys/param.h>
#include <sys/conf.h>
@@ -543,9 +543,9 @@
sa.bt_psm = L2CAP_PSM_HID_CNTL;
bdaddr_copy(&sa.bt_bdaddr, &sc->sc_raddr);
- err = l2cap_connect(sc->sc_ctl, &sa);
+ err = l2cap_connect_pcb(sc->sc_ctl, &sa);
if (err) {
- printf("%s: l2cap_connect failed (%d)\n",
+ printf("%s: l2cap_connect_pcb failed (%d)\n",
device_xname(sc->sc_dev), err);
return err;
}
@@ -830,7 +830,7 @@
sa.bt_psm = L2CAP_PSM_HID_INTR;
bdaddr_copy(&sa.bt_bdaddr, &sc->sc_raddr);
- err = l2cap_connect(sc->sc_int, &sa);
+ err = l2cap_connect_pcb(sc->sc_int, &sa);
if (err)
goto fail;
}
diff -r 0fcbdeb6d667 -r d63571b5d387 sys/dev/bluetooth/btsco.c
--- a/sys/dev/bluetooth/btsco.c Wed Jul 30 07:44:00 2014 +0000
+++ b/sys/dev/bluetooth/btsco.c Wed Jul 30 10:04:25 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: btsco.c,v 1.30 2014/07/24 15:12:03 rtr Exp $ */
+/* $NetBSD: btsco.c,v 1.31 2014/07/30 10:04:25 rtr Exp $ */
/*-
* Copyright (c) 2006 Itronix Inc.
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: btsco.c,v 1.30 2014/07/24 15:12:03 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: btsco.c,v 1.31 2014/07/30 10:04:25 rtr Exp $");
#include <sys/param.h>
#include <sys/audioio.h>
@@ -617,7 +617,7 @@
}
bdaddr_copy(&sa.bt_bdaddr, &sc->sc_raddr);
- err = sco_connect(sc->sc_sco, &sa);
+ err = sco_connect_pcb(sc->sc_sco, &sa);
if (err) {
sco_detach_pcb(&sc->sc_sco);
goto done;
diff -r 0fcbdeb6d667 -r d63571b5d387 sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c Wed Jul 30 07:44:00 2014 +0000
+++ b/sys/kern/uipc_socket.c Wed Jul 30 10:04:25 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_socket.c,v 1.227 2014/07/24 15:12:03 rtr Exp $ */
+/* $NetBSD: uipc_socket.c,v 1.228 2014/07/30 10:04:26 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.227 2014/07/24 15:12:03 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.228 2014/07/30 10:04:26 rtr Exp $");
#include "opt_compat_netbsd.h"
#include "opt_sock_counters.h"
@@ -827,8 +827,7 @@
(error = sodisconnect(so))))
error = EISCONN;
else
- error = (*so->so_proto->pr_usrreqs->pr_generic)(so,
- PRU_CONNECT, NULL, nam, NULL, l);
+ error = (*so->so_proto->pr_usrreqs->pr_connect)(so, nam);
return error;
}
diff -r 0fcbdeb6d667 -r d63571b5d387 sys/kern/uipc_usrreq.c
--- a/sys/kern/uipc_usrreq.c Wed Jul 30 07:44:00 2014 +0000
+++ b/sys/kern/uipc_usrreq.c Wed Jul 30 10:04:25 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_usrreq.c,v 1.161 2014/07/24 15:12:03 rtr Exp $ */
+/* $NetBSD: uipc_usrreq.c,v 1.162 2014/07/30 10:04:26 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.161 2014/07/24 15:12:03 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.162 2014/07/30 10:04:26 rtr Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -398,6 +398,7 @@
KASSERT(req != PRU_ACCEPT);
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
+ KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONTROL);
KASSERT(req != PRU_SENSE);
KASSERT(req != PRU_PEERADDR);
@@ -415,11 +416,6 @@
}
switch (req) {
- case PRU_CONNECT:
- KASSERT(l != NULL);
- error = unp_connect(so, nam, l);
- break;
-
case PRU_CONNECT2:
error = unp_connect2(so, (struct socket *)nam, PRU_CONNECT2);
break;
@@ -502,7 +498,7 @@
* intervening control ops, like
* another connection.
*/
- error = unp_connect(so, nam, l);
+ error = unp_connect(so, nam);
}
} else {
if ((so->so_state & SS_ISCONNECTED) == 0)
@@ -1044,7 +1040,7 @@
}
int
-unp_connect(struct socket *so, struct mbuf *nam, struct lwp *l)
+unp_connect(struct socket *so, struct mbuf *nam)
{
struct sockaddr_un *sun;
vnode_t *vp;
@@ -1085,7 +1081,7 @@
goto bad;
}
pathbuf_destroy(pb);
- if ((error = VOP_ACCESS(vp, VWRITE, l->l_cred)) != 0)
+ if ((error = VOP_ACCESS(vp, VWRITE, curlwp->l_cred)) != 0)
goto bad;
/* Acquire v_interlock to protect against unp_detach(). */
mutex_enter(vp->v_interlock);
@@ -1127,9 +1123,9 @@
unp3->unp_addrlen = unp2->unp_addrlen;
}
unp3->unp_flags = unp2->unp_flags;
- unp3->unp_connid.unp_pid = l->l_proc->p_pid;
- unp3->unp_connid.unp_euid = kauth_cred_geteuid(l->l_cred);
- unp3->unp_connid.unp_egid = kauth_cred_getegid(l->l_cred);
+ unp3->unp_connid.unp_pid = curlwp->l_proc->p_pid;
+ unp3->unp_connid.unp_euid = kauth_cred_geteuid(curlwp->l_cred);
+ unp3->unp_connid.unp_egid = kauth_cred_getegid(curlwp->l_cred);
unp3->unp_flags |= UNP_EIDSVALID;
if (unp2->unp_flags & UNP_EIDSBIND) {
unp->unp_connid = unp2->unp_connid;
@@ -1882,6 +1878,7 @@
.pr_accept = unp_accept,
.pr_bind = unp_bind,
.pr_listen = unp_listen,
+ .pr_connect = unp_connect,
.pr_ioctl = unp_ioctl,
.pr_stat = unp_stat,
.pr_peeraddr = unp_peeraddr,
diff -r 0fcbdeb6d667 -r d63571b5d387 sys/net/raw_usrreq.c
--- a/sys/net/raw_usrreq.c Wed Jul 30 07:44:00 2014 +0000
+++ b/sys/net/raw_usrreq.c Wed Jul 30 10:04:25 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: raw_usrreq.c,v 1.45 2014/07/24 15:12:03 rtr Exp $ */
+/* $NetBSD: raw_usrreq.c,v 1.46 2014/07/30 10:04:26 rtr Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.45 2014/07/24 15:12:03 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.46 2014/07/30 10:04:26 rtr Exp $");
#include <sys/param.h>
#include <sys/mbuf.h>
@@ -165,6 +165,7 @@
KASSERT(req != PRU_ACCEPT);
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
+ KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONTROL);
KASSERT(req != PRU_SENSE);
KASSERT(req != PRU_PEERADDR);
@@ -188,7 +189,6 @@
* within that protocol family (assuming there's
* nothing else around it should go to).
*/
- case PRU_CONNECT:
case PRU_CONNECT2:
error = EOPNOTSUPP;
break;
diff -r 0fcbdeb6d667 -r d63571b5d387 sys/net/rtsock.c
--- a/sys/net/rtsock.c Wed Jul 30 07:44:00 2014 +0000
+++ b/sys/net/rtsock.c Wed Jul 30 10:04:25 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtsock.c,v 1.157 2014/07/24 15:12:03 rtr Exp $ */
+/* $NetBSD: rtsock.c,v 1.158 2014/07/30 10:04:26 rtr Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.157 2014/07/24 15:12:03 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.158 2014/07/30 10:04:26 rtr Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -250,6 +250,14 @@
}
static int
+COMPATNAME(route_connect)(struct socket *so, struct mbuf *nam)
+{
+ KASSERT(solocked(so));
+
+ return EOPNOTSUPP;
+}
+
+static int
COMPATNAME(route_ioctl)(struct socket *so, u_long cmd, void *nam,
struct ifnet * ifp)
{
@@ -327,6 +335,7 @@
KASSERT(req != PRU_ACCEPT);
KASSERT(req != PRU_BIND);
KASSERT(req != PRU_LISTEN);
+ KASSERT(req != PRU_CONNECT);
KASSERT(req != PRU_CONTROL);
KASSERT(req != PRU_SENSE);
KASSERT(req != PRU_PEERADDR);
@@ -1432,6 +1441,7 @@
.pr_accept = COMPATNAME(route_accept_wrapper),
.pr_bind = COMPATNAME(route_bind_wrapper),
.pr_listen = COMPATNAME(route_listen_wrapper),
+ .pr_connect = COMPATNAME(route_connect_wrapper),
.pr_ioctl = COMPATNAME(route_ioctl_wrapper),
Home |
Main Index |
Thread Index |
Old Index