1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-16 10:20:30 +00:00

Generally migrate to ANSI function headers, and remove 'register' use.

This commit is contained in:
Robert Watson 2007-05-16 20:41:08 +00:00
parent 002b1f0bba
commit d19e16a72c
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=169624
5 changed files with 106 additions and 181 deletions

View File

@ -197,11 +197,11 @@ socket_zone_change(void *tag)
static void
domaininit(void *dummy)
{
/*
* Before we do any setup, make sure to initialize the
* zone allocator we get struct sockets from.
*/
socket_zone = uma_zcreate("socket", sizeof(struct socket), NULL, NULL,
NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_NOFREE);
uma_zone_set_max(socket_zone, maxsockets);
@ -229,6 +229,7 @@ domaininit(void *dummy)
static void
domainfinalize(void *dummy)
{
mtx_lock(&dom_mtx);
KASSERT(domain_init_status == 1, ("domainfinalize called too late!"));
domain_init_status = 2;
@ -239,12 +240,10 @@ domainfinalize(void *dummy)
}
struct protosw *
pffindtype(family, type)
int family;
int type;
pffindtype(int family, int type)
{
register struct domain *dp;
register struct protosw *pr;
struct domain *dp;
struct protosw *pr;
for (dp = domains; dp; dp = dp->dom_next)
if (dp->dom_family == family)
@ -258,13 +257,10 @@ pffindtype(family, type)
}
struct protosw *
pffindproto(family, protocol, type)
int family;
int protocol;
int type;
pffindproto(int family, int protocol, int type)
{
register struct domain *dp;
register struct protosw *pr;
struct domain *dp;
struct protosw *pr;
struct protosw *maybe = 0;
if (family == 0)
@ -290,9 +286,7 @@ pffindproto(family, protocol, type)
* accept requests before it is registered.
*/
int
pf_proto_register(family, npr)
int family;
struct protosw *npr;
pf_proto_register(int family, struct protosw *npr)
{
struct domain *dp;
struct protosw *pr, *fpr;
@ -359,10 +353,7 @@ pf_proto_register(family, npr)
* all sockets and release all locks and memory references.
*/
int
pf_proto_unregister(family, protocol, type)
int family;
int protocol;
int type;
pf_proto_unregister(int family, int protocol, int type)
{
struct domain *dp;
struct protosw *pr, *dpr;
@ -427,12 +418,10 @@ pf_proto_unregister(family, protocol, type)
}
void
pfctlinput(cmd, sa)
int cmd;
struct sockaddr *sa;
pfctlinput(int cmd, struct sockaddr *sa)
{
register struct domain *dp;
register struct protosw *pr;
struct domain *dp;
struct protosw *pr;
for (dp = domains; dp; dp = dp->dom_next)
for (pr = dp->dom_protosw; pr < dp->dom_protoswNPROTOSW; pr++)
@ -441,10 +430,7 @@ pfctlinput(cmd, sa)
}
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;
@ -467,11 +453,10 @@ pfctlinput2(cmd, sa, ctlparam)
}
static void
pfslowtimo(arg)
void *arg;
pfslowtimo(void *arg)
{
register struct domain *dp;
register struct protosw *pr;
struct domain *dp;
struct protosw *pr;
NET_ASSERT_GIANT();
@ -483,11 +468,10 @@ pfslowtimo(arg)
}
static void
pffasttimo(arg)
void *arg;
pffasttimo(void *arg)
{
register struct domain *dp;
register struct protosw *pr;
struct domain *dp;
struct protosw *pr;
NET_ASSERT_GIANT();

View File

@ -1169,7 +1169,7 @@ m_split(struct mbuf *m0, int len0, int wait)
*/
struct mbuf *
m_devget(char *buf, int totlen, int off, struct ifnet *ifp,
void (*copy)(char *from, caddr_t to, u_int len))
void (*copy)(char *from, caddr_t to, u_int len))
{
struct mbuf *m;
struct mbuf *top = NULL, **mp = &top;

View File

@ -349,7 +349,6 @@ sbdestroy(struct sockbuf *sb, struct socket *so)
sbrelease_internal(sb, so);
}
/*
* Routines to add and remove data from an mbuf queue.
*
@ -902,7 +901,6 @@ sbdrop(struct sockbuf *sb, int len)
SOCKBUF_UNLOCK(sb);
}
/*
* Maintain a pointer and offset pair into the socket buffer mbuf chain to
* avoid traversal of the entire socket buffer for larger offsets.
@ -981,12 +979,9 @@ sbdroprecord(struct sockbuf *sb)
* type for presentation on a socket buffer.
*/
struct mbuf *
sbcreatecontrol(p, size, type, level)
caddr_t p;
register int size;
int type, level;
sbcreatecontrol(caddr_t p, int size, int type, int level)
{
register struct cmsghdr *cp;
struct cmsghdr *cp;
struct mbuf *m;
if (CMSG_SPACE((u_int)size) > MCLBYTES)
@ -1020,6 +1015,7 @@ sbcreatecontrol(p, size, type, level)
void
sbtoxsockbuf(struct sockbuf *sb, struct xsockbuf *xsb)
{
xsb->sb_cc = sb->sb_cc;
xsb->sb_hiwat = sb->sb_hiwat;
xsb->sb_mbcnt = sb->sb_mbcnt;

View File

@ -327,13 +327,8 @@ sodealloc(struct socket *so)
* closed with soclose().
*/
int
socreate(dom, aso, type, proto, cred, td)
int dom;
struct socket **aso;
int type;
int proto;
struct ucred *cred;
struct thread *td;
socreate(int dom, struct socket **aso, int type, int proto,
struct ucred *cred, struct thread *td)
{
struct protosw *prp;
struct socket *so;
@ -406,11 +401,9 @@ SYSCTL_INT(_regression, OID_AUTO, sonewconn_earlytest, CTLFLAG_RW,
* Note: the ref count on the socket is 0 on return.
*/
struct socket *
sonewconn(head, connstatus)
register struct socket *head;
int connstatus;
sonewconn(struct socket *head, int connstatus)
{
register struct socket *so;
struct socket *so;
int over;
ACCEPT_LOCK();
@ -492,10 +485,7 @@ sonewconn(head, connstatus)
}
int
sobind(so, nam, td)
struct socket *so;
struct sockaddr *nam;
struct thread *td;
sobind(struct socket *so, struct sockaddr *nam, struct thread *td)
{
return ((*so->so_proto->pr_usrreqs->pru_bind)(so, nam, td));
@ -514,18 +504,14 @@ sobind(so, nam, td)
* socket-layer test and set to avoid races at the socket layer.
*/
int
solisten(so, backlog, td)
struct socket *so;
int backlog;
struct thread *td;
solisten(struct socket *so, int backlog, struct thread *td)
{
return ((*so->so_proto->pr_usrreqs->pru_listen)(so, backlog, td));
}
int
solisten_proto_check(so)
struct socket *so;
solisten_proto_check(struct socket *so)
{
SOCK_LOCK_ASSERT(so);
@ -537,9 +523,7 @@ solisten_proto_check(so)
}
void
solisten_proto(so, backlog)
struct socket *so;
int backlog;
solisten_proto(struct socket *so, int backlog)
{
SOCK_LOCK_ASSERT(so);
@ -571,8 +555,7 @@ solisten_proto(so, backlog)
* conditions are right, can succeed.
*/
void
sofree(so)
struct socket *so;
sofree(struct socket *so)
{
struct protosw *pr = so->so_proto;
struct socket *head;
@ -647,8 +630,7 @@ sofree(so)
* not be freed until the ref count reaches zero.
*/
int
soclose(so)
struct socket *so;
soclose(struct socket *so)
{
int error = 0;
@ -723,8 +705,7 @@ soclose(so)
* to review in the future.
*/
void
soabort(so)
struct socket *so;
soabort(struct socket *so)
{
/*
@ -747,9 +728,7 @@ soabort(so)
}
int
soaccept(so, nam)
struct socket *so;
struct sockaddr **nam;
soaccept(struct socket *so, struct sockaddr **nam)
{
int error;
@ -762,10 +741,7 @@ soaccept(so, nam)
}
int
soconnect(so, nam, td)
struct socket *so;
struct sockaddr *nam;
struct thread *td;
soconnect(struct socket *so, struct sockaddr *nam, struct thread *td)
{
int error;
@ -793,17 +769,14 @@ soconnect(so, nam, td)
}
int
soconnect2(so1, so2)
struct socket *so1;
struct socket *so2;
soconnect2(struct socket *so1, struct socket *so2)
{
return ((*so1->so_proto->pr_usrreqs->pru_connect2)(so1, so2));
}
int
sodisconnect(so)
struct socket *so;
sodisconnect(struct socket *so)
{
int error;
@ -946,14 +919,8 @@ sosend_copyin(struct uio *uio, struct mbuf **retmp, int atomic, long *space,
#define SBLOCKWAIT(f) (((f) & MSG_DONTWAIT) ? M_NOWAIT : M_WAITOK)
int
sosend_dgram(so, addr, uio, top, control, flags, td)
struct socket *so;
struct sockaddr *addr;
struct uio *uio;
struct mbuf *top;
struct mbuf *control;
int flags;
struct thread *td;
sosend_dgram(struct socket *so, struct sockaddr *addr, struct uio *uio,
struct mbuf *top, struct mbuf *control, int flags, struct thread *td)
{
long space, resid;
int clen = 0, error, dontroute;
@ -1126,14 +1093,8 @@ sosend_dgram(so, addr, uio, top, control, flags, td)
* on return.
*/
int
sosend_generic(so, addr, uio, top, control, flags, td)
struct socket *so;
struct sockaddr *addr;
struct uio *uio;
struct mbuf *top;
struct mbuf *control;
int flags;
struct thread *td;
sosend_generic(struct socket *so, struct sockaddr *addr, struct uio *uio,
struct mbuf *top, struct mbuf *control, int flags, struct thread *td)
{
long space, resid;
int clen = 0, error, dontroute;
@ -1314,14 +1275,8 @@ sosend_generic(so, addr, uio, top, control, flags, td)
}
int
sosend(so, addr, uio, top, control, flags, td)
struct socket *so;
struct sockaddr *addr;
struct uio *uio;
struct mbuf *top;
struct mbuf *control;
int flags;
struct thread *td;
sosend(struct socket *so, struct sockaddr *addr, struct uio *uio,
struct mbuf *top, struct mbuf *control, int flags, struct thread *td)
{
/* XXXRW: Temporary debugging. */
@ -1341,10 +1296,7 @@ sosend(so, addr, uio, top, control, flags, td)
* unable to return an mbuf chain to the caller.
*/
static int
soreceive_rcvoob(so, uio, flags)
struct socket *so;
struct uio *uio;
int flags;
soreceive_rcvoob(struct socket *so, struct uio *uio, int flags)
{
struct protosw *pr = so->so_proto;
struct mbuf *m;
@ -1437,13 +1389,8 @@ sockbuf_pushsync(struct sockbuf *sb, struct mbuf *nextrecord)
* the count in uio_resid.
*/
int
soreceive_generic(so, psa, uio, mp0, controlp, flagsp)
struct socket *so;
struct sockaddr **psa;
struct uio *uio;
struct mbuf **mp0;
struct mbuf **controlp;
int *flagsp;
soreceive_generic(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, offset;
@ -1895,13 +1842,8 @@ soreceive_generic(so, psa, uio, mp0, controlp, flagsp)
}
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)
{
/* XXXRW: Temporary debugging. */
@ -1913,9 +1855,7 @@ soreceive(so, psa, uio, mp0, controlp, flagsp)
}
int
soshutdown(so, how)
struct socket *so;
int how;
soshutdown(struct socket *so, int how)
{
struct protosw *pr = so->so_proto;
@ -1930,8 +1870,7 @@ soshutdown(so, how)
}
void
sorflush(so)
struct socket *so;
sorflush(struct socket *so)
{
struct sockbuf *sb = &so->so_rcv;
struct protosw *pr = so->so_proto;
@ -1977,11 +1916,7 @@ sorflush(so)
* 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;
@ -2024,9 +1959,7 @@ so_setsockopt(struct socket *so, int level, int optname, void *optval,
}
int
sosetopt(so, sopt)
struct socket *so;
struct sockopt *sopt;
sosetopt(struct socket *so, struct sockopt *sopt)
{
int error, optval;
struct linger l;
@ -2241,9 +2174,7 @@ sooptcopyout(struct sockopt *sopt, const void *buf, size_t len)
}
int
sogetopt(so, sopt)
struct socket *so;
struct sockopt *sopt;
sogetopt(struct socket *so, struct sockopt *sopt)
{
int error, optval;
struct linger l;
@ -2507,9 +2438,9 @@ soopt_mcopyout(struct sockopt *sopt, struct mbuf *m)
* out-of-band data, which will then notify socket consumers.
*/
void
sohasoutofband(so)
struct socket *so;
sohasoutofband(struct socket *so)
{
if (so->so_sigio != NULL)
pgsigio(&so->so_sigio, SIGURG, 0);
selwakeuppri(&so->so_rcv.sb_sel, PSOCK);
@ -2608,74 +2539,86 @@ soo_kqfilter(struct file *fp, struct knote *kn)
int
pru_accept_notsupp(struct socket *so, struct sockaddr **nam)
{
return EOPNOTSUPP;
}
int
pru_attach_notsupp(struct socket *so, int proto, struct thread *td)
{
return EOPNOTSUPP;
}
int
pru_bind_notsupp(struct socket *so, struct sockaddr *nam, struct thread *td)
{
return EOPNOTSUPP;
}
int
pru_connect_notsupp(struct socket *so, struct sockaddr *nam, struct thread *td)
{
return EOPNOTSUPP;
}
int
pru_connect2_notsupp(struct socket *so1, struct socket *so2)
{
return EOPNOTSUPP;
}
int
pru_control_notsupp(struct socket *so, u_long cmd, caddr_t data,
struct ifnet *ifp, struct thread *td)
struct ifnet *ifp, struct thread *td)
{
return EOPNOTSUPP;
}
int
pru_disconnect_notsupp(struct socket *so)
{
return EOPNOTSUPP;
}
int
pru_listen_notsupp(struct socket *so, int backlog, struct thread *td)
{
return EOPNOTSUPP;
}
int
pru_peeraddr_notsupp(struct socket *so, struct sockaddr **nam)
{
return EOPNOTSUPP;
}
int
pru_rcvd_notsupp(struct socket *so, int flags)
{
return EOPNOTSUPP;
}
int
pru_rcvoob_notsupp(struct socket *so, struct mbuf *m, int flags)
{
return EOPNOTSUPP;
}
int
pru_send_notsupp(struct socket *so, int flags, struct mbuf *m,
struct sockaddr *addr, struct mbuf *control, struct thread *td)
struct sockaddr *addr, struct mbuf *control, struct thread *td)
{
return EOPNOTSUPP;
}
@ -2686,6 +2629,7 @@ pru_send_notsupp(struct socket *so, int flags, struct mbuf *m,
int
pru_sense_null(struct socket *so, struct stat *sb)
{
sb->st_blksize = so->so_snd.sb_hiwat;
return 0;
}
@ -2693,34 +2637,38 @@ pru_sense_null(struct socket *so, struct stat *sb)
int
pru_shutdown_notsupp(struct socket *so)
{
return EOPNOTSUPP;
}
int
pru_sockaddr_notsupp(struct socket *so, struct sockaddr **nam)
{
return EOPNOTSUPP;
}
int
pru_sosend_notsupp(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)
{
return EOPNOTSUPP;
}
int
pru_soreceive_notsupp(struct socket *so, struct sockaddr **paddr,
struct uio *uio, struct mbuf **mp0, struct mbuf **controlp,
int *flagsp)
struct uio *uio, struct mbuf **mp0, struct mbuf **controlp, int *flagsp)
{
return EOPNOTSUPP;
}
int
pru_sopoll_notsupp(struct socket *so, int events, struct ucred *cred,
struct thread *td)
struct thread *td)
{
return EOPNOTSUPP;
}
@ -2866,8 +2814,7 @@ sysctl_somaxconn(SYSCTL_HANDLER_ARGS)
* here will sometimes cause software-interrupt process scheduling.
*/
void
soisconnecting(so)
register struct socket *so;
soisconnecting(struct socket *so)
{
SOCK_LOCK(so);
@ -2877,8 +2824,7 @@ soisconnecting(so)
}
void
soisconnected(so)
struct socket *so;
soisconnected(struct socket *so)
{
struct socket *head;
@ -2919,8 +2865,7 @@ soisconnected(so)
}
void
soisdisconnecting(so)
register struct socket *so;
soisdisconnecting(struct socket *so)
{
/*
@ -2939,8 +2884,7 @@ soisdisconnecting(so)
}
void
soisdisconnected(so)
register struct socket *so;
soisdisconnected(struct socket *so)
{
/*
@ -2984,6 +2928,7 @@ sodupsockaddr(const struct sockaddr *sa, int mflags)
void
sotoxsocket(struct socket *so, struct xsocket *xso)
{
xso->xso_len = sizeof *xso;
xso->xso_so = so;
xso->so_type = so->so_type;

View File

@ -153,7 +153,7 @@ getsock(struct filedesc *fdp, int fd, struct file **fpp, u_int *fflagp)
int
socket(td, uap)
struct thread *td;
register struct socket_args /* {
struct socket_args /* {
int domain;
int type;
int protocol;
@ -198,7 +198,7 @@ socket(td, uap)
int
bind(td, uap)
struct thread *td;
register struct bind_args /* {
struct bind_args /* {
int s;
caddr_t name;
int namelen;
@ -251,7 +251,7 @@ kern_bind(td, fd, sa)
int
listen(td, uap)
struct thread *td;
register struct listen_args /* {
struct listen_args /* {
int s;
int backlog;
} */ *uap;
@ -287,7 +287,7 @@ listen(td, uap)
static int
accept1(td, uap, compat)
struct thread *td;
register struct accept_args /* {
struct accept_args /* {
int s;
struct sockaddr * __restrict name;
socklen_t * __restrict anamelen;
@ -520,7 +520,7 @@ oaccept(td, uap)
int
connect(td, uap)
struct thread *td;
register struct connect_args /* {
struct connect_args /* {
int s;
caddr_t name;
int namelen;
@ -603,14 +603,14 @@ kern_connect(td, fd, sa)
int
socketpair(td, uap)
struct thread *td;
register struct socketpair_args /* {
struct socketpair_args /* {
int domain;
int type;
int protocol;
int *rsv;
} */ *uap;
{
register struct filedesc *fdp = td->td_proc->p_fd;
struct filedesc *fdp = td->td_proc->p_fd;
struct file *fp1, *fp2;
struct socket *so1, *so2;
int fd, error, sv[2];
@ -690,9 +690,9 @@ socketpair(td, uap)
static int
sendit(td, s, mp, flags)
register struct thread *td;
struct thread *td;
int s;
register struct msghdr *mp;
struct msghdr *mp;
int flags;
{
struct mbuf *control;
@ -725,7 +725,7 @@ sendit(td, s, mp, flags)
goto bad;
#ifdef COMPAT_OLDSOCK
if (mp->msg_flags == MSG_COMPAT) {
register struct cmsghdr *cm;
struct cmsghdr *cm;
M_PREPEND(control, sizeof(*cm), M_TRYWAIT);
if (control == 0) {
@ -834,7 +834,7 @@ kern_sendit(td, s, mp, flags, control, segflg)
int
sendto(td, uap)
struct thread *td;
register struct sendto_args /* {
struct sendto_args /* {
int s;
caddr_t buf;
size_t len;
@ -865,7 +865,7 @@ sendto(td, uap)
int
osend(td, uap)
struct thread *td;
register struct osend_args /* {
struct osend_args /* {
int s;
caddr_t buf;
int len;
@ -1131,7 +1131,7 @@ recvit(td, s, mp, namelenp)
int
recvfrom(td, uap)
struct thread *td;
register struct recvfrom_args /* {
struct recvfrom_args /* {
int s;
caddr_t buf;
size_t len;
@ -1180,7 +1180,7 @@ orecvfrom(td, uap)
int
orecv(td, uap)
struct thread *td;
register struct orecv_args /* {
struct orecv_args /* {
int s;
caddr_t buf;
int len;
@ -1276,7 +1276,7 @@ recvmsg(td, uap)
int
shutdown(td, uap)
struct thread *td;
register struct shutdown_args /* {
struct shutdown_args /* {
int s;
int how;
} */ *uap;
@ -1300,7 +1300,7 @@ shutdown(td, uap)
int
setsockopt(td, uap)
struct thread *td;
register struct setsockopt_args /* {
struct setsockopt_args /* {
int s;
int level;
int name;
@ -1364,7 +1364,7 @@ kern_setsockopt(td, s, level, name, val, valseg, valsize)
int
getsockopt(td, uap)
struct thread *td;
register struct getsockopt_args /* {
struct getsockopt_args /* {
int s;
int level;
int name;
@ -1448,7 +1448,7 @@ kern_getsockopt(td, s, level, name, val, valseg, valsize)
static int
getsockname1(td, uap, compat)
struct thread *td;
register struct getsockname_args /* {
struct getsockname_args /* {
int fdes;
struct sockaddr * __restrict asa;
socklen_t * __restrict alen;
@ -1544,7 +1544,7 @@ ogetsockname(td, uap)
static int
getpeername1(td, uap, compat)
struct thread *td;
register struct getpeername_args /* {
struct getpeername_args /* {
int fdes;
struct sockaddr * __restrict asa;
socklen_t * __restrict alen;
@ -1645,8 +1645,8 @@ sockargs(mp, buf, buflen, type)
caddr_t buf;
int buflen, type;
{
register struct sockaddr *sa;
register struct mbuf *m;
struct sockaddr *sa;
struct mbuf *m;
int error;
if ((u_int)buflen > MLEN) {