diff options
author | des <des@FreeBSD.org> | 2003-03-02 15:56:49 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2003-03-02 15:56:49 +0000 |
commit | 7b016a11e606d722eb050e0f5b2da9797f9d4b2a (patch) | |
tree | 9d914583b19df0e7843f6931745ec9d08a2c4793 /sys/net | |
parent | 765ebc59b49b789f220d5975fee1fafe86545825 (diff) | |
download | FreeBSD-src-7b016a11e606d722eb050e0f5b2da9797f9d4b2a.zip FreeBSD-src-7b016a11e606d722eb050e0f5b2da9797f9d4b2a.tar.gz |
Clean up whitespace, s/register //, refrain from strong urge to ANSIfy.
Diffstat (limited to 'sys/net')
-rw-r--r-- | sys/net/bpf.c | 68 | ||||
-rw-r--r-- | sys/net/if_tap.c | 94 | ||||
-rw-r--r-- | sys/net/if_tun.c | 62 |
3 files changed, 112 insertions, 112 deletions
diff --git a/sys/net/bpf.c b/sys/net/bpf.c index 7c56ef6..71c98aa 100644 --- a/sys/net/bpf.c +++ b/sys/net/bpf.c @@ -82,10 +82,10 @@ static MALLOC_DEFINE(M_BPF, "BPF", "BPF data"); * The default read buffer size is patchable. */ static int bpf_bufsize = 4096; -SYSCTL_INT(_debug, OID_AUTO, bpf_bufsize, CTLFLAG_RW, +SYSCTL_INT(_debug, OID_AUTO, bpf_bufsize, CTLFLAG_RW, &bpf_bufsize, 0, ""); static int bpf_maxbufsize = BPF_MAXBUFSIZE; -SYSCTL_INT(_debug, OID_AUTO, bpf_maxbufsize, CTLFLAG_RW, +SYSCTL_INT(_debug, OID_AUTO, bpf_maxbufsize, CTLFLAG_RW, &bpf_maxbufsize, 0, ""); /* @@ -139,10 +139,10 @@ static struct cdevsw bpf_cdevsw = { static int bpf_movein(uio, linktype, mp, sockp, datlen) - register struct uio *uio; + struct uio *uio; int linktype, *datlen; - register struct mbuf **mp; - register struct sockaddr *sockp; + struct mbuf **mp; + struct sockaddr *sockp; { struct mbuf *m; int error; @@ -189,7 +189,7 @@ bpf_movein(uio, linktype, mp, sockp, datlen) * specified anyway. */ sockp->sa_family = AF_UNSPEC; - hlen = 12; /* XXX 4(ATM_PH) + 3(LLC) + 5(SNAP) */ + hlen = 12; /* XXX 4(ATM_PH) + 3(LLC) + 5(SNAP) */ break; case DLT_PPP: @@ -327,7 +327,7 @@ bpfopen(dev, flags, fmt, td) mtx_lock(&bpf_mtx); d = dev->si_drv1; /* - * Each minor can be opened by only one process. If the requested + * Each minor can be opened by only one process. If the requested * minor is in use, return EBUSY. */ if (d) { @@ -407,7 +407,7 @@ bpfclose(dev, flags, fmt, td) static int bpfread(dev, uio, ioflag) dev_t dev; - register struct uio *uio; + struct uio *uio; int ioflag; { struct bpf_d *d = dev->si_drv1; @@ -512,7 +512,7 @@ bpfread(dev, uio, ioflag) */ static __inline void bpf_wakeup(d) - register struct bpf_d *d; + struct bpf_d *d; { if (d->bd_state == BPF_WAITING) { callout_stop(&d->bd_callout); @@ -692,7 +692,7 @@ bpfioctl(dev, cmd, addr, flags, td) if (d->bd_bif != 0) error = EINVAL; else { - register u_int size = *(u_int *)addr; + u_int size = *(u_int *)addr; if (size > bpf_maxbufsize) *(u_int *)addr = size = bpf_maxbufsize; @@ -748,7 +748,7 @@ bpfioctl(dev, cmd, addr, flags, td) *(u_int *)addr = d->bd_bif->bif_dlt; break; - /* + /* * Get a list of supported data link types. */ case BIOCGDLTLIST: @@ -901,7 +901,7 @@ bpfioctl(dev, cmd, addr, flags, td) case BIOCSRSIG: /* Set receive signal */ { - u_int sig; + u_int sig; sig = *(u_int *)addr; @@ -1037,7 +1037,7 @@ bpf_setif(d, ifr) */ static int bpfpoll(dev, events, td) - register dev_t dev; + dev_t dev; int events; struct thread *td; { @@ -1084,11 +1084,11 @@ bpfpoll(dev, events, td) void bpf_tap(bp, pkt, pktlen) struct bpf_if *bp; - register u_char *pkt; - register u_int pktlen; + u_char *pkt; + u_int pktlen; { - register struct bpf_d *d; - register u_int slen; + struct bpf_d *d; + u_int slen; BPFIF_LOCK(bp); for (d = bp->bif_dlist; d != 0; d = d->bd_next) { @@ -1114,10 +1114,10 @@ static void bpf_mcopy(src_arg, dst_arg, len) const void *src_arg; void *dst_arg; - register size_t len; + size_t len; { - register const struct mbuf *m; - register u_int count; + const struct mbuf *m; + u_int count; u_char *dst; m = src_arg; @@ -1178,14 +1178,14 @@ bpf_mtap(bp, m) */ static void catchpacket(d, pkt, pktlen, snaplen, cpfn) - register struct bpf_d *d; - register u_char *pkt; - register u_int pktlen, snaplen; - register void (*cpfn)(const void *, void *, size_t); + struct bpf_d *d; + u_char *pkt; + u_int pktlen, snaplen; + void (*cpfn)(const void *, void *, size_t); { - register struct bpf_hdr *hp; - register int totlen, curlen; - register int hdrlen = d->bd_bif->bif_hdrlen; + struct bpf_hdr *hp; + int totlen, curlen; + int hdrlen = d->bd_bif->bif_hdrlen; /* * Figure out how many bytes to move. If the packet is * greater or equal to the snapshot length, transfer that @@ -1245,7 +1245,7 @@ catchpacket(d, pkt, pktlen, snaplen, cpfn) */ static int bpf_allocbufs(d) - register struct bpf_d *d; + struct bpf_d *d; { d->bd_fbuf = (caddr_t)malloc(d->bd_bufsize, M_BPF, M_WAITOK); if (d->bd_fbuf == 0) @@ -1267,7 +1267,7 @@ bpf_allocbufs(d) */ static void bpf_freed(d) - register struct bpf_d *d; + struct bpf_d *d; { /* * We don't need to lock out interrupts since this descriptor has @@ -1510,8 +1510,8 @@ SYSINIT(bpfdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,bpf_drvinit,NULL) void bpf_tap(bp, pkt, pktlen) struct bpf_if *bp; - register u_char *pkt; - register u_int pktlen; + u_char *pkt; + u_int pktlen; { } @@ -1537,10 +1537,10 @@ bpfdetach(ifp) u_int bpf_filter(pc, p, wirelen, buflen) - register const struct bpf_insn *pc; - register u_char *p; + const struct bpf_insn *pc; + u_char *p; u_int wirelen; - register u_int buflen; + u_int buflen; { return -1; /* "no filter" behaviour */ } diff --git a/sys/net/if_tap.c b/sys/net/if_tap.c index 7c93412..f35d578 100644 --- a/sys/net/if_tap.c +++ b/sys/net/if_tap.c @@ -81,7 +81,7 @@ /* 0x007f00ff */ /* module */ -static int tapmodevent(module_t, int, void *); +static int tapmodevent(module_t, int, void *); /* device */ static void tapclone(void *, char *, int, dev_t *); @@ -206,8 +206,8 @@ bail: TAPDEBUG("detaching %s%d\n", ifp->if_name,ifp->if_unit); - KASSERT(!(tp->tap_flags & TAP_OPEN), - ("%s%d flags is out of sync", ifp->if_name, + KASSERT(!(tp->tap_flags & TAP_OPEN), + ("%s%d flags is out of sync", ifp->if_name, ifp->if_unit)); /* XXX makedev check? nah.. not right now :) */ @@ -219,7 +219,7 @@ bail: free(tp, M_TAP); } - if (tapbasedev != NOUDEV) + if (tapbasedev != NOUDEV) destroy_dev(udev2dev(tapbasedev, 0)); @@ -254,14 +254,14 @@ tapclone(arg, name, namelen, dev) if (strcmp(device_name, TAP) == 0) { /* get first free tap unit */ - r = rman_reserve_resource(tapunits, 0, TAPMAXUNIT, 1, + r = rman_reserve_resource(tapunits, 0, TAPMAXUNIT, 1, RF_ALLOCATED | RF_ACTIVE, NULL); unit = rman_get_start(r); minor = unit2minor(unit); } else if (strcmp(device_name, VMNET) == 0) { /* get first free vmnet unit */ - r = rman_reserve_resource(vmnetunits, 0, TAPMAXUNIT, 1, + r = rman_reserve_resource(vmnetunits, 0, TAPMAXUNIT, 1, RF_ALLOCATED | RF_ACTIVE, NULL); unit = rman_get_start(r); minor = unit2minor(unit) | VMNET_DEV_MASK; @@ -277,7 +277,7 @@ tapclone(arg, name, namelen, dev) /* check if device for the unit has been created */ *dev = makedev(CDEV_MAJOR, minor); if ((*dev)->si_flags & SI_NAMED) { - TAPDEBUG("%s%d device exists. minor = %#x\n", + TAPDEBUG("%s%d device exists. minor = %#x\n", device_name, unit, minor); return; /* device has been created */ } @@ -339,7 +339,7 @@ tapcreate(dev) TAPDEBUG("tapcreate(%s%d). minor = %#x\n", name, unit, minor(dev)); if (!(dev->si_flags & SI_NAMED)) - dev = make_dev(&tap_cdevsw, minor(dev), UID_ROOT, GID_WHEEL, + dev = make_dev(&tap_cdevsw, minor(dev), UID_ROOT, GID_WHEEL, 0600, "%s%d", name, unit); /* generate fake MAC address: 00 bd xx xx xx unit_no */ @@ -348,7 +348,7 @@ tapcreate(dev) bcopy(&ticks, &tp->arpcom.ac_enaddr[2], sizeof(long)); tp->arpcom.ac_enaddr[5] = (u_char)unit; - /* fill the rest and attach interface */ + /* fill the rest and attach interface */ ifp = &tp->tap_if; ifp->if_softc = tp; ifp->if_unit = unit; @@ -368,13 +368,13 @@ tapcreate(dev) tp->tap_flags |= TAP_INITED; - TAPDEBUG("interface %s%d is created. minor = %#x\n", + TAPDEBUG("interface %s%d is created. minor = %#x\n", ifp->if_name, ifp->if_unit, minor(dev)); } /* tapcreate */ /* - * tapopen + * tapopen * * to open tunnel. must be superuser */ @@ -395,10 +395,10 @@ tapopen(dev, flag, mode, td) unit = dev2unit(dev) & TAPMAXUNIT; if (minor(dev) & VMNET_DEV_MASK) - r = rman_reserve_resource(vmnetunits, unit, unit, 1, + r = rman_reserve_resource(vmnetunits, unit, unit, 1, RF_ALLOCATED | RF_ACTIVE, NULL); else - r = rman_reserve_resource(tapunits, unit, unit, 1, + r = rman_reserve_resource(tapunits, unit, unit, 1, RF_ALLOCATED | RF_ACTIVE, NULL); if (r == NULL) @@ -412,7 +412,7 @@ tapopen(dev, flag, mode, td) tp = dev->si_drv1; } - KASSERT(!(tp->tap_flags & TAP_OPEN), + KASSERT(!(tp->tap_flags & TAP_OPEN), ("%s%d flags is out of sync", tp->tap_if.if_name, unit)); bcopy(tp->arpcom.ac_enaddr, tp->ether_addr, sizeof(tp->ether_addr)); @@ -421,7 +421,7 @@ tapopen(dev, flag, mode, td) tp->tap_pid = td->td_proc->p_pid; tp->tap_flags |= TAP_OPEN; - TAPDEBUG("%s%d is open. minor = %#x\n", + TAPDEBUG("%s%d is open. minor = %#x\n", tp->tap_if.if_name, unit, minor(dev)); return (0); @@ -467,11 +467,11 @@ tapclose(dev, foo, bar, td) rtinit(ifa, (int)RTM_DELETE, 0); /* remove address from interface */ - bzero(ifa->ifa_addr, + bzero(ifa->ifa_addr, sizeof(*(ifa->ifa_addr))); - bzero(ifa->ifa_dstaddr, + bzero(ifa->ifa_dstaddr, sizeof(*(ifa->ifa_dstaddr))); - bzero(ifa->ifa_netmask, + bzero(ifa->ifa_netmask, sizeof(*(ifa->ifa_netmask))); } } @@ -487,11 +487,11 @@ tapclose(dev, foo, bar, td) tp->tap_flags &= ~TAP_OPEN; tp->tap_pid = 0; error = rman_release_resource(tp->tap_unit); - KASSERT((error == 0), - ("%s%d could not release unit", ifp->if_name, ifp->if_unit)); + KASSERT((error == 0), + ("%s%d could not release unit", ifp->if_name, ifp->if_unit)); tp->tap_unit = NULL; - TAPDEBUG("%s%d is closed. minor = %#x\n", + TAPDEBUG("%s%d is closed. minor = %#x\n", ifp->if_name, ifp->if_unit, minor(dev)); return (0); @@ -531,7 +531,7 @@ tapifioctl(ifp, cmd, data) u_long cmd; caddr_t data; { - struct tap_softc *tp = (struct tap_softc *)(ifp->if_softc); + struct tap_softc *tp = (struct tap_softc *)(ifp->if_softc); struct ifstat *ifs = NULL; int s, dummy; @@ -564,8 +564,8 @@ tapifioctl(ifp, cmd, data) /* - * tapifstart - * + * tapifstart + * * queue packets from higher level ready to put out */ static void @@ -582,11 +582,11 @@ tapifstart(ifp) * XXX: can this do any harm because of queue overflow? */ - if (((tp->tap_flags & TAP_VMNET) == 0) && + if (((tp->tap_flags & TAP_VMNET) == 0) && ((tp->tap_flags & TAP_READY) != TAP_READY)) { struct mbuf *m = NULL; - TAPDEBUG("%s%d not ready, tap_flags = 0x%x\n", ifp->if_name, + TAPDEBUG("%s%d not ready, tap_flags = 0x%x\n", ifp->if_name, ifp->if_unit, tp->tap_flags); s = splimp(); @@ -637,26 +637,26 @@ tapioctl(dev, cmd, data, flag, td) { struct tap_softc *tp = dev->si_drv1; struct ifnet *ifp = &tp->tap_if; - struct tapinfo *tapp = NULL; + struct tapinfo *tapp = NULL; int s; int f; switch (cmd) { - case TAPSIFINFO: + case TAPSIFINFO: s = splimp(); - tapp = (struct tapinfo *)data; - ifp->if_mtu = tapp->mtu; - ifp->if_type = tapp->type; - ifp->if_baudrate = tapp->baudrate; + tapp = (struct tapinfo *)data; + ifp->if_mtu = tapp->mtu; + ifp->if_type = tapp->type; + ifp->if_baudrate = tapp->baudrate; splx(s); - break; + break; - case TAPGIFINFO: - tapp = (struct tapinfo *)data; - tapp->mtu = ifp->if_mtu; - tapp->type = ifp->if_type; - tapp->baudrate = ifp->if_baudrate; - break; + case TAPGIFINFO: + tapp = (struct tapinfo *)data; + tapp->mtu = ifp->if_mtu; + tapp->type = ifp->if_type; + tapp->baudrate = ifp->if_baudrate; + break; case TAPSDEBUG: tapdebug = *(int *)data; @@ -756,7 +756,7 @@ tapread(dev, uio, flag) struct mbuf *m = NULL; int error = 0, len, s; - TAPDEBUG("%s%d reading, minor = %#x\n", + TAPDEBUG("%s%d reading, minor = %#x\n", ifp->if_name, ifp->if_unit, minor(dev)); if ((tp->tap_flags & TAP_READY) != TAP_READY) { @@ -777,7 +777,7 @@ tapread(dev, uio, flag) if (m == NULL) { if (flag & IO_NDELAY) return (EWOULDBLOCK); - + tp->tap_flags |= TAP_RWAIT; error = tsleep((caddr_t)tp,PCATCH|(PZERO+1),"taprd",0); if (error) @@ -799,7 +799,7 @@ tapread(dev, uio, flag) } if (m != NULL) { - TAPDEBUG("%s%d dropping mbuf, minor = %#x\n", ifp->if_name, + TAPDEBUG("%s%d dropping mbuf, minor = %#x\n", ifp->if_name, ifp->if_unit, minor(dev)); m_freem(m); } @@ -822,9 +822,9 @@ tapwrite(dev, uio, flag) struct tap_softc *tp = dev->si_drv1; struct ifnet *ifp = &tp->tap_if; struct mbuf *top = NULL, **mp = NULL, *m = NULL; - int error = 0, tlen, mlen; + int error = 0, tlen, mlen; - TAPDEBUG("%s%d writting, minor = %#x\n", + TAPDEBUG("%s%d writting, minor = %#x\n", ifp->if_name, ifp->if_unit, minor(dev)); if (uio->uio_resid == 0) @@ -869,7 +869,7 @@ tapwrite(dev, uio, flag) top->m_pkthdr.len = tlen; top->m_pkthdr.rcvif = ifp; - + /* Pass packet up to parent. */ (*ifp->if_input)(ifp, top); ifp->if_ipackets ++; /* ibytes are counted in parent */ @@ -893,9 +893,9 @@ tappoll(dev, events, td) { struct tap_softc *tp = dev->si_drv1; struct ifnet *ifp = &tp->tap_if; - int s, revents = 0; + int s, revents = 0; - TAPDEBUG("%s%d polling, minor = %#x\n", + TAPDEBUG("%s%d polling, minor = %#x\n", ifp->if_name, ifp->if_unit, minor(dev)); s = splimp(); diff --git a/sys/net/if_tun.c b/sys/net/if_tun.c index 9de302f..315fa77 100644 --- a/sys/net/if_tun.c +++ b/sys/net/if_tun.c @@ -135,15 +135,15 @@ tunclone(void *arg, char *name, int namelen, dev_t *dev) } static int -tunmodevent(module_t mod, int type, void *data) +tunmodevent(module_t mod, int type, void *data) { static eventhandler_tag tag; struct tun_softc *tp; dev_t dev; int err; - switch (type) { - case MOD_LOAD: + switch (type) { + case MOD_LOAD: tag = EVENTHANDLER_REGISTER(dev_clone, tunclone, 0, 1000); if (tag == NULL) return (ENOMEM); @@ -162,8 +162,8 @@ tunmodevent(module_t mod, int type, void *data) EVENTHANDLER_DEREGISTER(dev_clone, tag); return (err); } - break; - case MOD_UNLOAD: + break; + case MOD_UNLOAD: err = rman_fini(&tununits); if (err != 0) return (err); @@ -192,15 +192,15 @@ tunmodevent(module_t mod, int type, void *data) destroy_dev(udev2dev(tunbasedev, 0)); break; - } - return 0; -} + } + return 0; +} -static moduledata_t tun_mod = { - "if_tun", - tunmodevent, +static moduledata_t tun_mod = { + "if_tun", + tunmodevent, 0 -}; +}; DECLARE_MODULE(if_tun, tun_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); @@ -314,7 +314,7 @@ tunclose(dev_t dev, int foo, int bar, struct thread *td) } if (ifp->if_flags & IFF_RUNNING) { - register struct ifaddr *ifa; + struct ifaddr *ifa; s = splimp(); /* find internet addresses and delete routes */ @@ -340,7 +340,7 @@ static int tuninit(struct ifnet *ifp) { struct tun_softc *tp = ifp->if_softc; - register struct ifaddr *ifa; + struct ifaddr *ifa; int error = 0; TUNDEBUG("%s%d: tuninit\n", ifp->if_name, ifp->if_unit); @@ -348,7 +348,7 @@ tuninit(struct ifnet *ifp) ifp->if_flags |= IFF_UP | IFF_RUNNING; getmicrotime(&ifp->if_lastchange); - for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; + for (ifa = TAILQ_FIRST(&ifp->if_addrhead); ifa; ifa = TAILQ_NEXT(ifa, ifa_link)) { if (ifa->ifa_addr == NULL) error = EFAULT; @@ -532,26 +532,26 @@ tunioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) int s; int error; struct tun_softc *tp = dev->si_drv1; - struct tuninfo *tunp; + struct tuninfo *tunp; switch (cmd) { - case TUNSIFINFO: - tunp = (struct tuninfo *)data; + case TUNSIFINFO: + tunp = (struct tuninfo *)data; if (tunp->mtu < IF_MINMTU) return (EINVAL); - if (tp->tun_if.if_mtu != tunp->mtu + if (tp->tun_if.if_mtu != tunp->mtu && (error = suser(td)) != 0) return (error); - tp->tun_if.if_mtu = tunp->mtu; - tp->tun_if.if_type = tunp->type; - tp->tun_if.if_baudrate = tunp->baudrate; - break; - case TUNGIFINFO: - tunp = (struct tuninfo *)data; - tunp->mtu = tp->tun_if.if_mtu; - tunp->type = tp->tun_if.if_type; - tunp->baudrate = tp->tun_if.if_baudrate; - break; + tp->tun_if.if_mtu = tunp->mtu; + tp->tun_if.if_type = tunp->type; + tp->tun_if.if_baudrate = tunp->baudrate; + break; + case TUNGIFINFO: + tunp = (struct tuninfo *)data; + tunp->mtu = tp->tun_if.if_mtu; + tunp->type = tp->tun_if.if_type; + tunp->baudrate = tp->tun_if.if_baudrate; + break; case TUNSDEBUG: tundebug = *(int *)data; break; @@ -569,7 +569,7 @@ tunioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) if (*(int *)data) { tp->tun_flags |= TUN_IFHEAD; tp->tun_flags &= ~TUN_LMODE; - } else + } else tp->tun_flags &= ~TUN_IFHEAD; break; case TUNGIFHEAD: @@ -606,7 +606,7 @@ tunioctl(dev_t dev, u_long cmd, caddr_t data, int flag, struct thread *td) s = splimp(); if (tp->tun_if.if_snd.ifq_head) { struct mbuf *mb = tp->tun_if.if_snd.ifq_head; - for( *(int *)data = 0; mb != 0; mb = mb->m_next) + for( *(int *)data = 0; mb != 0; mb = mb->m_next) *(int *)data += mb->m_len; } else *(int *)data = 0; |