Source-Changes-HG archive

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

[src/trunk]: src/sys Add struct pr_usrreqs with a pr_generic function and pre...



details:   https://anonhg.NetBSD.org/src/rev/60f6f7bb06d7
branches:  trunk
changeset: 329297:60f6f7bb06d7
user:      rmind <rmind%NetBSD.org@localhost>
date:      Sun May 18 14:46:15 2014 +0000

description:
Add struct pr_usrreqs with a pr_generic function and prepare for the
dismantling of pr_usrreq in the protocols; no functional change intended.
PRU_ATTACH/PRU_DETACH changes will follow soon.

Bump for struct protosw.  Welcome to 6.99.62!

diffstat:

 sys/compat/common/if_43.c  |   6 +-
 sys/dev/kttcp.c            |  18 ++++---
 sys/kern/sys_socket.c      |  12 ++--
 sys/kern/uipc_proto.c      |  21 ++++-----
 sys/kern/uipc_socket.c     |  51 ++++++++++++------------
 sys/kern/uipc_socket2.c    |   8 +-
 sys/kern/uipc_syscalls.c   |   8 +-
 sys/kern/uipc_usrreq.c     |  15 ++++--
 sys/net/if.c               |  19 ++++----
 sys/net/if_gre.c           |  12 +++--
 sys/net/if_stf.c           |  19 ++++++--
 sys/net/link_proto.c       |  10 +++-
 sys/net/raw_usrreq.c       |   8 +-
 sys/net/rtsock.c           |  10 +++-
 sys/netatalk/at_extern.h   |   6 +-
 sys/netatalk/at_proto.c    |  10 +---
 sys/netatalk/ddp_usrreq.c  |  26 +++++-------
 sys/netbt/bluetooth.h      |  13 ++++-
 sys/netbt/bt_proto.c       |  22 ++-------
 sys/netbt/hci.h            |   5 +-
 sys/netbt/hci_socket.c     |  14 +++++-
 sys/netbt/l2cap.h          |   5 +-
 sys/netbt/l2cap_socket.c   |  14 +++++-
 sys/netbt/rfcomm.h         |   5 +-
 sys/netbt/rfcomm_socket.c  |  14 +++++-
 sys/netbt/sco.h            |   4 +-
 sys/netbt/sco_socket.c     |  14 +++++-
 sys/netinet/if_arp.c       |   7 +-
 sys/netinet/in_gif.c       |  19 +++++---
 sys/netinet/in_proto.c     |  37 +++++++----------
 sys/netinet/ip_mroute.c    |  18 +++++---
 sys/netinet/ip_var.h       |   3 +-
 sys/netinet/raw_ip.c       |  12 ++++-
 sys/netinet/tcp_usrreq.c   |  19 ++++++--
 sys/netinet/tcp_var.h      |   7 +-
 sys/netinet/udp_usrreq.c   |  17 +++++--
 sys/netinet/udp_var.h      |   6 +-
 sys/netinet6/in6_gif.c     |  22 ++++++----
 sys/netinet6/in6_proto.c   |  32 +++++---------
 sys/netinet6/ip6_var.h     |   3 +-
 sys/netinet6/ip6protosw.h  |   6 +-
 sys/netinet6/raw_ip6.c     |  12 ++++-
 sys/netinet6/udp6_usrreq.c |  12 ++++-
 sys/netinet6/udp6_var.h    |   5 +-
 sys/netipsec/keysock.c     |  20 ++++++--
 sys/netipsec/keysock.h     |  10 +----
 sys/netipsec/xform_ipip.c  |  12 +---
 sys/netmpls/mpls_proto.c   |  94 ++++++++++++++++++++++++---------------------
 sys/netnatm/natm.c         |  24 ++++++-----
 sys/netnatm/natm.h         |  11 +---
 sys/netnatm/natm_proto.c   |  15 ++----
 sys/nfs/nfs_socket.c       |  12 ++--
 sys/sys/param.h            |   4 +-
 sys/sys/protosw.h          |  15 ++++--
 sys/sys/un.h               |   7 +-
 55 files changed, 454 insertions(+), 376 deletions(-)

diffs (truncated from 2466 to 300 lines):

diff -r 3235af6f2a06 -r 60f6f7bb06d7 sys/compat/common/if_43.c
--- a/sys/compat/common/if_43.c Sun May 18 14:03:26 2014 +0000
+++ b/sys/compat/common/if_43.c Sun May 18 14:46:15 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_43.c,v 1.4 2011/01/19 10:21:16 tsutsui Exp $        */
+/*     $NetBSD: if_43.c,v 1.5 2014/05/18 14:46:15 rmind 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.4 2011/01/19 10:21:16 tsutsui Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_43.c,v 1.5 2014/05/18 14:46:15 rmind Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_compat_netbsd.h"
@@ -256,7 +256,7 @@
                cmd = SIOCGIFNETMASK;
        }
 
-       error = (*so->so_proto->pr_usrreq)(so, PRU_CONTROL,
+       error = (*so->so_proto->pr_usrreqs->pr_generic)(so, PRU_CONTROL,
            (struct mbuf *)cmd, (struct mbuf *)ifr, (struct mbuf *)ifp, l);
 
        switch (ocmd) {
diff -r 3235af6f2a06 -r 60f6f7bb06d7 sys/dev/kttcp.c
--- a/sys/dev/kttcp.c   Sun May 18 14:03:26 2014 +0000
+++ b/sys/dev/kttcp.c   Sun May 18 14:46:15 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: kttcp.c,v 1.32 2014/03/16 05:20:26 dholland Exp $      */
+/*     $NetBSD: kttcp.c,v 1.33 2014/05/18 14:46:15 rmind Exp $ */
 
 /*
  * Copyright (c) 2002 Wasabi Systems, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kttcp.c,v 1.32 2014/03/16 05:20:26 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kttcp.c,v 1.33 2014/05/18 14:46:15 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/types.h>
@@ -319,7 +319,7 @@
                                so->so_options |= SO_DONTROUTE;
                        if (resid > 0)
                                so->so_state |= SS_MORETOCOME;
-                       error = (*so->so_proto->pr_usrreq)(so,
+                       error = (*so->so_proto->pr_usrreqs->pr_generic)(so,
                            (flags & MSG_OOB) ? PRU_SENDOOB : PRU_SEND,
                            top, NULL, NULL, l);
                        if (dontroute)
@@ -367,7 +367,7 @@
        if (flags & MSG_OOB) {
                m = m_get(M_WAIT, MT_DATA);
                solock(so);
-               error = (*pr->pr_usrreq)(so, PRU_RCVOOB, m,
+               error = (*pr->pr_usrreqs->pr_generic)(so, PRU_RCVOOB, m,
                    (struct mbuf *)(long)(flags & MSG_PEEK), NULL, NULL);
                sounlock(so);
                if (error)
@@ -631,9 +631,10 @@
                         * protocol in case it needs to do something to
                         * get it filled again.
                         */
-                       if ((pr->pr_flags & PR_WANTRCVD) && so->so_pcb)
-                               (*pr->pr_usrreq)(so, PRU_RCVD, NULL,
+                       if ((pr->pr_flags & PR_WANTRCVD) && so->so_pcb) {
+                               (*pr->pr_usrreqs->pr_generic)(so, PRU_RCVD, NULL,
                                    (struct mbuf *)(long)flags, NULL, NULL);
+                       }
                        SBLASTRECORDCHK(&so->so_rcv,
                            "kttcp_soreceive sbwait 2");
                        SBLASTMBUFCHK(&so->so_rcv,
@@ -670,9 +671,10 @@
                }
                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_usrreq)(so, PRU_RCVD, NULL,
+               if (pr->pr_flags & PR_WANTRCVD && so->so_pcb) {
+                       (*pr->pr_usrreqs->pr_generic)(so, PRU_RCVD, NULL,
                            (struct mbuf *)(long)flags, NULL, NULL);
+               }
        }
        if (orig_resid == resid && orig_resid &&
            (flags & MSG_EOR) == 0 && (so->so_state & SS_CANTRCVMORE) == 0) {
diff -r 3235af6f2a06 -r 60f6f7bb06d7 sys/kern/sys_socket.c
--- a/sys/kern/sys_socket.c     Sun May 18 14:03:26 2014 +0000
+++ b/sys/kern/sys_socket.c     Sun May 18 14:46:15 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sys_socket.c,v 1.67 2014/04/26 11:16:22 pooka Exp $    */
+/*     $NetBSD: sys_socket.c,v 1.68 2014/05/18 14:46:15 rmind 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.67 2014/04/26 11:16:22 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sys_socket.c,v 1.68 2014/05/18 14:46:15 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -201,9 +201,9 @@
                if (IOCGROUP(cmd) == 'i')
                        error = ifioctl(so, cmd, data, curlwp);
                else {
-                       error = (*so->so_proto->pr_usrreq)(so, PRU_CONTROL,
-                           (struct mbuf *)cmd, (struct mbuf *)data, NULL,
-                            curlwp);
+                       error = (*so->so_proto->pr_usrreqs->pr_generic)(so,
+                           PRU_CONTROL, (struct mbuf *)cmd,
+                           (struct mbuf *)data, NULL, curlwp);
                }
                KERNEL_UNLOCK_ONE(NULL);
                break;
@@ -240,7 +240,7 @@
        ub->st_mode = S_IFSOCK;
 
        solock(so);
-       error = (*so->so_proto->pr_usrreq)(so, PRU_SENSE,
+       error = (*so->so_proto->pr_usrreqs->pr_generic)(so, PRU_SENSE,
            (struct mbuf *)ub, NULL, NULL, curlwp);
        sounlock(so);
 
diff -r 3235af6f2a06 -r 60f6f7bb06d7 sys/kern/uipc_proto.c
--- a/sys/kern/uipc_proto.c     Sun May 18 14:03:26 2014 +0000
+++ b/sys/kern/uipc_proto.c     Sun May 18 14:46:15 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_proto.c,v 1.22 2011/05/29 03:32:46 manu Exp $     */
+/*     $NetBSD: uipc_proto.c,v 1.23 2014/05/18 14:46:15 rmind Exp $    */
 
 /*-
  * Copyright (c) 1982, 1986, 1993
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_proto.c,v 1.22 2011/05/29 03:32:46 manu Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_proto.c,v 1.23 2014/05/18 14:46:15 rmind Exp $");
 
 #include <sys/param.h>
 #include <sys/socket.h>
@@ -57,25 +57,22 @@
                .pr_domain = &unixdomain,
                .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_RIGHTS|PR_LISTEN,
                .pr_ctloutput = uipc_ctloutput,
-               .pr_usrreq = uipc_usrreq,
-       }, {
+               .pr_usrreqs = &unp_usrreqs,
+       },
+       {
                .pr_type = SOCK_DGRAM,
                .pr_domain = &unixdomain,
                .pr_flags = PR_ATOMIC|PR_ADDR|PR_RIGHTS,
                .pr_ctloutput = uipc_ctloutput,
-               .pr_usrreq = uipc_usrreq,
-       }, {
+               .pr_usrreqs = &unp_usrreqs,
+       },
+       {
                .pr_type = SOCK_SEQPACKET,
                .pr_domain = &unixdomain,
                .pr_flags = PR_CONNREQUIRED|PR_WANTRCVD|PR_RIGHTS|PR_LISTEN|
                            PR_ATOMIC,
                .pr_ctloutput = uipc_ctloutput,
-               .pr_usrreq = uipc_usrreq,
-       }, {
-               .pr_input = raw_input,
-               .pr_ctlinput = raw_ctlinput,
-               .pr_usrreq = raw_usrreq,
-               .pr_init = raw_init,
+               .pr_usrreqs = &unp_usrreqs,
        }
 };
 
diff -r 3235af6f2a06 -r 60f6f7bb06d7 sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c    Sun May 18 14:03:26 2014 +0000
+++ b/sys/kern/uipc_socket.c    Sun May 18 14:46:15 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_socket.c,v 1.222 2014/05/17 23:27:59 rmind Exp $  */
+/*     $NetBSD: uipc_socket.c,v 1.223 2014/05/18 14:46:15 rmind 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.222 2014/05/17 23:27:59 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket.c,v 1.223 2014/05/18 14:46:15 rmind Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_sock_counters.h"
@@ -520,7 +520,7 @@
                        return EPROTOTYPE;
                return EPROTONOSUPPORT;
        }
-       if (prp->pr_usrreq == NULL)
+       if (prp->pr_usrreqs == NULL)
                return EPROTONOSUPPORT;
        if (prp->pr_type != type)
                return EPROTOTYPE;
@@ -548,7 +548,7 @@
        } else {
                /* Lock assigned and taken during PRU_ATTACH. */
        }
-       error = (*prp->pr_usrreq)(so, PRU_ATTACH, NULL,
+       error = (*prp->pr_usrreqs->pr_generic)(so, PRU_ATTACH, NULL,
            (struct mbuf *)(long)proto, NULL, l);
        KASSERT(solocked(so));
        if (error != 0) {
@@ -625,7 +625,8 @@
        int     error;
 
        solock(so);
-       error = (*so->so_proto->pr_usrreq)(so, PRU_BIND, NULL, nam, NULL, l);
+       error = (*so->so_proto->pr_usrreqs->pr_generic)(so,
+           PRU_BIND, NULL, nam, NULL, l);
        sounlock(so);
        return error;
 }
@@ -641,8 +642,8 @@
                sounlock(so);
                return EINVAL;
        }
-       error = (*so->so_proto->pr_usrreq)(so, PRU_LISTEN, NULL,
-           NULL, NULL, l);
+       error = (*so->so_proto->pr_usrreqs->pr_generic)(so,
+           PRU_LISTEN, NULL, NULL, NULL, l);
        if (error != 0) {
                sounlock(so);
                return error;
@@ -751,8 +752,8 @@
        }
  drop:
        if (so->so_pcb) {
-               int error2 = (*so->so_proto->pr_usrreq)(so, PRU_DETACH,
-                   NULL, NULL, NULL, NULL);
+               int error2 = (*so->so_proto->pr_usrreqs->pr_generic)(so,
+                   PRU_DETACH, NULL, NULL, NULL, NULL);
                if (error == 0)
                        error = error2;
        }
@@ -777,8 +778,8 @@
        KASSERT(so->so_head == NULL);
 
        so->so_aborting++;              /* XXX */
-       error = (*so->so_proto->pr_usrreq)(so, PRU_ABORT, NULL,
-           NULL, NULL, NULL);
+       error = (*so->so_proto->pr_usrreqs->pr_generic)(so,
+           PRU_ABORT, NULL, NULL, NULL, NULL);
        refs = --so->so_aborting;       /* XXX */
        if (error || (refs == 0)) {
                sofree(so);
@@ -799,8 +800,8 @@
        so->so_state &= ~SS_NOFDREF;
        if ((so->so_state & SS_ISDISCONNECTED) == 0 ||
            (so->so_proto->pr_flags & PR_ABRTACPTDIS) == 0)
-               error = (*so->so_proto->pr_usrreq)(so, PRU_ACCEPT,
-                   NULL, nam, NULL, NULL);
+               error = (*so->so_proto->pr_usrreqs->pr_generic)(so,
+                   PRU_ACCEPT, NULL, nam, NULL, NULL);
        else
                error = ECONNABORTED;
 
@@ -827,8 +828,8 @@
            (error = sodisconnect(so))))
                error = EISCONN;
        else
-               error = (*so->so_proto->pr_usrreq)(so, PRU_CONNECT,
-                   NULL, nam, NULL, l);
+               error = (*so->so_proto->pr_usrreqs->pr_generic)(so,
+                   PRU_CONNECT, NULL, nam, NULL, l);
 
        return error;
 }
@@ -838,8 +839,8 @@
 {
        KASSERT(solocked2(so1, so2));
 
-       return (*so1->so_proto->pr_usrreq)(so1, PRU_CONNECT2,
-           NULL, (struct mbuf *)so2, NULL, NULL);
+       return (*so1->so_proto->pr_usrreqs->pr_generic)(so1,
+           PRU_CONNECT2, NULL, (struct mbuf *)so2, NULL, NULL);
 }
 
 int
@@ -854,8 +855,8 @@
        } else if (so->so_state & SS_ISDISCONNECTING) {
                error = EALREADY;
        } else {
-               error = (*so->so_proto->pr_usrreq)(so, PRU_DISCONNECT,
-                   NULL, NULL, NULL, NULL);
+               error = (*so->so_proto->pr_usrreqs->pr_generic)(so,
+                   PRU_DISCONNECT, NULL, NULL, NULL, NULL);



Home | Main Index | Thread Index | Old Index