Source-Changes-HG archive

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

[src/trunk]: src/sys/kern convert to ANSI KNF



details:   https://anonhg.NetBSD.org/src/rev/323a30bd08bd
branches:  trunk
changeset: 504310:323a30bd08bd
user:      lukem <lukem%NetBSD.org@localhost>
date:      Tue Feb 27 05:19:13 2001 +0000

description:
convert to ANSI KNF

diffstat:

 sys/kern/uipc_socket.c   |  204 ++++++++++-------------
 sys/kern/uipc_socket2.c  |  161 +++++++-----------
 sys/kern/uipc_syscalls.c |  402 ++++++++++++++++++++--------------------------
 3 files changed, 328 insertions(+), 439 deletions(-)

diffs (truncated from 1487 to 300 lines):

diff -r 5478f61db617 -r 323a30bd08bd sys/kern/uipc_socket.c
--- a/sys/kern/uipc_socket.c    Tue Feb 27 05:16:33 2001 +0000
+++ b/sys/kern/uipc_socket.c    Tue Feb 27 05:19:13 2001 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uipc_socket.c,v 1.53 2001/02/07 12:20:43 itojun Exp $  */
+/*     $NetBSD: uipc_socket.c,v 1.54 2001/02/27 05:19:13 lukem Exp $   */
 
 /*
  * Copyright (c) 1982, 1986, 1988, 1990, 1993
@@ -52,13 +52,13 @@
 #include <sys/resourcevar.h>
 #include <sys/pool.h>
 
-struct pool socket_pool;
+struct pool    socket_pool;
 
-extern int somaxconn;                  /* patchable (XXX sysctl) */
-int somaxconn = SOMAXCONN;
+extern int     somaxconn;                      /* patchable (XXX sysctl) */
+int            somaxconn = SOMAXCONN;
 
 void
-soinit()
+soinit(void)
 {
 
        pool_init(&socket_pool, sizeof(struct socket), 0, 0, 0,
@@ -74,18 +74,14 @@
  */
 /*ARGSUSED*/
 int
-socreate(dom, aso, type, proto)
-       int dom;
-       struct socket **aso;
-       int type;
-       int proto;
+socreate(int dom, struct socket **aso, int type, int proto)
 {
-       struct proc *p = curproc;               /* XXX */
-       struct protosw *prp;
-       struct socket *so;
-       int error;
-       int s;
+       struct proc     *p;
+       struct protosw  *prp;
+       struct socket   *so;
+       int             error, s;
 
+       p = curproc;            /* XXX */
        if (proto)
                prp = pffindproto(dom, proto, type);
        else
@@ -126,14 +122,11 @@
 }
 
 int
-sobind(so, nam, p)
-       struct socket *so;
-       struct mbuf *nam;
-       struct proc *p;
+sobind(struct socket *so, struct mbuf *nam, struct proc *p)
 {
-       int s = splsoftnet();
-       int error;
+       int     s, error;
 
+       s = splsoftnet();
        error = (*so->so_proto->pr_usrreq)(so, PRU_BIND, (struct mbuf *)0,
            nam, (struct mbuf *)0, p);
        splx(s);
@@ -141,12 +134,11 @@
 }
 
 int
-solisten(so, backlog)
-       struct socket *so;
-       int backlog;
+solisten(struct socket *so, int backlog)
 {
-       int s = splsoftnet(), error;
+       int     s, error;
 
+       s = splsoftnet();
        error = (*so->so_proto->pr_usrreq)(so, PRU_LISTEN, (struct mbuf *)0,
            (struct mbuf *)0, (struct mbuf *)0, (struct proc *)0);
        if (error) {
@@ -163,8 +155,7 @@
 }
 
 void
-sofree(so)
-       struct socket *so;
+sofree(struct socket *so)
 {
 
        if (so->so_pcb || (so->so_state & SS_NOFDREF) == 0)
@@ -189,13 +180,13 @@
  * Free socket when disconnect complete.
  */
 int
-soclose(so)
-       struct socket *so;
+soclose(struct socket *so)
 {
-       struct socket *so2;
-       int s = splsoftnet();           /* conservative */
-       int error = 0;
+       struct socket   *so2;
+       int             s, error;
 
+       error = 0;
+       s = splsoftnet();               /* conservative */
        if (so->so_options & SO_ACCEPTCONN) {
                while ((so2 = so->so_q0.tqh_first) != 0) {
                        (void) soqremque(so2, 0);
@@ -227,7 +218,7 @@
                        }
                }
        }
-drop:
+ drop:
        if (so->so_pcb) {
                int error2 = (*so->so_proto->pr_usrreq)(so, PRU_DETACH,
                    (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0,
@@ -235,7 +226,7 @@
                if (error == 0)
                        error = error2;
        }
-discard:
+ discard:
        if (so->so_state & SS_NOFDREF)
                panic("soclose: NOFDREF");
        so->so_state |= SS_NOFDREF;
@@ -248,8 +239,7 @@
  * Must be called at splsoftnet...
  */
 int
-soabort(so)
-       struct socket *so;
+soabort(struct socket *so)
 {
 
        return (*so->so_proto->pr_usrreq)(so, PRU_ABORT, (struct mbuf *)0,
@@ -257,13 +247,12 @@
 }
 
 int
-soaccept(so, nam)
-       struct socket *so;
-       struct mbuf *nam;
+soaccept(struct socket *so, struct mbuf *nam)
 {
-       int s = splsoftnet();
-       int error = 0;
+       int     s, error;
 
+       error = 0;
+       s = splsoftnet();
        if ((so->so_state & SS_NOFDREF) == 0)
                panic("soaccept: !NOFDREF");
        so->so_state &= ~SS_NOFDREF;
@@ -278,14 +267,12 @@
 }
 
 int
-soconnect(so, nam)
-       struct socket *so;
-       struct mbuf *nam;
+soconnect(struct socket *so, struct mbuf *nam)
 {
-       struct proc *p = curproc;               /* XXX */
-       int s;
-       int error;
+       struct proc     *p;
+       int             s, error;
 
+       p = curproc;            /* XXX */
        if (so->so_options & SO_ACCEPTCONN)
                return (EOPNOTSUPP);
        s = splsoftnet();
@@ -307,13 +294,11 @@
 }
 
 int
-soconnect2(so1, so2)
-       struct socket *so1;
-       struct socket *so2;
+soconnect2(struct socket *so1, struct socket *so2)
 {
-       int s = splsoftnet();
-       int error;
+       int     s, error;
 
+       s = splsoftnet();
        error = (*so1->so_proto->pr_usrreq)(so1, PRU_CONNECT2,
            (struct mbuf *)0, (struct mbuf *)so2, (struct mbuf *)0,
            (struct proc *)0);
@@ -322,12 +307,11 @@
 }
 
 int
-sodisconnect(so)
-       struct socket *so;
+sodisconnect(struct socket *so)
 {
-       int s = splsoftnet();
-       int error;
+       int     s, error;
 
+       s = splsoftnet();
        if ((so->so_state & SS_ISCONNECTED) == 0) {
                error = ENOTCONN;
                goto bad;
@@ -339,7 +323,7 @@
        error = (*so->so_proto->pr_usrreq)(so, PRU_DISCONNECT,
            (struct mbuf *)0, (struct mbuf *)0, (struct mbuf *)0,
            (struct proc *)0);
-bad:
+ bad:
        splx(s);
        return (error);
 }
@@ -363,21 +347,17 @@
  * Data and control buffers are freed on return.
  */
 int
-sosend(so, addr, uio, top, control, flags)
-       struct socket *so;
-       struct mbuf *addr;
-       struct uio *uio;
-       struct mbuf *top;
-       struct mbuf *control;
-       int flags;
+sosend(struct socket *so, struct mbuf *addr, struct uio *uio, struct mbuf *top,
+       struct mbuf *control, int flags)
 {
-       struct proc *p = curproc;               /* XXX */
-       struct mbuf **mp;
-       struct mbuf *m;
-       long space, len, resid;
-       int clen = 0, error, s, dontroute, mlen;
-       int atomic = sosendallatonce(so) || top;
+       struct proc     *p;
+       struct mbuf     **mp, *m;
+       long            space, len, resid;
+       int             clen, error, s, dontroute, mlen, atomic;
 
+       p = curproc;            /* XXX */
+       clen = 0;
+       atomic = sosendallatonce(so) || top;
        if (uio)
                resid = uio->uio_resid;
        else
@@ -401,7 +381,7 @@
                clen = control->m_len;
 #define        snderr(errno)   { error = errno; splx(s); goto release; }
 
-restart:
+ restart:
        if ((error = sblock(&so->so_snd, SBLOCKWAIT(flags))) != 0)
                goto out;
        do {
@@ -469,7 +449,8 @@
                                        len = min(MCLBYTES, resid);
 #else
                                        if (atomic && top == 0) {
-                                               len = min(MCLBYTES - max_hdr, resid);
+                                               len = min(MCLBYTES - max_hdr,
+                                                   resid);
                                                m->m_data += max_hdr;
                                        } else
                                                len = min(MCLBYTES, resid);
@@ -486,7 +467,8 @@
                                        if (atomic && top == 0 && len < mlen)
                                                MH_ALIGN(m, len);
                                }
-                               error = uiomove(mtod(m, caddr_t), (int)len, uio);
+                               error = uiomove(mtod(m, caddr_t), (int)len,
+                                   uio);
                                resid = uio->uio_resid;
                                m->m_len = len;
                                *mp = m;
@@ -528,9 +510,9 @@
                } while (resid && space > 0);
        } while (resid);
 
-release:
+ release:
        sbunlock(&so->so_snd);
-out:
+ out:
        if (top)
                m_freem(top);
        if (control)
@@ -555,22 +537,18 @@
  * only for the count in uio_resid.
  */
 int
-soreceive(so, paddr, uio, mp0, controlp, flagsp)
-       struct socket *so;



Home | Main Index | Thread Index | Old Index