Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys fix parameter types in pr_ioctl, called xx_control() fun...



details:   https://anonhg.NetBSD.org/src/rev/aa0b62c32342
branches:  trunk
changeset: 330248:aa0b62c32342
user:      rtr <rtr%NetBSD.org@localhost>
date:      Tue Jul 01 05:49:18 2014 +0000

description:
fix parameter types in pr_ioctl, called xx_control() functions and remove
abuse of pointer to struct mbuf type.

param2 changed to u_long type and uses parameter name 'cmd' (ioctl command)
param3 changed to void * type and uses parameter name 'data'
param4 changed to struct ifnet * and uses parameter name 'ifp'
param5 has been removed (formerly struct lwp *) and uses of 'l' have been
       replaced with curlwp from curproc(9).

callers have had (now unnecessary) casts to struct mbuf * removed, called
code has had (now unnecessary) casts to u_long, void * and struct ifnet *
respectively removed.

reviewed by rmind@

diffstat:

 sys/compat/common/if_43.c                       |   7 ++---
 sys/kern/sys_socket.c                           |   7 ++---
 sys/kern/uipc_usrreq.c                          |   7 ++---
 sys/net/if.c                                    |  12 ++++------
 sys/net/if.h                                    |   5 +--
 sys/net/link_proto.c                            |  15 +++++--------
 sys/net/rtsock.c                                |   8 +++---
 sys/netatalk/at_control.c                       |   8 +++---
 sys/netatalk/at_extern.h                        |   4 +-
 sys/netatalk/ddp_usrreq.c                       |  10 +++-----
 sys/netbt/hci.h                                 |   6 ++--
 sys/netbt/hci_ioctl.c                           |  16 +++++++-------
 sys/netbt/hci_socket.c                          |   9 +++----
 sys/netbt/l2cap_socket.c                        |   7 ++---
 sys/netbt/rfcomm_socket.c                       |   7 ++---
 sys/netbt/sco_socket.c                          |   7 ++---
 sys/netinet/in.c                                |  28 +++++++++---------------
 sys/netinet/in_var.h                            |   5 +--
 sys/netinet/raw_ip.c                            |   9 +++----
 sys/netinet/tcp_usrreq.c                        |  13 ++++-------
 sys/netinet/udp_usrreq.c                        |  10 +++-----
 sys/netinet6/in6.c                              |  26 ++++++++++------------
 sys/netinet6/in6_var.h                          |   5 +--
 sys/netinet6/raw_ip6.c                          |  10 +++-----
 sys/netinet6/udp6_usrreq.c                      |  10 +++-----
 sys/netipsec/keysock.c                          |   7 ++---
 sys/netmpls/mpls_proto.c                        |   7 ++---
 sys/netnatm/natm.c                              |   9 +++----
 sys/rump/net/lib/libnetinet/netinet_component.c |   6 ++--
 sys/rump/net/lib/libsockin/sockin.c             |  10 +++-----
 sys/sys/protosw.h                               |  13 +++++------
 31 files changed, 131 insertions(+), 172 deletions(-)

diffs (truncated from 1158 to 300 lines):

diff -r b64ef27519cc -r aa0b62c32342 sys/compat/common/if_43.c
--- a/sys/compat/common/if_43.c Tue Jul 01 03:43:09 2014 +0000
+++ b/sys/compat/common/if_43.c Tue Jul 01 05:49:18 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_43.c,v 1.6 2014/06/22 08:10:18 rtr Exp $    */
+/*     $NetBSD: if_43.c,v 1.7 2014/07/01 05:49: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.6 2014/06/22 08:10:18 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.7 2014/07/01 05:49:18 rtr Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -256,8 +256,7 @@
                cmd = SIOCGIFNETMASK;
        }
 
-       error = (*so->so_proto->pr_usrreqs->pr_ioctl)(so,
-           (struct mbuf *)cmd, (struct mbuf *)ifr, (struct mbuf *)ifp, l);
+       error = (*so->so_proto->pr_usrreqs->pr_ioctl)(so, cmd, ifr, ifp);
 
        switch (ocmd) {
        case OOSIOCGIFADDR:
diff -r b64ef27519cc -r aa0b62c32342 sys/kern/sys_socket.c
--- a/sys/kern/sys_socket.c     Tue Jul 01 03:43:09 2014 +0000
+++ b/sys/kern/sys_socket.c     Tue Jul 01 05:49:18 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_socket.c,v 1.70 2014/06/23 17:18:45 rtr Exp $      */
+/*     $NetBSD: sys_socket.c,v 1.71 2014/07/01 05:49: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.70 2014/06/23 17:18:45 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_socket.c,v 1.71 2014/07/01 05:49:18 rtr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -202,8 +202,7 @@
                        error = ifioctl(so, cmd, data, curlwp);
                else {
                        error = (*so->so_proto->pr_usrreqs->pr_ioctl)(so,
-                           (struct mbuf *)cmd, (struct mbuf *)data,
-                           NULL, curlwp);
+                           cmd, data, NULL);
                }
                KERNEL_UNLOCK_ONE(NULL);
                break;
diff -r b64ef27519cc -r aa0b62c32342 sys/kern/uipc_usrreq.c
--- a/sys/kern/uipc_usrreq.c    Tue Jul 01 03:43:09 2014 +0000
+++ b/sys/kern/uipc_usrreq.c    Tue Jul 01 05:49:18 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_usrreq.c,v 1.154 2014/06/22 08:10:18 rtr Exp $    */
+/*     $NetBSD: uipc_usrreq.c,v 1.155 2014/07/01 05:49: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.154 2014/06/22 08:10:18 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_usrreq.c,v 1.155 2014/07/01 05:49:18 rtr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -866,8 +866,7 @@
 }
 
 static int
-unp_ioctl(struct socket *so, struct mbuf *m, struct mbuf *nam,
-    struct mbuf *control, struct lwp *l)
+unp_ioctl(struct socket *so, u_long cmd, void *nam, struct ifnet *ifp)
 {
        return EOPNOTSUPP;
 }
diff -r b64ef27519cc -r aa0b62c32342 sys/net/if.c
--- a/sys/net/if.c      Tue Jul 01 03:43:09 2014 +0000
+++ b/sys/net/if.c      Tue Jul 01 05:49:18 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.283 2014/06/22 08:10:18 rtr Exp $     */
+/*     $NetBSD: if.c,v 1.284 2014/07/01 05:49: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.283 2014/06/22 08:10:18 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.284 2014/07/01 05:49:18 rtr Exp $");
 
 #include "opt_inet.h"
 
@@ -1715,8 +1715,7 @@
 }
 
 int
-ifaddrpref_ioctl(struct socket *so, u_long cmd, void *data, struct ifnet *ifp,
-    lwp_t *l)
+ifaddrpref_ioctl(struct socket *so, u_long cmd, void *data, struct ifnet *ifp)
 {
        struct if_addrprefreq *ifap = (struct if_addrprefreq *)data;
        struct ifaddr *ifa;
@@ -1728,7 +1727,7 @@
 
        switch (cmd) {
        case SIOCSIFADDRPREF:
-               if (kauth_authorize_network(l->l_cred, KAUTH_NETWORK_INTERFACE,
+               if (kauth_authorize_network(curlwp->l_cred, KAUTH_NETWORK_INTERFACE,
                    KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, (void *)cmd,
                    NULL) != 0)
                        return EPERM;
@@ -1923,8 +1922,7 @@
                error = compat_ifioctl(so, ocmd, cmd, data, l);
 #else
                error = (*so->so_proto->pr_usrreqs->pr_ioctl)(so,
-                   (struct mbuf *)cmd, (struct mbuf *)data,
-                   (struct mbuf *)ifp, l);
+                   cmd, data, ifp);
 #endif
        }
 
diff -r b64ef27519cc -r aa0b62c32342 sys/net/if.h
--- a/sys/net/if.h      Tue Jul 01 03:43:09 2014 +0000
+++ b/sys/net/if.h      Tue Jul 01 05:49:18 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.h,v 1.167 2014/06/16 03:43:10 ozaki-r Exp $ */
+/*     $NetBSD: if.h,v 1.168 2014/07/01 05:49:18 rtr Exp $     */
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -873,8 +873,7 @@
 int    ifconf(u_long, void *);
 void   ifinit(void);
 void   ifinit1(void);
-int    ifaddrpref_ioctl(struct socket *, u_long, void *, struct ifnet *,
-    lwp_t *);
+int    ifaddrpref_ioctl(struct socket *, u_long, void *, struct ifnet *);
 extern int (*ifioctl)(struct socket *, u_long, void *, struct lwp *);
 int    ifioctl_common(struct ifnet *, u_long, void *);
 int    ifpromisc(struct ifnet *, int);
diff -r b64ef27519cc -r aa0b62c32342 sys/net/link_proto.c
--- a/sys/net/link_proto.c      Tue Jul 01 03:43:09 2014 +0000
+++ b/sys/net/link_proto.c      Tue Jul 01 05:49:18 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: link_proto.c,v 1.11 2014/06/23 17:18:45 rtr Exp $      */
+/*     $NetBSD: link_proto.c,v 1.12 2014/07/01 05:49: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.11 2014/06/23 17:18:45 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: link_proto.c,v 1.12 2014/07/01 05:49:18 rtr Exp $");
 
 #include <sys/param.h>
 #include <sys/socket.h>
@@ -50,8 +50,7 @@
 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_ioctl(struct socket *, u_long, void *, struct ifnet *);
 static int link_usrreq(struct socket *, int, struct mbuf *, struct mbuf *,
     struct mbuf *, struct lwp *);
 static void link_init(void);
@@ -100,7 +99,7 @@
 
 static int
 link_control(struct socket *so, unsigned long cmd, void *data,
-    struct ifnet *ifp, struct lwp *l)
+    struct ifnet *ifp)
 {
        int error, s;
        bool isactive, mkactive;
@@ -233,11 +232,9 @@
 }
 
 static int
-link_ioctl(struct socket *so, struct mbuf *m, struct mbuf *nam,
-       struct mbuf *ifp, struct lwp *l)
+link_ioctl(struct socket *so, u_long cmd, void *nam, struct ifnet *ifp)
 {
-       return link_control(so, (unsigned long)m, nam,
-           (struct ifnet *)ifp, l);
+       return link_control(so, cmd, nam, ifp);
 }
 
 static int
diff -r b64ef27519cc -r aa0b62c32342 sys/net/rtsock.c
--- a/sys/net/rtsock.c  Tue Jul 01 03:43:09 2014 +0000
+++ b/sys/net/rtsock.c  Tue Jul 01 05:49:18 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rtsock.c,v 1.148 2014/06/22 08:10:18 rtr Exp $ */
+/*     $NetBSD: rtsock.c,v 1.149 2014/07/01 05:49: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.148 2014/06/22 08:10:18 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rtsock.c,v 1.149 2014/07/01 05:49:18 rtr Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -224,8 +224,8 @@
 }
 
 static int
-COMPATNAME(route_ioctl)(struct socket *so, struct mbuf *m,
-    struct mbuf *nam, struct mbuf *control, struct lwp *l)
+COMPATNAME(route_ioctl)(struct socket *so, u_long cmd, void *nam,
+    struct ifnet * ifp)
 {
        return EOPNOTSUPP;
 }
diff -r b64ef27519cc -r aa0b62c32342 sys/netatalk/at_control.c
--- a/sys/netatalk/at_control.c Tue Jul 01 03:43:09 2014 +0000
+++ b/sys/netatalk/at_control.c Tue Jul 01 05:49:18 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: at_control.c,v 1.34 2011/10/19 01:50:27 dyoung Exp $    */
+/*     $NetBSD: at_control.c,v 1.35 2014/07/01 05:49:18 rtr Exp $       */
 
 /*
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: at_control.c,v 1.34 2011/10/19 01:50:27 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: at_control.c,v 1.35 2014/07/01 05:49:18 rtr Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -72,7 +72,7 @@
                         (a)->sat_addr.s_node == (b)->sat_addr.s_node )
 
 int
-at_control(u_long cmd, void * data, struct ifnet *ifp, struct lwp *l)
+at_control(u_long cmd, void *data, struct ifnet *ifp)
 {
        struct ifreq   *ifr = (struct ifreq *) data;
        const struct sockaddr_at *csat;
@@ -125,7 +125,7 @@
                 * If we are not superuser, then we don't get to do these
                 * ops.
                 */
-               if (l && kauth_authorize_network(l->l_cred,
+               if (kauth_authorize_network(curlwp->l_cred,
                    KAUTH_NETWORK_INTERFACE,
                    KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, (void *)cmd,
                    NULL) != 0)
diff -r b64ef27519cc -r aa0b62c32342 sys/netatalk/at_extern.h
--- a/sys/netatalk/at_extern.h  Tue Jul 01 03:43:09 2014 +0000
+++ b/sys/netatalk/at_extern.h  Tue Jul 01 05:49:18 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: at_extern.h,v 1.17 2014/05/18 14:46:16 rmind Exp $     */
+/*     $NetBSD: at_extern.h,v 1.18 2014/07/01 05:49:18 rtr Exp $       */
 
 /*
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
@@ -50,7 +50,7 @@
 void   aarpinput(struct ifnet *, struct mbuf *);
 int    at_broadcast(const struct sockaddr_at *);
 void   aarp_clean(void);
-int    at_control(u_long, void *, struct ifnet *, struct lwp *);
+int    at_control(u_long, void *, struct ifnet *);
 int    at_inithead(void **, int);
 void   at_purgeaddr(struct ifaddr *);
 void   at_purgeif(struct ifnet *);
diff -r b64ef27519cc -r aa0b62c32342 sys/netatalk/ddp_usrreq.c
--- a/sys/netatalk/ddp_usrreq.c Tue Jul 01 03:43:09 2014 +0000
+++ b/sys/netatalk/ddp_usrreq.c Tue Jul 01 05:49:18 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ddp_usrreq.c,v 1.46 2014/06/23 17:18:45 rtr Exp $       */
+/*     $NetBSD: ddp_usrreq.c,v 1.47 2014/07/01 05:49: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.46 2014/06/23 17:18:45 rtr Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ddp_usrreq.c,v 1.47 2014/07/01 05:49:18 rtr Exp $");
 



Home | Main Index | Thread Index | Old Index