Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys * split PRU_CONTROL functionality out of xxx_userreq() s...
details: https://anonhg.NetBSD.org/src/rev/b501612c81f3
branches: trunk
changeset: 330086:b501612c81f3
user: rtr <rtr%NetBSD.org@localhost>
date: Sun Jun 22 08:10:18 2014 +0000
description:
* split PRU_CONTROL functionality out of xxx_userreq() switches and place
into separate xxx_ioctl() functions.
* place KASSERT(req != PRU_CONTROL) inside xxx_userreq() as it is now
inappropriate for req = PRU_CONTROL in xxx_userreq().
* replace calls to pr_generic() with req = PRU_CONTROL with pr_ioctl().
* remove & fixup references to PRU_CONTROL xxx_userreq() function comments.
* fix various comments references for xxx_userreq() that mentioned
PRU_CONTROL as xxx_userreq() no longer handles the request.
a further change will follow to fix parameter and naming inconsistencies
retained from original code.
Reviewed by rmind@
diffstat:
sys/compat/common/if_43.c | 6 +-
sys/kern/sys_socket.c | 8 ++--
sys/kern/uipc_usrreq.c | 16 +++++--
sys/net/if.c | 8 ++--
sys/net/link_proto.c | 24 +++++++----
sys/net/raw_usrreq.c | 8 +--
sys/net/rtsock.c | 13 +++++-
sys/netatalk/ddp_usrreq.c | 20 +++++++---
sys/netbt/hci.h | 6 +-
sys/netbt/hci_ioctl.c | 6 +-
sys/netbt/hci_socket.c | 35 ++++++++++--------
sys/netbt/l2cap_socket.c | 24 +++++++-----
sys/netbt/rfcomm_socket.c | 24 +++++++-----
sys/netbt/sco_socket.c | 25 +++++++-----
sys/netinet/raw_ip.c | 17 ++++++--
sys/netinet/tcp_usrreq.c | 44 +++++++++++++----------
sys/netinet/udp_usrreq.c | 19 ++++++---
sys/netinet6/raw_ip6.c | 18 ++++++--
sys/netinet6/udp6_usrreq.c | 35 +++++++++++-------
sys/netipsec/keysock.c | 14 ++++++-
sys/netmpls/mpls_proto.c | 13 +++++-
sys/netnatm/natm.c | 70 ++++++++++++++++++++++--------------
sys/rump/net/lib/libsockin/sockin.c | 20 +++++++---
sys/sys/protosw.h | 15 +++++++-
24 files changed, 309 insertions(+), 179 deletions(-)
diffs (truncated from 1346 to 300 lines):
diff -r 28df1d712871 -r b501612c81f3 sys/compat/common/if_43.c
--- a/sys/compat/common/if_43.c Sat Jun 21 23:12:10 2014 +0000
+++ b/sys/compat/common/if_43.c Sun Jun 22 08:10:18 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if_43.c,v 1.5 2014/05/18 14:46:15 rmind Exp $ */
+/* $NetBSD: if_43.c,v 1.6 2014/06/22 08:10:18 rtr Exp $ */
/*
* Copyright (c) 1982, 1986, 1989, 1990, 1993
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.5 2014/05/18 14:46:15 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.6 2014/06/22 08:10:18 rtr Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@@ -256,7 +256,7 @@
cmd = SIOCGIFNETMASK;
}
- error = (*so->so_proto->pr_usrreqs->pr_generic)(so, PRU_CONTROL,
+ error = (*so->so_proto->pr_usrreqs->pr_ioctl)(so,
(struct mbuf *)cmd, (struct mbuf *)ifr, (struct mbuf *)ifp, l);
switch (ocmd) {
diff -r 28df1d712871 -r b501612c81f3 sys/kern/sys_socket.c
--- a/sys/kern/sys_socket.c Sat Jun 21 23:12:10 2014 +0000
+++ b/sys/kern/sys_socket.c Sun Jun 22 08:10:18 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sys_socket.c,v 1.68 2014/05/18 14:46:15 rmind Exp $ */
+/* $NetBSD: sys_socket.c,v 1.69 2014/06/22 08:10:18 rtr Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -61,7 +61,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sys_socket.c,v 1.68 2014/05/18 14:46:15 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_socket.c,v 1.69 2014/06/22 08:10:18 rtr Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -201,8 +201,8 @@
if (IOCGROUP(cmd) == 'i')
error = ifioctl(so, cmd, data, curlwp);
else {
- error = (*so->so_proto->pr_usrreqs->pr_generic)(so,
- PRU_CONTROL, (struct mbuf *)cmd,
+ error = (*so->so_proto->pr_usrreqs->pr_ioctl)(so,
+ (struct mbuf *)cmd,
(struct mbuf *)data, NULL, curlwp);
}
KERNEL_UNLOCK_ONE(NULL);
diff -r 28df1d712871 -r b501612c81f3 sys/kern/uipc_usrreq.c
--- a/sys/kern/uipc_usrreq.c Sat Jun 21 23:12:10 2014 +0000
+++ b/sys/kern/uipc_usrreq.c Sun Jun 22 08:10:18 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_usrreq.c,v 1.153 2014/06/08 02:52:50 christos Exp $ */
+/* $NetBSD: uipc_usrreq.c,v 1.154 2014/06/22 08:10:18 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.153 2014/06/08 02:52:50 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.154 2014/06/22 08:10:18 rtr Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -376,10 +376,8 @@
KASSERT(req != PRU_ATTACH);
KASSERT(req != PRU_DETACH);
+ KASSERT(req != PRU_CONTROL);
- if (req == PRU_CONTROL) {
- return EOPNOTSUPP;
- }
KASSERT(solocked(so));
unp = sotounpcb(so);
@@ -867,6 +865,13 @@
unp_free(unp);
}
+static int
+unp_ioctl(struct socket *so, struct mbuf *m, struct mbuf *nam,
+ struct mbuf *control, struct lwp *l)
+{
+ return EOPNOTSUPP;
+}
+
/*
* Allocate the new sockaddr. We have to allocate one
* extra byte so that we can ensure that the pathname
@@ -1812,5 +1817,6 @@
const struct pr_usrreqs unp_usrreqs = {
.pr_attach = unp_attach,
.pr_detach = unp_detach,
+ .pr_ioctl = unp_ioctl,
.pr_generic = unp_usrreq,
};
diff -r 28df1d712871 -r b501612c81f3 sys/net/if.c
--- a/sys/net/if.c Sat Jun 21 23:12:10 2014 +0000
+++ b/sys/net/if.c Sun Jun 22 08:10:18 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: if.c,v 1.282 2014/06/16 00:40:10 ozaki-r Exp $ */
+/* $NetBSD: if.c,v 1.283 2014/06/22 08:10:18 rtr Exp $ */
/*-
* Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.282 2014/06/16 00:40:10 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.283 2014/06/22 08:10:18 rtr Exp $");
#include "opt_inet.h"
@@ -1922,8 +1922,8 @@
#ifdef COMPAT_OSOCK
error = compat_ifioctl(so, ocmd, cmd, data, l);
#else
- error = (*so->so_proto->pr_usrreqs->pr_generic)(so,
- PRU_CONTROL, (struct mbuf *)cmd, (struct mbuf *)data,
+ error = (*so->so_proto->pr_usrreqs->pr_ioctl)(so,
+ (struct mbuf *)cmd, (struct mbuf *)data,
(struct mbuf *)ifp, l);
#endif
}
diff -r 28df1d712871 -r b501612c81f3 sys/net/link_proto.c
--- a/sys/net/link_proto.c Sat Jun 21 23:12:10 2014 +0000
+++ b/sys/net/link_proto.c Sun Jun 22 08:10:18 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: link_proto.c,v 1.9 2014/05/19 02:51:24 rmind Exp $ */
+/* $NetBSD: link_proto.c,v 1.10 2014/06/22 08:10:18 rtr Exp $ */
/*-
* Copyright (c) 1982, 1986, 1993
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.9 2014/05/19 02:51:24 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.10 2014/06/22 08:10:18 rtr Exp $");
#include <sys/param.h>
#include <sys/socket.h>
@@ -50,6 +50,8 @@
static int sockaddr_dl_cmp(const struct sockaddr *, const struct sockaddr *);
static int link_attach(struct socket *, int);
static void link_detach(struct socket *);
+static int link_ioctl(struct socket *, struct mbuf *, struct mbuf *,
+ struct mbuf *, struct lwp *);
static int link_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
struct mbuf *, struct lwp *);
static void link_init(void);
@@ -63,6 +65,7 @@
static const struct pr_usrreqs link_usrreqs = {
.pr_attach = link_attach,
.pr_detach = link_detach,
+ .pr_ioctl = link_ioctl,
.pr_generic = link_usrreq,
};
@@ -230,19 +233,22 @@
}
static int
+link_ioctl(struct socket *so, struct mbuf *m, struct mbuf *nam,
+ struct mbuf *control, struct lwp *l)
+{
+ return link_control(so, (unsigned long)m, nam,
+ (struct ifnet *)control, l);
+}
+
+static int
link_usrreq(struct socket *so, int req, struct mbuf *m, struct mbuf *nam,
struct mbuf *control, struct lwp *l)
{
KASSERT(req != PRU_ATTACH);
KASSERT(req != PRU_DETACH);
+ KASSERT(req != PRU_CONTROL);
- switch (req) {
- case PRU_CONTROL:
- return link_control(so, (unsigned long)m, nam,
- (struct ifnet *)control, l);
- default:
- return EOPNOTSUPP;
- }
+ return EOPNOTSUPP;
}
/* Compare the field at byte offsets [fieldstart, fieldend) in
diff -r 28df1d712871 -r b501612c81f3 sys/net/raw_usrreq.c
--- a/sys/net/raw_usrreq.c Sat Jun 21 23:12:10 2014 +0000
+++ b/sys/net/raw_usrreq.c Sun Jun 22 08:10:18 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: raw_usrreq.c,v 1.39 2014/05/19 02:51:24 rmind Exp $ */
+/* $NetBSD: raw_usrreq.c,v 1.40 2014/06/22 08:10:18 rtr Exp $ */
/*
* Copyright (c) 1980, 1986, 1993
@@ -36,7 +36,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.39 2014/05/19 02:51:24 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: raw_usrreq.c,v 1.40 2014/06/22 08:10:18 rtr Exp $");
#include <sys/param.h>
#include <sys/mbuf.h>
@@ -162,9 +162,7 @@
KASSERT(req != PRU_ATTACH);
KASSERT(req != PRU_DETACH);
-
- if (req == PRU_CONTROL)
- return EOPNOTSUPP;
+ KASSERT(req != PRU_CONTROL);
s = splsoftnet();
KERNEL_LOCK(1, NULL);
diff -r 28df1d712871 -r b501612c81f3 sys/net/rtsock.c
--- a/sys/net/rtsock.c Sat Jun 21 23:12:10 2014 +0000
+++ b/sys/net/rtsock.c Sun Jun 22 08:10:18 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: rtsock.c,v 1.147 2014/05/21 20:43:56 rmind Exp $ */
+/* $NetBSD: rtsock.c,v 1.148 2014/06/22 08:10:18 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.147 2014/05/21 20:43:56 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.148 2014/06/22 08:10:18 rtr Exp $");
#ifdef _KERNEL_OPT
#include "opt_inet.h"
@@ -224,6 +224,13 @@
}
static int
+COMPATNAME(route_ioctl)(struct socket *so, struct mbuf *m,
+ struct mbuf *nam, struct mbuf *control, struct lwp *l)
+{
+ return EOPNOTSUPP;
+}
+
+static int
COMPATNAME(route_usrreq)(struct socket *so, int req, struct mbuf *m,
struct mbuf *nam, struct mbuf *control, struct lwp *l)
{
@@ -231,6 +238,7 @@
KASSERT(req != PRU_ATTACH);
KASSERT(req != PRU_DETACH);
+ KASSERT(req != PRU_CONTROL);
s = splsoftnet();
error = raw_usrreq(so, req, m, nam, control, l);
@@ -1327,6 +1335,7 @@
static const struct pr_usrreqs route_usrreqs = {
.pr_attach = COMPATNAME(route_attach_wrapper),
.pr_detach = COMPATNAME(route_detach_wrapper),
+ .pr_ioctl = COMPATNAME(route_ioctl_wrapper),
.pr_generic = COMPATNAME(route_usrreq_wrapper),
};
diff -r 28df1d712871 -r b501612c81f3 sys/netatalk/ddp_usrreq.c
--- a/sys/netatalk/ddp_usrreq.c Sat Jun 21 23:12:10 2014 +0000
+++ b/sys/netatalk/ddp_usrreq.c Sun Jun 22 08:10:18 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ddp_usrreq.c,v 1.44 2014/05/20 19:04:00 rmind Exp $ */
+/* $NetBSD: ddp_usrreq.c,v 1.45 2014/06/22 08:10:18 rtr Exp $ */
/*
* Copyright (c) 1990,1991 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c,v 1.44 2014/05/20 19:04:00 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c,v 1.45 2014/06/22 08:10:18 rtr Exp $");
#include "opt_mbuftrace.h"
@@ -84,12 +84,10 @@
KASSERT(req != PRU_ATTACH);
KASSERT(req != PRU_DETACH);
Home |
Main Index |
Thread Index |
Old Index