From 8aefbb617959eb71f5ec34bd628b570fc029b63b Mon Sep 17 00:00:00 2001 From: andre Date: Wed, 21 Mar 2007 19:37:55 +0000 Subject: [PATCH] ANSIfy function declarations and remove register keywords for variables. Consistently apply style to all function declarations. --- sys/netinet/tcp_input.c | 74 +++++++++++++------------------------- sys/netinet/tcp_output.c | 3 +- sys/netinet/tcp_reass.c | 74 +++++++++++++------------------------- sys/netinet/tcp_sack.c | 6 ++-- sys/netinet/tcp_subr.c | 8 ++--- sys/netinet/tcp_timer.c | 15 +++----- sys/netinet/tcp_timewait.c | 8 ++--- sys/netinet/tcp_usrreq.c | 31 +++++----------- 8 files changed, 73 insertions(+), 146 deletions(-) diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index e6a78bffa5fd..29a320f1268a 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -236,11 +236,7 @@ tcp_reass_init() } static int -tcp_reass(tp, th, tlenp, m) - register struct tcpcb *tp; - register struct tcphdr *th; - int *tlenp; - struct mbuf *m; +tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m) { struct tseg_qent *q; struct tseg_qent *p = NULL; @@ -310,7 +306,7 @@ tcp_reass(tp, th, tlenp, m) * segment. If it provides all of our data, drop us. */ if (p != NULL) { - register int i; + int i; /* conversion to int (in i) handles seq wraparound */ i = p->tqe_th->th_seq + p->tqe_len - th->th_seq; if (i > 0) { @@ -342,7 +338,7 @@ tcp_reass(tp, th, tlenp, m) * if they are completely covered, dequeue them. */ while (q) { - register int i = (th->th_seq + *tlenp) - q->tqe_th->th_seq; + int i = (th->th_seq + *tlenp) - q->tqe_th->th_seq; if (i <= 0) break; if (i < q->tqe_len) { @@ -408,11 +404,9 @@ present: */ #ifdef INET6 int -tcp6_input(mp, offp, proto) - struct mbuf **mp; - int *offp, proto; +tcp6_input(struct mbuf **mp, int *offp, int proto) { - register struct mbuf *m = *mp; + struct mbuf *m = *mp; struct in6_ifaddr *ia6; IP6_EXTHDR_CHECK(m, *offp, sizeof(struct tcphdr), IPPROTO_DONE); @@ -437,20 +431,18 @@ tcp6_input(mp, offp, proto) #endif void -tcp_input(m, off0) - register struct mbuf *m; - int off0; +tcp_input(struct mbuf *m, int off0) { - register struct tcphdr *th; - register struct ip *ip = NULL; - register struct ipovly *ipov; - register struct inpcb *inp = NULL; + struct tcphdr *th; + struct ip *ip = NULL; + struct ipovly *ipov; + struct inpcb *inp = NULL; u_char *optp = NULL; int optlen = 0; int len, tlen, off; int drop_hdrlen; - register struct tcpcb *tp = 0; - register int thflags; + struct tcpcb *tp = 0; + int thflags; struct socket *so = 0; int todrop, acked, ourfinisacked, needoutput = 0; u_long tiwin; @@ -2137,8 +2129,8 @@ process_ACK: */ if ((!tcp_do_newreno && !tp->sack_enable) || !IN_FASTRECOVERY(tp)) { - register u_int cw = tp->snd_cwnd; - register u_int incr = tp->t_maxseg; + u_int cw = tp->snd_cwnd; + u_int incr = tp->t_maxseg; if (cw > tp->snd_ssthresh) incr = incr * incr / cw; tp->snd_cwnd = min(cw+incr, TCP_MAXWIN<snd_scale); @@ -2597,11 +2589,7 @@ drop: * Parse TCP options and place in tcpopt. */ static void -tcp_dooptions(to, cp, cnt, flags) - struct tcpopt *to; - u_char *cp; - int cnt; - int flags; +tcp_dooptions(struct tcpopt *to, u_char *cp, int cnt, int flags) { int opt, optlen; @@ -2691,11 +2679,8 @@ tcp_dooptions(to, cp, cnt, flags) * sequencing purposes. */ static void -tcp_pulloutofband(so, th, m, off) - struct socket *so; - struct tcphdr *th; - register struct mbuf *m; - int off; /* delayed to be droped hdrlen */ +tcp_pulloutofband(struct socket *so, struct tcphdr *th, struct mbuf *m, + int off) { int cnt = off + th->th_urp - 1; @@ -2725,11 +2710,9 @@ tcp_pulloutofband(so, th, m, off) * and update averages and current timeout. */ static void -tcp_xmit_timer(tp, rtt) - register struct tcpcb *tp; - int rtt; +tcp_xmit_timer(struct tcpcb *tp, int rtt) { - register int delta; + int delta; INP_LOCK_ASSERT(tp->t_inpcb); @@ -2833,9 +2816,7 @@ tcp_xmit_timer(tp, rtt) * segment. Outgoing SYN/ACK MSS settings are handled in tcp_mssopt(). */ void -tcp_mss(tp, offer) - struct tcpcb *tp; - int offer; +tcp_mss(struct tcpcb *tp, int offer) { int rtt, mss; u_long bufsize; @@ -3079,8 +3060,7 @@ tcp_mss(tp, offer) * Determine the MSS option to send on an outgoing SYN. */ int -tcp_mssopt(inc) - struct in_conninfo *inc; +tcp_mssopt(struct in_conninfo *inc) { int mss = 0; u_long maxmtu = 0; @@ -3122,9 +3102,7 @@ tcp_mssopt(inc) * be started again. */ static void -tcp_newreno_partial_ack(tp, th) - struct tcpcb *tp; - struct tcphdr *th; +tcp_newreno_partial_ack(struct tcpcb *tp, struct tcphdr *th) { tcp_seq onxt = tp->snd_nxt; u_long ocwnd = tp->snd_cwnd; @@ -3158,12 +3136,8 @@ tcp_newreno_partial_ack(tp, th) * looking for a pcb in the listen state. Returns 0 otherwise. */ static int -tcp_timewait(inp, to, th, m, tlen) - struct inpcb *inp; - struct tcpopt *to; - struct tcphdr *th; - struct mbuf *m; - int tlen; +tcp_timewait(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th, + struct mbuf *m, int tlen) { struct tcptw *tw; int thflags; diff --git a/sys/netinet/tcp_output.c b/sys/netinet/tcp_output.c index ac1649a0aede..2eec1dce8ece 100644 --- a/sys/netinet/tcp_output.c +++ b/sys/netinet/tcp_output.c @@ -1226,8 +1226,7 @@ out: } void -tcp_setpersist(tp) - register struct tcpcb *tp; +tcp_setpersist(struct tcpcb *tp) { int t = ((tp->t_srtt >> 2) + tp->t_rttvar) >> 1; int tt; diff --git a/sys/netinet/tcp_reass.c b/sys/netinet/tcp_reass.c index e6a78bffa5fd..29a320f1268a 100644 --- a/sys/netinet/tcp_reass.c +++ b/sys/netinet/tcp_reass.c @@ -236,11 +236,7 @@ tcp_reass_init() } static int -tcp_reass(tp, th, tlenp, m) - register struct tcpcb *tp; - register struct tcphdr *th; - int *tlenp; - struct mbuf *m; +tcp_reass(struct tcpcb *tp, struct tcphdr *th, int *tlenp, struct mbuf *m) { struct tseg_qent *q; struct tseg_qent *p = NULL; @@ -310,7 +306,7 @@ tcp_reass(tp, th, tlenp, m) * segment. If it provides all of our data, drop us. */ if (p != NULL) { - register int i; + int i; /* conversion to int (in i) handles seq wraparound */ i = p->tqe_th->th_seq + p->tqe_len - th->th_seq; if (i > 0) { @@ -342,7 +338,7 @@ tcp_reass(tp, th, tlenp, m) * if they are completely covered, dequeue them. */ while (q) { - register int i = (th->th_seq + *tlenp) - q->tqe_th->th_seq; + int i = (th->th_seq + *tlenp) - q->tqe_th->th_seq; if (i <= 0) break; if (i < q->tqe_len) { @@ -408,11 +404,9 @@ present: */ #ifdef INET6 int -tcp6_input(mp, offp, proto) - struct mbuf **mp; - int *offp, proto; +tcp6_input(struct mbuf **mp, int *offp, int proto) { - register struct mbuf *m = *mp; + struct mbuf *m = *mp; struct in6_ifaddr *ia6; IP6_EXTHDR_CHECK(m, *offp, sizeof(struct tcphdr), IPPROTO_DONE); @@ -437,20 +431,18 @@ tcp6_input(mp, offp, proto) #endif void -tcp_input(m, off0) - register struct mbuf *m; - int off0; +tcp_input(struct mbuf *m, int off0) { - register struct tcphdr *th; - register struct ip *ip = NULL; - register struct ipovly *ipov; - register struct inpcb *inp = NULL; + struct tcphdr *th; + struct ip *ip = NULL; + struct ipovly *ipov; + struct inpcb *inp = NULL; u_char *optp = NULL; int optlen = 0; int len, tlen, off; int drop_hdrlen; - register struct tcpcb *tp = 0; - register int thflags; + struct tcpcb *tp = 0; + int thflags; struct socket *so = 0; int todrop, acked, ourfinisacked, needoutput = 0; u_long tiwin; @@ -2137,8 +2129,8 @@ process_ACK: */ if ((!tcp_do_newreno && !tp->sack_enable) || !IN_FASTRECOVERY(tp)) { - register u_int cw = tp->snd_cwnd; - register u_int incr = tp->t_maxseg; + u_int cw = tp->snd_cwnd; + u_int incr = tp->t_maxseg; if (cw > tp->snd_ssthresh) incr = incr * incr / cw; tp->snd_cwnd = min(cw+incr, TCP_MAXWIN<snd_scale); @@ -2597,11 +2589,7 @@ drop: * Parse TCP options and place in tcpopt. */ static void -tcp_dooptions(to, cp, cnt, flags) - struct tcpopt *to; - u_char *cp; - int cnt; - int flags; +tcp_dooptions(struct tcpopt *to, u_char *cp, int cnt, int flags) { int opt, optlen; @@ -2691,11 +2679,8 @@ tcp_dooptions(to, cp, cnt, flags) * sequencing purposes. */ static void -tcp_pulloutofband(so, th, m, off) - struct socket *so; - struct tcphdr *th; - register struct mbuf *m; - int off; /* delayed to be droped hdrlen */ +tcp_pulloutofband(struct socket *so, struct tcphdr *th, struct mbuf *m, + int off) { int cnt = off + th->th_urp - 1; @@ -2725,11 +2710,9 @@ tcp_pulloutofband(so, th, m, off) * and update averages and current timeout. */ static void -tcp_xmit_timer(tp, rtt) - register struct tcpcb *tp; - int rtt; +tcp_xmit_timer(struct tcpcb *tp, int rtt) { - register int delta; + int delta; INP_LOCK_ASSERT(tp->t_inpcb); @@ -2833,9 +2816,7 @@ tcp_xmit_timer(tp, rtt) * segment. Outgoing SYN/ACK MSS settings are handled in tcp_mssopt(). */ void -tcp_mss(tp, offer) - struct tcpcb *tp; - int offer; +tcp_mss(struct tcpcb *tp, int offer) { int rtt, mss; u_long bufsize; @@ -3079,8 +3060,7 @@ tcp_mss(tp, offer) * Determine the MSS option to send on an outgoing SYN. */ int -tcp_mssopt(inc) - struct in_conninfo *inc; +tcp_mssopt(struct in_conninfo *inc) { int mss = 0; u_long maxmtu = 0; @@ -3122,9 +3102,7 @@ tcp_mssopt(inc) * be started again. */ static void -tcp_newreno_partial_ack(tp, th) - struct tcpcb *tp; - struct tcphdr *th; +tcp_newreno_partial_ack(struct tcpcb *tp, struct tcphdr *th) { tcp_seq onxt = tp->snd_nxt; u_long ocwnd = tp->snd_cwnd; @@ -3158,12 +3136,8 @@ tcp_newreno_partial_ack(tp, th) * looking for a pcb in the listen state. Returns 0 otherwise. */ static int -tcp_timewait(inp, to, th, m, tlen) - struct inpcb *inp; - struct tcpopt *to; - struct tcphdr *th; - struct mbuf *m; - int tlen; +tcp_timewait(struct inpcb *inp, struct tcpopt *to, struct tcphdr *th, + struct mbuf *m, int tlen) { struct tcptw *tw; int thflags; diff --git a/sys/netinet/tcp_sack.c b/sys/netinet/tcp_sack.c index f6e85262f3c0..dca7cd4148b6 100644 --- a/sys/netinet/tcp_sack.c +++ b/sys/netinet/tcp_sack.c @@ -319,7 +319,7 @@ tcp_sackhole_free(struct tcpcb *tp, struct sackhole *hole) */ static struct sackhole * tcp_sackhole_insert(struct tcpcb *tp, tcp_seq start, tcp_seq end, - struct sackhole *after) + struct sackhole *after) { struct sackhole *hole; @@ -582,9 +582,7 @@ tcp_free_sackholes(struct tcpcb *tp) * of sack recovery. */ void -tcp_sack_partialack(tp, th) - struct tcpcb *tp; - struct tcphdr *th; +tcp_sack_partialack(struct tcpcb *tp, struct tcphdr *th) { int num_segs = 1; diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c index 2f1e3856e62b..46e7eedcc438 100644 --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -466,10 +466,10 @@ tcpip_maketemplate(struct inpcb *inp) * NOTE: If m != NULL, then ti must point to *inside* the mbuf. */ void -tcp_respond(struct tcpcb *tp, void *ipgen, register struct tcphdr *th, - register struct mbuf *m, tcp_seq ack, tcp_seq seq, int flags) +tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, + struct mbuf *m, tcp_seq ack, tcp_seq seq, int flags) { - register int tlen; + int tlen; int win = 0; struct ip *ip; struct tcphdr *nth; @@ -1058,7 +1058,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) } SYSCTL_PROC(_net_inet_tcp, TCPCTL_PCBLIST, pcblist, CTLFLAG_RD, 0, 0, - tcp_pcblist, "S,xtcpcb", "List of active TCP connections"); + tcp_pcblist, "S,xtcpcb", "List of active TCP connections"); static int tcp_getcred(SYSCTL_HANDLER_ARGS) diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c index 3cfaeadd1720..c46a2b4a5c46 100644 --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -146,8 +146,7 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, timer_race, CTLFLAG_RD, &tcp_timer_race, */ void -tcp_timer_delack(xtp) - void *xtp; +tcp_timer_delack(void *xtp) { struct tcpcb *tp = xtp; struct inpcb *inp; @@ -182,8 +181,7 @@ tcp_timer_delack(xtp) } void -tcp_timer_2msl(xtp) - void *xtp; +tcp_timer_2msl(void *xtp) { struct tcpcb *tp = xtp; struct inpcb *inp; @@ -306,8 +304,7 @@ tcp_timer_2msl_tw(int reuse) } void -tcp_timer_keep(xtp) - void *xtp; +tcp_timer_keep(void *xtp) { struct tcpcb *tp = xtp; struct tcptemp *t_template; @@ -398,8 +395,7 @@ dropit: } void -tcp_timer_persist(xtp) - void *xtp; +tcp_timer_persist(void *xtp) { struct tcpcb *tp = xtp; struct inpcb *inp; @@ -465,8 +461,7 @@ out: } void -tcp_timer_rexmt(xtp) - void *xtp; +tcp_timer_rexmt(void * xtp) { struct tcpcb *tp = xtp; int rexmt; diff --git a/sys/netinet/tcp_timewait.c b/sys/netinet/tcp_timewait.c index 2f1e3856e62b..46e7eedcc438 100644 --- a/sys/netinet/tcp_timewait.c +++ b/sys/netinet/tcp_timewait.c @@ -466,10 +466,10 @@ tcpip_maketemplate(struct inpcb *inp) * NOTE: If m != NULL, then ti must point to *inside* the mbuf. */ void -tcp_respond(struct tcpcb *tp, void *ipgen, register struct tcphdr *th, - register struct mbuf *m, tcp_seq ack, tcp_seq seq, int flags) +tcp_respond(struct tcpcb *tp, void *ipgen, struct tcphdr *th, + struct mbuf *m, tcp_seq ack, tcp_seq seq, int flags) { - register int tlen; + int tlen; int win = 0; struct ip *ip; struct tcphdr *nth; @@ -1058,7 +1058,7 @@ tcp_pcblist(SYSCTL_HANDLER_ARGS) } SYSCTL_PROC(_net_inet_tcp, TCPCTL_PCBLIST, pcblist, CTLFLAG_RD, 0, 0, - tcp_pcblist, "S,xtcpcb", "List of active TCP connections"); + tcp_pcblist, "S,xtcpcb", "List of active TCP connections"); static int tcp_getcred(SYSCTL_HANDLER_ARGS) diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index da1b87689c7d..51e659b5ac34 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -777,7 +777,7 @@ out: */ static int tcp_usr_send(struct socket *so, int flags, struct mbuf *m, - struct sockaddr *nam, struct mbuf *control, struct thread *td) + struct sockaddr *nam, struct mbuf *control, struct thread *td) { int error = 0; struct inpcb *inp; @@ -1100,10 +1100,7 @@ struct pr_usrreqs tcp6_usrreqs = { * Initialize connection parameters and enter SYN-SENT state. */ static int -tcp_connect(tp, nam, td) - register struct tcpcb *tp; - struct sockaddr *nam; - struct thread *td; +tcp_connect(struct tcpcb *tp, struct sockaddr *nam, struct thread *td) { struct inpcb *inp = tp->t_inpcb, *oinp; struct socket *so = inp->inp_socket; @@ -1159,10 +1156,7 @@ tcp_connect(tp, nam, td) #ifdef INET6 static int -tcp6_connect(tp, nam, td) - register struct tcpcb *tp; - struct sockaddr *nam; - struct thread *td; +tcp6_connect(struct tcpcb *tp, struct sockaddr *nam, struct thread *td) { struct inpcb *inp = tp->t_inpcb, *oinp; struct socket *so = inp->inp_socket; @@ -1232,9 +1226,7 @@ tcp6_connect(tp, nam, td) * from Linux. */ static void -tcp_fill_info(tp, ti) - struct tcpcb *tp; - struct tcp_info *ti; +tcp_fill_info(struct tcpcb *tp, struct tcp_info *ti) { INP_LOCK_ASSERT(tp->t_inpcb); @@ -1276,9 +1268,7 @@ tcp_fill_info(tp, ti) * the inpcb lock. */ int -tcp_ctloutput(so, sopt) - struct socket *so; - struct sockopt *sopt; +tcp_ctloutput(struct socket *so, struct sockopt *sopt) { int error, opt, optval; struct inpcb *inp; @@ -1440,10 +1430,9 @@ SYSCTL_ULONG(_net_inet_tcp, TCPCTL_RECVSPACE, recvspace, CTLFLAG_RW, * bufer space, and entering LISTEN state if to accept connections. */ static int -tcp_attach(so) - struct socket *so; +tcp_attach(struct socket *so) { - register struct tcpcb *tp; + struct tcpcb *tp; struct inpcb *inp; int error; #ifdef INET6 @@ -1503,8 +1492,7 @@ tcp_attach(so) * send segment to peer (with FIN). */ static void -tcp_disconnect(tp) - register struct tcpcb *tp; +tcp_disconnect(struct tcpcb *tp) { struct inpcb *inp = tp->t_inpcb; struct socket *so = inp->inp_socket; @@ -1544,8 +1532,7 @@ tcp_disconnect(tp) * We can let the user exit from the close as soon as the FIN is acked. */ static void -tcp_usrclosed(tp) - register struct tcpcb *tp; +tcp_usrclosed(struct tcpcb *tp) { INP_INFO_WLOCK_ASSERT(&tcbinfo);