From 972aaf598c3dd94b766cd860a8efda7dc734015b Mon Sep 17 00:00:00 2001 From: rwatson Date: Fri, 11 May 2007 10:38:34 +0000 Subject: [PATCH] Use ANSI C function declarations throughout netipx. Remove 'register' use. --- sys/netipx/ipx.c | 42 ++++++++------------- sys/netipx/ipx.h | 4 +- sys/netipx/ipx_cksum.c | 3 +- sys/netipx/ipx_if.h | 2 +- sys/netipx/ipx_input.c | 34 ++++++++--------- sys/netipx/ipx_outputfl.c | 14 +++---- sys/netipx/ipx_pcb.c | 49 ++++++++---------------- sys/netipx/ipx_pcb.h | 9 ++--- sys/netipx/ipx_usrreq.c | 79 ++++++++++++--------------------------- sys/netipx/ipx_var.h | 2 +- sys/netipx/spx_debug.c | 8 +--- sys/netipx/spx_debug.h | 4 +- 12 files changed, 88 insertions(+), 162 deletions(-) diff --git a/sys/netipx/ipx.c b/sys/netipx/ipx.c index 3608b57a4662..fa8252a13516 100644 --- a/sys/netipx/ipx.c +++ b/sys/netipx/ipx.c @@ -89,16 +89,12 @@ static int ipx_ifinit(struct ifnet *ifp, struct ipx_ifaddr *ia, * Generic internet control operations (ioctl's). */ int -ipx_control(so, cmd, data, ifp, td) - struct socket *so; - u_long cmd; - caddr_t data; - register struct ifnet *ifp; - struct thread *td; +ipx_control(struct socket *so, u_long cmd, caddr_t data, struct ifnet *ifp, + struct thread *td) { - register struct ifreq *ifr = (struct ifreq *)data; - register struct ipx_aliasreq *ifra = (struct ipx_aliasreq *)data; - register struct ipx_ifaddr *ia; + struct ifreq *ifr = (struct ifreq *)data; + struct ipx_aliasreq *ifra = (struct ipx_aliasreq *)data; + struct ipx_ifaddr *ia; struct ifaddr *ifa; struct ipx_ifaddr *oia; int dstIsNew, hostIsNew; @@ -262,10 +258,9 @@ ipx_control(so, cmd, data, ifp, td) * Delete any previous route for an old address. */ static void -ipx_ifscrub(ifp, ia) - register struct ifnet *ifp; - register struct ipx_ifaddr *ia; +ipx_ifscrub(struct ifnet *ifp, struct ipx_ifaddr *ia) { + if (ia->ia_flags & IFA_ROUTE) { if (ifp->if_flags & IFF_POINTOPOINT) { rtinit(&(ia->ia_ifa), (int)RTM_DELETE, RTF_HOST); @@ -279,11 +274,8 @@ ipx_ifscrub(ifp, ia) * and routing table entry. */ static int -ipx_ifinit(ifp, ia, sipx, scrub) - register struct ifnet *ifp; - register struct ipx_ifaddr *ia; - register struct sockaddr_ipx *sipx; - int scrub; +ipx_ifinit(struct ifnet *ifp, struct ipx_ifaddr *ia, + struct sockaddr_ipx *sipx, int scrub) { struct sockaddr_ipx oldaddr; int s = splimp(), error; @@ -335,12 +327,11 @@ ipx_ifinit(ifp, ia, sipx, scrub) * Return address info for specified internet network. */ struct ipx_ifaddr * -ipx_iaonnetof(dst) - register struct ipx_addr *dst; +ipx_iaonnetof(struct ipx_addr *dst) { - register struct ipx_ifaddr *ia; - register struct ipx_addr *compare; - register struct ifnet *ifp; + struct ipx_ifaddr *ia; + struct ipx_addr *compare; + struct ifnet *ifp; struct ipx_ifaddr *ia_maybe = NULL; union ipx_net net = dst->x_net; @@ -363,13 +354,12 @@ ipx_iaonnetof(dst) void -ipx_printhost(addr) -register struct ipx_addr *addr; +ipx_printhost(struct ipx_addr *addr) { u_short port; struct ipx_addr work = *addr; - register char *p; register u_char *q; - register char *net = "", *host = ""; + char *p; u_char *q; + char *net = "", *host = ""; char cport[10], chost[15], cnet[15]; port = ntohs(work.x_port); diff --git a/sys/netipx/ipx.h b/sys/netipx/ipx.h index db1784fa1dcf..c0ef8224e208 100644 --- a/sys/netipx/ipx.h +++ b/sys/netipx/ipx.h @@ -187,8 +187,8 @@ struct ipx { #include __BEGIN_DECLS -struct ipx_addr ipx_addr(const char *); -char *ipx_ntoa(struct ipx_addr); +struct ipx_addr ipx_addr(const char *); +char *ipx_ntoa(struct ipx_addr); __END_DECLS #endif /* !_NETIPX_IPX_H_ */ diff --git a/sys/netipx/ipx_cksum.c b/sys/netipx/ipx_cksum.c index 3545b524385b..6aa87fbba168 100644 --- a/sys/netipx/ipx_cksum.c +++ b/sys/netipx/ipx_cksum.c @@ -73,7 +73,8 @@ __FBSDID("$FreeBSD$"); #define SUMADV sum += *w++ u_short -ipx_cksum(struct mbuf *m, int len) { +ipx_cksum(struct mbuf *m, int len) +{ u_int32_t sum = 0; u_char *w; u_char oldtc; diff --git a/sys/netipx/ipx_if.h b/sys/netipx/ipx_if.h index 5958d22ed9f3..07d1c73654a5 100644 --- a/sys/netipx/ipx_if.h +++ b/sys/netipx/ipx_if.h @@ -115,7 +115,7 @@ struct ipxip_req { #ifdef _KERNEL extern struct ipx_ifaddr *ipx_ifaddr; -struct ipx_ifaddr *ipx_iaonnetof(struct ipx_addr *dst); +struct ipx_ifaddr *ipx_iaonnetof(struct ipx_addr *dst); #endif #endif /* !_NETIPX_IPX_IF_H_ */ diff --git a/sys/netipx/ipx_input.c b/sys/netipx/ipx_input.c index 166ffdea70e1..e57586cfad92 100644 --- a/sys/netipx/ipx_input.c +++ b/sys/netipx/ipx_input.c @@ -134,7 +134,7 @@ static void ipxintr(struct mbuf *m); */ void -ipx_init() +ipx_init(void) { read_random(&ipx_pexseq, sizeof ipx_pexseq); @@ -162,8 +162,8 @@ ipx_init() static void ipxintr(struct mbuf *m) { - register struct ipx *ipx; - register struct ipxpcb *ipxp; + struct ipx *ipx; + struct ipxpcb *ipxp; struct ipx_ifaddr *ia; int len; @@ -334,11 +334,10 @@ static struct route ipx_droute; static struct route ipx_sroute; static void -ipx_forward(m) -struct mbuf *m; +ipx_forward(struct mbuf *m) { - register struct ipx *ipx = mtod(m, struct ipx *); - register int error; + struct ipx *ipx = mtod(m, struct ipx *); + int error; int agedelta = 1; int flags = IPX_FORWARDING; int ok_there = 0; @@ -424,9 +423,7 @@ struct mbuf *m; } static int -ipx_do_route(src, ro) -struct ipx_addr *src; -struct route *ro; +ipx_do_route(struct ipx_addr *src, struct route *ro) { struct sockaddr_ipx *dst; @@ -446,9 +443,9 @@ struct route *ro; } static void -ipx_undo_route(ro) -register struct route *ro; +ipx_undo_route(struct route *ro) { + if (ro->ro_rt != NULL) { RTFREE(ro->ro_rt); } @@ -459,13 +456,12 @@ register struct route *ro; * back into the socket code from the IPX output path. */ void -ipx_watch_output(m, ifp) -struct mbuf *m; -struct ifnet *ifp; +ipx_watch_output(struct mbuf *m, struct ifnet *ifp) { - register struct ipxpcb *ipxp; - register struct ifaddr *ifa; - register struct ipx_ifaddr *ia; + struct ipxpcb *ipxp; + struct ifaddr *ifa; + struct ipx_ifaddr *ia; + /* * Give any raw listeners a crack at the packet */ @@ -473,7 +469,7 @@ struct ifnet *ifp; LIST_FOREACH(ipxp, &ipxrawpcb_list, ipxp_list) { struct mbuf *m0 = m_copy(m, 0, (int)M_COPYALL); if (m0 != NULL) { - register struct ipx *ipx; + struct ipx *ipx; M_PREPEND(m0, sizeof(*ipx), M_DONTWAIT); if (m0 == NULL) diff --git a/sys/netipx/ipx_outputfl.c b/sys/netipx/ipx_outputfl.c index df16bdeb94b7..61d8759ee55c 100644 --- a/sys/netipx/ipx_outputfl.c +++ b/sys/netipx/ipx_outputfl.c @@ -77,13 +77,10 @@ __FBSDID("$FreeBSD$"); static int ipx_copy_output = 0; int -ipx_outputfl(m0, ro, flags) - struct mbuf *m0; - struct route *ro; - int flags; +ipx_outputfl(struct mbuf *m0, struct route *ro, int flags) { - register struct ipx *ipx = mtod(m0, struct ipx *); - register struct ifnet *ifp = NULL; + struct ipx *ipx = mtod(m0, struct ipx *); + struct ifnet *ifp = NULL; int error = 0; struct sockaddr_ipx *dst; struct route ipxroute; @@ -182,10 +179,9 @@ ipx_outputfl(m0, ro, flags) * that have ipx configured and isn't in the list yet. */ int -ipx_output_type20(m) - struct mbuf *m; +ipx_output_type20(struct mbuf *m) { - register struct ipx *ipx; + struct ipx *ipx; union ipx_net *nbnet; struct ipx_ifaddr *ia, *tia = NULL; int error = 0; diff --git a/sys/netipx/ipx_pcb.c b/sys/netipx/ipx_pcb.c index c6cfd2abd4b8..36c1354e0996 100644 --- a/sys/netipx/ipx_pcb.c +++ b/sys/netipx/ipx_pcb.c @@ -84,12 +84,9 @@ static struct ipx_addr zeroipx_addr; static u_short ipxpcb_lport_cache; int -ipx_pcballoc(so, head, td) - struct socket *so; - struct ipxpcbhead *head; - struct thread *td; +ipx_pcballoc(struct socket *so, struct ipxpcbhead *head, struct thread *td) { - register struct ipxpcb *ipxp; + struct ipxpcb *ipxp; KASSERT(so->so_pcb == NULL, ("ipx_pcballoc: so_pcb != NULL")); IPX_LIST_LOCK_ASSERT(); @@ -107,12 +104,9 @@ ipx_pcballoc(so, head, td) } int -ipx_pcbbind(ipxp, nam, td) - register struct ipxpcb *ipxp; - struct sockaddr *nam; - struct thread *td; +ipx_pcbbind(struct ipxpcb *ipxp, struct sockaddr *nam, struct thread *td) { - register struct sockaddr_ipx *sipx; + struct sockaddr_ipx *sipx; u_short lport = 0; IPX_LIST_LOCK_ASSERT(); @@ -162,15 +156,12 @@ ipx_pcbbind(ipxp, nam, td) * then pick one. */ int -ipx_pcbconnect(ipxp, nam, td) - struct ipxpcb *ipxp; - struct sockaddr *nam; - struct thread *td; +ipx_pcbconnect(struct ipxpcb *ipxp, struct sockaddr *nam, struct thread *td) { struct ipx_ifaddr *ia; - register struct sockaddr_ipx *sipx = (struct sockaddr_ipx *)nam; - register struct ipx_addr *dst; - register struct route *ro; + struct sockaddr_ipx *sipx = (struct sockaddr_ipx *)nam; + struct ipx_addr *dst; + struct route *ro; struct ifnet *ifp; IPX_LIST_LOCK_ASSERT(); @@ -292,8 +283,7 @@ ipx_pcbconnect(ipxp, nam, td) } void -ipx_pcbdisconnect(ipxp) - struct ipxpcb *ipxp; +ipx_pcbdisconnect(struct ipxpcb *ipxp) { IPX_LIST_LOCK_ASSERT(); @@ -303,8 +293,7 @@ ipx_pcbdisconnect(ipxp) } void -ipx_pcbdetach(ipxp) - struct ipxpcb *ipxp; +ipx_pcbdetach(struct ipxpcb *ipxp) { struct socket *so = ipxp->ipxp_socket; @@ -316,8 +305,7 @@ ipx_pcbdetach(ipxp) } void -ipx_pcbfree(ipxp) - struct ipxpcb *ipxp; +ipx_pcbfree(struct ipxpcb *ipxp) { KASSERT(ipxp->ipxp_socket == NULL, @@ -333,9 +321,7 @@ ipx_pcbfree(ipxp) } void -ipx_getsockaddr(ipxp, nam) - register struct ipxpcb *ipxp; - struct sockaddr **nam; +ipx_getsockaddr(struct ipxpcb *ipxp, struct sockaddr **nam) { struct sockaddr_ipx *sipx, ssipx; @@ -350,9 +336,7 @@ ipx_getsockaddr(ipxp, nam) } void -ipx_getpeeraddr(ipxp, nam) - register struct ipxpcb *ipxp; - struct sockaddr **nam; +ipx_getpeeraddr(struct ipxpcb *ipxp, struct sockaddr **nam) { struct sockaddr_ipx *sipx, ssipx; @@ -367,12 +351,9 @@ ipx_getpeeraddr(ipxp, nam) } struct ipxpcb * -ipx_pcblookup(faddr, lport, wildp) - struct ipx_addr *faddr; - u_short lport; - int wildp; +ipx_pcblookup(struct ipx_addr *faddr, u_short lport, int wildp) { - register struct ipxpcb *ipxp, *match = NULL; + struct ipxpcb *ipxp, *match = NULL; int matchwild = 3, wildcard; u_short fport; diff --git a/sys/netipx/ipx_pcb.h b/sys/netipx/ipx_pcb.h index 5b5921e97085..4ef60111451f 100644 --- a/sys/netipx/ipx_pcb.h +++ b/sys/netipx/ipx_pcb.h @@ -121,16 +121,15 @@ extern struct mtx ipxpcb_list_mtx; #ifdef _KERNEL int ipx_pcballoc(struct socket *so, struct ipxpcbhead *head, - struct thread *p); + struct thread *p); int ipx_pcbbind(struct ipxpcb *ipxp, struct sockaddr *nam, - struct thread *p); + struct thread *p); int ipx_pcbconnect(struct ipxpcb *ipxp, struct sockaddr *nam, - struct thread *p); + struct thread *p); void ipx_pcbdetach(struct ipxpcb *ipxp); void ipx_pcbdisconnect(struct ipxpcb *ipxp); void ipx_pcbfree(struct ipxpcb *ipxp); -struct ipxpcb * - ipx_pcblookup(struct ipx_addr *faddr, int lport, int wildp); +struct ipxpcb *ipx_pcblookup(struct ipx_addr *faddr, u_short lport, int wildp); void ipx_getpeeraddr(struct ipxpcb *ipxp, struct sockaddr **nam); void ipx_getsockaddr(struct ipxpcb *ipxp, struct sockaddr **nam); diff --git a/sys/netipx/ipx_usrreq.c b/sys/netipx/ipx_usrreq.c index ad60f4bcde59..fabe2765ea3d 100644 --- a/sys/netipx/ipx_usrreq.c +++ b/sys/netipx/ipx_usrreq.c @@ -151,11 +151,9 @@ struct pr_usrreqs ripx_usrreqs = { * This may also be called for raw listeners. */ void -ipx_input(m, ipxp) - struct mbuf *m; - register struct ipxpcb *ipxp; +ipx_input(struct mbuf *m, struct ipxpcb *ipxp) { - register struct ipx *ipx = mtod(m, struct ipx *); + struct ipx *ipx = mtod(m, struct ipx *); struct ifnet *ifp = m->m_pkthdr.rcvif; struct sockaddr_ipx ipx_ipx; @@ -171,7 +169,7 @@ ipx_input(m, ipxp) ipx_ipx.sipx_zero[0] = '\0'; ipx_ipx.sipx_zero[1] = '\0'; if (ipx_neteqnn(ipx->ipx_sna.x_net, ipx_zeronet) && ifp != NULL) { - register struct ifaddr *ifa; + struct ifaddr *ifa; for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa != NULL; ifa = TAILQ_NEXT(ifa, ifa_link)) { @@ -200,9 +198,7 @@ ipx_input(m, ipxp) * the specified error. */ void -ipx_drop(ipxp, errno) - register struct ipxpcb *ipxp; - int errno; +ipx_drop(struct ipxpcb *ipxp, int errno) { struct socket *so = ipxp->ipxp_socket; @@ -226,14 +222,12 @@ ipx_drop(ipxp, errno) } static int -ipx_output(ipxp, m0) - struct ipxpcb *ipxp; - struct mbuf *m0; +ipx_output(struct ipxpcb *ipxp, struct mbuf *m0) { - register struct ipx *ipx; - register struct socket *so; - register int len = 0; - register struct route *ro; + struct ipx *ipx; + struct socket *so; + int len = 0; + struct route *ro; struct mbuf *m; struct mbuf *mprev = NULL; @@ -328,7 +322,7 @@ ipx_output(ipxp, m0) } if ((ro->ro_rt->rt_flags & RTF_GATEWAY) == 0) { - register struct ipx_addr *dst = + struct ipx_addr *dst = &satoipx_addr(ro->ro_dst); dst->x_host = ipx->ipx_dna.x_host; } @@ -348,9 +342,7 @@ ipx_output(ipxp, m0) } int -ipx_ctloutput(so, sopt) - struct socket *so; - struct sockopt *sopt; +ipx_ctloutput(struct socket *so, struct sockopt *sopt) { struct ipxpcb *ipxp = sotoipxpcb(so); int mask, error, optval; @@ -459,8 +451,7 @@ ipx_ctloutput(so, sopt) } static void -ipx_usr_abort(so) - struct socket *so; +ipx_usr_abort(struct socket *so) { /* XXXRW: Possibly ipx_disconnect() here? */ @@ -468,10 +459,7 @@ ipx_usr_abort(so) } static int -ipx_attach(so, proto, td) - struct socket *so; - int proto; - struct thread *td; +ipx_attach(struct socket *so, int proto, struct thread *td) { #ifdef INVARIANTS struct ipxpcb *ipxp = sotoipxpcb(so); @@ -489,10 +477,7 @@ ipx_attach(so, proto, td) } static int -ipx_bind(so, nam, td) - struct socket *so; - struct sockaddr *nam; - struct thread *td; +ipx_bind(struct socket *so, struct sockaddr *nam, struct thread *td) { struct ipxpcb *ipxp = sotoipxpcb(so); int error; @@ -507,8 +492,7 @@ ipx_bind(so, nam, td) } static void -ipx_usr_close(so) - struct socket *so; +ipx_usr_close(struct socket *so) { /* XXXRW: Possibly ipx_disconnect() here? */ @@ -516,10 +500,7 @@ ipx_usr_close(so) } static int -ipx_connect(so, nam, td) - struct socket *so; - struct sockaddr *nam; - struct thread *td; +ipx_connect(struct socket *so, struct sockaddr *nam, struct thread *td) { struct ipxpcb *ipxp = sotoipxpcb(so); int error; @@ -541,8 +522,7 @@ ipx_connect(so, nam, td) } static void -ipx_detach(so) - struct socket *so; +ipx_detach(struct socket *so) { struct ipxpcb *ipxp = sotoipxpcb(so); @@ -556,8 +536,7 @@ ipx_detach(so) } static int -ipx_disconnect(so) - struct socket *so; +ipx_disconnect(struct socket *so) { struct ipxpcb *ipxp = sotoipxpcb(so); int error; @@ -579,9 +558,7 @@ ipx_disconnect(so) } int -ipx_peeraddr(so, nam) - struct socket *so; - struct sockaddr **nam; +ipx_peeraddr(struct socket *so, struct sockaddr **nam) { struct ipxpcb *ipxp = sotoipxpcb(so); @@ -591,13 +568,8 @@ ipx_peeraddr(so, nam) } static int -ipx_send(so, flags, m, nam, control, td) - struct socket *so; - int flags; - struct mbuf *m; - struct sockaddr *nam; - struct mbuf *control; - struct thread *td; +ipx_send(struct socket *so, int flags, struct mbuf *m, struct sockaddr *nam, + struct mbuf *control, struct thread *td) { int error; struct ipxpcb *ipxp = sotoipxpcb(so); @@ -664,9 +636,7 @@ ipx_shutdown(so) } int -ipx_sockaddr(so, nam) - struct socket *so; - struct sockaddr **nam; +ipx_sockaddr(struct socket *so, struct sockaddr **nam) { struct ipxpcb *ipxp = sotoipxpcb(so); @@ -676,10 +646,7 @@ ipx_sockaddr(so, nam) } static int -ripx_attach(so, proto, td) - struct socket *so; - int proto; - struct thread *td; +ripx_attach(struct socket *so, int proto, struct thread *td) { int error = 0; struct ipxpcb *ipxp = sotoipxpcb(so); diff --git a/sys/netipx/ipx_var.h b/sys/netipx/ipx_var.h index 61ad6ab063ce..1c76613f4501 100644 --- a/sys/netipx/ipx_var.h +++ b/sys/netipx/ipx_var.h @@ -113,7 +113,7 @@ struct sockopt; u_short ipx_cksum(struct mbuf *m, int len); int ipx_control(struct socket *so, u_long cmd, caddr_t data, - struct ifnet *ifp, struct thread *td); + struct ifnet *ifp, struct thread *td); void ipx_ctlinput(int cmd, struct sockaddr *arg_as_sa, void *dummy); int ipx_ctloutput(struct socket *so, struct sockopt *sopt); void ipx_drop(struct ipxpcb *ipxp, int errno); diff --git a/sys/netipx/spx_debug.c b/sys/netipx/spx_debug.c index 7a210beb5fd3..1654bc02242b 100644 --- a/sys/netipx/spx_debug.c +++ b/sys/netipx/spx_debug.c @@ -90,12 +90,8 @@ static int spx_debx; * spx debug routines */ void -spx_trace(act, ostate, sp, si, req) - short act; - u_char ostate; - struct spxpcb *sp; - struct spx *si; - int req; +spx_trace(short act, u_char ostate, struct spxpcb *sp, struct spx *si, + int req) { #ifdef INET #ifdef TCPDEBUG diff --git a/sys/netipx/spx_debug.h b/sys/netipx/spx_debug.h index f91a7708c629..24a76f4a1ce8 100644 --- a/sys/netipx/spx_debug.h +++ b/sys/netipx/spx_debug.h @@ -97,8 +97,8 @@ extern char *prurequests[]; extern char *sanames[]; extern char *tcpstates[]; -void spx_trace(int act, int ostate, struct spxpcb *sp, struct spx *si, - int req); +void spx_trace(short act, u_char ostate, struct spxpcb *sp, struct spx *si, + int req); #endif #endif /* !_NETIPX_SPX_DEBUG_H_ */