ANSIfication to sys/kern/ uipc_*

看板DFBSD_submit作者時間21年前 (2004/06/03 17:32), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
This is a multi-part message in MIME format. --------------090103020203040701090305 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit ANSIfication and minor cleanup to sys/kern uipc_domain.c uipc_mbuf.c uipc.mbuf2.c uipc_socket.c uipc_socket2.c usrreq.c -- Tim Wickberg me@k9mach3.org --------------090103020203040701090305 Content-Type: text/plain; name="uipc_domain.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="uipc_domain.c.diff" --- /usr/src/sys/kern/uipc_domain.c 2003-08-26 17:09:02.000000000 -0400 +++ uipc_domain.c 2004-06-02 20:19:40.000000000 -0400 @@ -142,11 +142,8 @@ timeout(pfslowtimo, (void *)0, 1); } - struct protosw * -pffindtype(family, type) - int family; - int type; +pffindtype(int family, int type) { struct domain *dp; struct protosw *pr; @@ -163,10 +160,7 @@ } struct protosw * -pffindproto(family, protocol, type) - int family; - int protocol; - int type; +pffindproto(int family, int protocol, int type) { struct domain *dp; struct protosw *pr; @@ -191,9 +185,7 @@ } void -pfctlinput(cmd, sa) - int cmd; - struct sockaddr *sa; +pfctlinput(int cmd, struct sockaddr *sa) { struct domain *dp; struct protosw *pr; @@ -205,10 +197,7 @@ } void -pfctlinput2(cmd, sa, ctlparam) - int cmd; - struct sockaddr *sa; - void *ctlparam; +pfctlinput2(int cmd, struct sockaddr *sa, void *ctlparam) { struct domain *dp; struct protosw *pr; @@ -231,8 +220,7 @@ } static void -pfslowtimo(arg) - void *arg; +pfslowtimo(void *arg) { struct domain *dp; struct protosw *pr; @@ -245,8 +233,7 @@ } static void -pffasttimo(arg) - void *arg; +pffasttimo(void *arg) { struct domain *dp; struct protosw *pr; --------------090103020203040701090305 Content-Type: text/plain; name="uipc_mbuf.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="uipc_mbuf.c.diff" --- /usr/src/sys/kern/uipc_mbuf.c 2004-06-02 10:42:57.000000000 -0400 +++ uipc_mbuf.c 2004-06-02 21:11:46.000000000 -0400 @@ -152,8 +152,7 @@ /* ARGSUSED*/ static void -mbinit(dummy) - void *dummy; +mbinit(void *dummy) { int s; @@ -187,9 +186,7 @@ */ /* ARGSUSED */ int -m_mballoc(nmb, how) - int nmb; - int how; +m_mballoc(int nmb, int how) { caddr_t p; int i; @@ -324,9 +321,7 @@ */ /* ARGSUSED */ int -m_clalloc(ncl, how) - int ncl; - int how; +m_clalloc(int ncl, int how) { caddr_t p; int i; @@ -433,8 +428,7 @@ * then re-attempt to allocate an mbuf. */ struct mbuf * -m_retry(i, t) - int i, t; +m_retry(int i, int t) { struct mbuf *m; int ms; @@ -481,8 +475,7 @@ * As above; retry an MGETHDR. */ struct mbuf * -m_retryhdr(i, t) - int i, t; +m_retryhdr(int i, int t) { struct mbuf *m; int ms; @@ -549,8 +542,7 @@ * for critical paths. */ struct mbuf * -m_get(how, type) - int how, type; +m_get(int how, int type) { struct mbuf *m; int ms; @@ -579,8 +571,7 @@ } struct mbuf * -m_gethdr(how, type) - int how, type; +m_gethdr(int how, int type) { struct mbuf *m; int ms; @@ -612,8 +603,7 @@ } struct mbuf * -m_getclr(how, type) - int how, type; +m_getclr(int how, int type) { struct mbuf *m; @@ -889,9 +879,7 @@ * copy junk along. */ struct mbuf * -m_prepend(m, len, how) - struct mbuf *m; - int len, how; +m_prepend(struct mbuf *m, int len, int how) { struct mbuf *mn; @@ -920,10 +908,7 @@ #define MCFail (mbstat.m_mcfail) struct mbuf * -m_copym(m, off0, len, wait) - const struct mbuf *m; - int off0, wait; - int len; +m_copym(const struct mbuf *m, int off0, int len, int wait) { struct mbuf *n, **np; int off = off0; @@ -977,9 +962,10 @@ } n->m_ext = m->m_ext; n->m_flags |= M_EXT; - } else + } else { bcopy(mtod(m, caddr_t)+off, mtod(n, caddr_t), (unsigned)n->m_len); + } if (len != M_COPYALL) len -= n->m_len; off = 0; @@ -1005,9 +991,7 @@ * the copies also have the room available. */ struct mbuf * -m_copypacket(m, how) - struct mbuf *m; - int how; +m_copypacket(struct mbuf *m, int how) { struct mbuf *top, *n, *o; @@ -1079,11 +1063,7 @@ * continuing for "len" bytes, into the indicated buffer. */ void -m_copydata(m, off, len, cp) - const struct mbuf *m; - int off; - int len; - caddr_t cp; +m_copydata(const struct mbuf *m, int off, int len, caddr_t cp) { unsigned count; @@ -1113,9 +1093,7 @@ * you need a writable copy of an mbuf chain. */ struct mbuf * -m_dup(m, how) - struct mbuf *m; - int how; +m_dup(struct mbuf *m, int how) { struct mbuf **p, *top = NULL; int remain, moff, nsize; @@ -1188,8 +1166,7 @@ * Any m_pkthdr is not updated. */ void -m_cat(m, n) - struct mbuf *m, *n; +m_cat(struct mbuf *m, struct mbuf *n) { while (m->m_next) m = m->m_next; @@ -1209,9 +1186,7 @@ } void -m_adj(mp, req_len) - struct mbuf *mp; - int req_len; +m_adj(struct mbuf *mp, int req_len) { int len = req_len; struct mbuf *m; @@ -1293,9 +1268,7 @@ #define MPFail (mbstat.m_mpfail) struct mbuf * -m_pullup(n, len) - struct mbuf *n; - int len; +m_pullup(struct mbuf *n, int len) { struct mbuf *m; int count; @@ -1327,7 +1300,7 @@ do { count = min(min(max(len, max_protohdr), space), n->m_len); bcopy(mtod(n, caddr_t), mtod(m, caddr_t) + m->m_len, - (unsigned)count); + (unsigned)count); len -= count; m->m_len += count; n->m_len -= count; @@ -1360,9 +1333,7 @@ * M_WRITABLE() macro to check for this case. */ struct mbuf * -m_split(m0, len0, wait) - struct mbuf *m0; - int len0, wait; +m_split(struct mbuf *m0, int len0, int wait) { struct mbuf *m, *n; unsigned len = len0, remain; @@ -1427,15 +1398,13 @@ m->m_next = 0; return (n); } + /* * Routine to copy from device local memory into mbufs. */ struct mbuf * -m_devget(buf, totlen, off0, ifp, copy) - char *buf; - int totlen, off0; - struct ifnet *ifp; - void (*copy) (char *from, caddr_t to, u_int len); +m_devget(char *buf, int totlen, int off0, struct ifnet *ifp, + void (*copy) (char *from, caddr_t to, u_int len)) { struct mbuf *m; struct mbuf *top = 0, **mp = ⊤ @@ -1503,11 +1472,7 @@ * chain if necessary. */ void -m_copyback(m0, off, len, cp) - struct mbuf *m0; - int off; - int len; - caddr_t cp; +m_copyback(struct mbuf *m0, int off, int len, caddr_t cp) { int mlen; struct mbuf *m = m0, *n; @@ -1612,8 +1577,8 @@ struct mbuf * m_defrag(struct mbuf *m0, int how) { - struct mbuf *m_new = NULL, *m_final = NULL; - int progress = 0, length; + struct mbuf *m_new = NULL, *m_final = NULL; + int progress = 0, length; if (!(m0->m_flags & M_PKTHDR)) return (m0); --------------090103020203040701090305 Content-Type: text/plain; name="uipc_mbuf2.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="uipc_mbuf2.c.diff" --- /usr/src/sys/kern/uipc_mbuf2.c 2004-06-02 10:42:57.000000000 -0400 +++ uipc_mbuf2.c 2004-06-02 20:14:46.000000000 -0400 @@ -96,10 +96,7 @@ * XXX M_TRAILINGSPACE/M_LEADINGSPACE on shared cluster (sharedcluster) */ struct mbuf * -m_pulldown(m, off, len, offp) - struct mbuf *m; - int off, len; - int *offp; +m_pulldown(struct mbuf *m, int off, int len, int *offp) { struct mbuf *n, *o; int hlen, tlen, olen; @@ -253,11 +250,7 @@ } static struct mbuf * -m_dup1(m, off, len, wait) - struct mbuf *m; - int off; - int len; - int wait; +m_dup1(struct mbuf *m, int off, int len, int wait) { struct mbuf *n; int l; --------------090103020203040701090305 Content-Type: text/plain; name="uipc_socket.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="uipc_socket.c.diff" --- /usr/src/sys/kern/uipc_socket.c 2004-06-02 10:42:57.000000000 -0400 +++ uipc_socket.c 2004-06-02 20:29:03.000000000 -0400 @@ -107,8 +107,7 @@ * the protocols can be easily modified to do this. */ struct socket * -soalloc(waitok) - int waitok; +soalloc(int waitok) { struct socket *so; @@ -126,7 +125,7 @@ int socreate(int dom, struct socket **aso, int type, - int proto, struct thread *td) + int proto, struct thread *td) { struct proc *p = td->td_proc; struct protosw *prp; @@ -330,8 +329,7 @@ * Must be called at splnet... */ int -soabort(so) - struct socket *so; +soabort(struct socket *so) { int error; @@ -433,8 +431,7 @@ */ int sosend(struct socket *so, struct sockaddr *addr, struct uio *uio, - struct mbuf *top, struct mbuf *control, int flags, - struct thread *td) + struct mbuf *top, struct mbuf *control, int flags, struct thread *td) { struct mbuf **mp; struct mbuf *m; @@ -644,7 +641,7 @@ */ int sosendudp(struct socket *so, struct sockaddr *addr, struct uio *uio, - struct mbuf *top, struct mbuf *control, int flags, struct thread *td) + struct mbuf *top, struct mbuf *control, int flags, struct thread *td) { int resid, error, s; boolean_t dontroute; /* temporary SO_DONTROUTE setting */ @@ -728,13 +725,8 @@ * only for the count in uio_resid. */ int -soreceive(so, psa, uio, mp0, controlp, flagsp) - struct socket *so; - struct sockaddr **psa; - struct uio *uio; - struct mbuf **mp0; - struct mbuf **controlp; - int *flagsp; +soreceive(struct socket *so, struct sockaddr **psa, struct uio *uio, + struct mbuf **mp0, struct mbuf **controlp, int *flagsp) { struct mbuf *m, **mp; int flags, len, error, s, offset; @@ -1023,9 +1015,7 @@ } int -soshutdown(so, how) - struct socket *so; - int how; +soshutdown(struct socket *so, int how) { if (!(how == SHUT_RD || how == SHUT_WR || how == SHUT_RDWR)) return (EINVAL); @@ -1038,8 +1028,7 @@ } void -sorflush(so) - struct socket *so; +sorflush(struct socket *so) { struct sockbuf *sb = &so->so_rcv; struct protosw *pr = so->so_proto; @@ -1065,14 +1054,12 @@ #ifdef INET static int -do_setopt_accept_filter(so, sopt) - struct socket *so; - struct sockopt *sopt; -{ - struct accept_filter_arg *afap = NULL; - struct accept_filter *afp; - struct so_accf *af = so->so_accf; - int error = 0; +do_setopt_accept_filter(struct socket *so, struct sockopt *sopt) +{ + struct accept_filter_arg *afap = NULL; + struct accept_filter *afp; + struct so_accf *af = so->so_accf; + int error = 0; /* do not set/remove accept filters on non listen sockets */ if ((so->so_options & SO_ACCEPTCONN) == 0) { @@ -1150,13 +1137,9 @@ * protocol-level pr_ctloutput() routines. */ int -sooptcopyin(sopt, buf, len, minlen) - struct sockopt *sopt; - void *buf; - size_t len; - size_t minlen; +sooptcopyin(struct sockopt *sopt, void *buf, size_t len, size_t minlen) { - size_t valsize; + size_t valsize; /* * If the user gives us more than we wanted, we ignore it, @@ -1177,14 +1160,12 @@ } int -sosetopt(so, sopt) - struct socket *so; - struct sockopt *sopt; +sosetopt(struct socket *so, struct sockopt *sopt) { - int error, optval; - struct linger l; - struct timeval tv; - u_long val; + int error, optval; + struct linger l; + struct timeval tv; + u_long val; error = 0; if (sopt->sopt_level != SOL_SOCKET) { @@ -1327,8 +1308,8 @@ int sooptcopyout(struct sockopt *sopt, const void *buf, size_t len) { - int error; - size_t valsize; + int error; + size_t valsize; error = 0; @@ -1353,13 +1334,11 @@ } int -sogetopt(so, sopt) - struct socket *so; - struct sockopt *sopt; +sogetopt(struct socket *so, struct sockopt *sopt) { - int error, optval; - struct linger l; - struct timeval tv; + int error, optval; + struct linger l; + struct timeval tv; #ifdef INET struct accept_filter_arg *afap; #endif @@ -1564,8 +1543,7 @@ } void -sohasoutofband(so) - struct socket *so; +sohasoutofband(struct socket *so) { if (so->so_sigio != NULL) pgsigio(so->so_sigio, SIGURG, 0); --------------090103020203040701090305 Content-Type: text/plain; name="uipc_socket2.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="uipc_socket2.c.diff" --- /usr/src/sys/kern/uipc_socket2.c 2004-06-02 10:42:57.000000000 -0400 +++ uipc_socket2.c 2004-06-02 20:37:33.000000000 -0400 @@ -100,17 +100,14 @@ */ void -soisconnecting(so) - struct socket *so; +soisconnecting(struct socket *so) { - so->so_state &= ~(SS_ISCONNECTED|SS_ISDISCONNECTING); so->so_state |= SS_ISCONNECTING; } void -soisconnected(so) - struct socket *so; +soisconnected(struct socket *so) { struct socket *head = so->so_head; @@ -141,10 +138,8 @@ } void -soisdisconnecting(so) - struct socket *so; +soisdisconnecting(struct socket *so) { - so->so_state &= ~SS_ISCONNECTING; so->so_state |= (SS_ISDISCONNECTING|SS_CANTRCVMORE|SS_CANTSENDMORE); wakeup((caddr_t)&so->so_timeo); @@ -153,10 +148,8 @@ } void -soisdisconnected(so) - struct socket *so; +soisdisconnected(struct socket *so) { - so->so_state &= ~(SS_ISCONNECTING|SS_ISCONNECTED|SS_ISDISCONNECTING); so->so_state |= (SS_CANTRCVMORE|SS_CANTSENDMORE|SS_ISDISCONNECTED); wakeup((caddr_t)&so->so_timeo); @@ -237,19 +230,15 @@ */ void -socantsendmore(so) - struct socket *so; +socantsendmore(struct socket *so) { - so->so_state |= SS_CANTSENDMORE; sowwakeup(so); } void -socantrcvmore(so) - struct socket *so; +socantrcvmore(struct socket *so) { - so->so_state |= SS_CANTRCVMORE; sorwakeup(so); } @@ -258,10 +247,8 @@ * Wait for data to arrive at/drain from a socket buffer. */ int -sbwait(sb) - struct sockbuf *sb; +sbwait(struct sockbuf *sb) { - sb->sb_flags |= SB_WAIT; return (tsleep((caddr_t)&sb->sb_cc, ((sb->sb_flags & SB_NOINTR) ? 0 : PCATCH), @@ -274,8 +261,7 @@ * return any error returned from sleep (EINTR). */ int -sb_lock(sb) - struct sockbuf *sb; +sb_lock(struct sockbuf *sb) { int error; @@ -296,9 +282,7 @@ * via SIGIO if the socket has the SS_ASYNC flag set. */ void -sowakeup(so, sb) - struct socket *so; - struct sockbuf *sb; +sowakeup(struct socket *so, struct sockbuf *sb) { struct selinfo *selinfo = &sb->sb_sel; @@ -431,9 +415,7 @@ * Free mbufs held by a socket, and reserved mbuf space. */ void -sbrelease(sb, so) - struct sockbuf *sb; - struct socket *so; +sbrelease(struct sockbuf *sb, struct socket *so) { sbflush(sb); @@ -474,9 +456,7 @@ * discarded and mbufs are compacted where possible. */ void -sbappend(sb, m) - struct sockbuf *sb; - struct mbuf *m; +sbappend(struct sockbuf *sb, struct mbuf *m) { struct mbuf *n; @@ -498,8 +478,7 @@ #ifdef SOCKBUF_DEBUG void -sbcheck(sb) - struct sockbuf *sb; +sbcheck(struct sockbuf *sb) { struct mbuf *m; struct mbuf *n = 0; @@ -527,9 +506,7 @@ * begins a new record. */ void -sbappendrecord(sb, m0) - struct sockbuf *sb; - struct mbuf *m0; +sbappendrecord(struct sockbuf *sb, struct mbuf *m0) { struct mbuf *m; @@ -563,9 +540,7 @@ * but after any other OOB data. */ void -sbinsertoob(sb, m0) - struct sockbuf *sb; - struct mbuf *m0; +sbinsertoob(struct sockbuf *sb, struct mbuf *m0) { struct mbuf *m; struct mbuf **mp; @@ -610,10 +585,8 @@ * Returns 0 if no space in sockbuf or insufficient mbufs. */ int -sbappendaddr(sb, asa, m0, control) - struct sockbuf *sb; - struct sockaddr *asa; - struct mbuf *m0, *control; +sbappendaddr(struct sockbuf *sb, struct sockaddr *asa, + struct mbuf *m0, struct mbuf *control) { struct mbuf *m, *n; int space = asa->sa_len; @@ -655,9 +628,7 @@ } int -sbappendcontrol(sb, m0, control) - struct sockbuf *sb; - struct mbuf *control, *m0; +sbappendcontrol(struct sockbuf *sb, struct mbuf *m0, struct mbuf *control) { struct mbuf *m, *n; int space = 0; @@ -693,9 +664,7 @@ * is null, the buffer is presumed empty. */ void -sbcompress(sb, m, n) - struct sockbuf *sb; - struct mbuf *m, *n; +sbcompress(struct sockbuf *sb, struct mbuf *m, struct mbuf *n) { int eor = 0; struct mbuf *o; @@ -744,10 +713,8 @@ * Check that all resources are reclaimed. */ void -sbflush(sb) - struct sockbuf *sb; +sbflush(struct sockbuf *sb) { - if (sb->sb_flags & SB_LOCK) panic("sbflush: locked"); while (sb->sb_mbcnt) { @@ -767,9 +734,7 @@ * Drop data from (the front of) a sockbuf. */ void -sbdrop(sb, len) - struct sockbuf *sb; - int len; +sbdrop(struct sockbuf *sb, int len) { struct mbuf *m; struct mbuf *next; @@ -809,8 +774,7 @@ * and move the next record to the front. */ void -sbdroprecord(sb) - struct sockbuf *sb; +sbdroprecord(struct sockbuf *sb) { struct mbuf *m; @@ -829,10 +793,7 @@ * with the specified type for presentation on a socket buffer. */ struct mbuf * -sbcreatecontrol(p, size, type, level) - caddr_t p; - int size; - int type, level; +sbcreatecontrol(caddr_t p, int size, int type, int level) { struct cmsghdr *cp; struct mbuf *m; @@ -923,9 +884,7 @@ * Make a copy of a sockaddr in a malloced buffer of type M_SONAME. */ struct sockaddr * -dup_sockaddr(sa, canwait) - struct sockaddr *sa; - int canwait; +dup_sockaddr(struct sockaddr *sa, int canwait) { struct sockaddr *sa2; --------------090103020203040701090305 Content-Type: text/plain; name="uipc_usrreq.c.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="uipc_usrreq.c.diff" --- /usr/src/sys/kern/uipc_usrreq.c 2004-06-02 10:42:57.000000000 -0400 +++ uipc_usrreq.c 2004-06-02 20:43:25.000000000 -0400 @@ -549,8 +549,7 @@ } static void -unp_detach(unp) - struct unpcb *unp; +unp_detach(struct unpcb *unp) { LIST_REMOVE(unp, unp_link); unp->unp_gencnt = ++unp_gencnt; @@ -720,9 +719,7 @@ } int -unp_connect2(so, so2) - struct socket *so; - struct socket *so2; +unp_connect2(struct socket *so, struct socket *so2) { struct unpcb *unp = sotounpcb(so); struct unpcb *unp2; @@ -751,8 +748,7 @@ } static void -unp_disconnect(unp) - struct unpcb *unp; +unp_disconnect(struct unpcb *unp) { struct unpcb *unp2 = unp->unp_conn; @@ -776,10 +772,8 @@ #ifdef notdef void -unp_abort(unp) - struct unpcb *unp; +unp_abort(struct unpcb *unp) { - unp_detach(unp); } #endif @@ -900,8 +894,7 @@ "List of active local stream sockets"); static void -unp_shutdown(unp) - struct unpcb *unp; +unp_shutdown(struct unpcb *unp) { struct socket *so; @@ -911,9 +904,7 @@ } static void -unp_drop(unp, errno) - struct unpcb *unp; - int errno; +unp_drop(struct unpcb *unp, int errno) { struct socket *so = unp->unp_socket; @@ -1307,9 +1298,7 @@ } static void -unp_scan(m0, op) - struct mbuf *m0; - void (*op) (struct file *); +unp_scan(struct mbuf *m0, void (*op) (struct file *)) { struct mbuf *m; struct file **rp; @@ -1338,10 +1327,8 @@ } static void -unp_mark(fp) - struct file *fp; +unp_mark(struct file *fp) { - if (fp->f_flag & FMARK) return; unp_defer++; @@ -1349,10 +1336,8 @@ } static void -unp_discard(fp) - struct file *fp; +unp_discard(struct file *fp) { - fp->f_msgcount--; unp_rights--; (void) closef(fp, NULL); --------------090103020203040701090305--
文章代碼(AID): #10ll0L00 (DFBSD_submit)