Module Name: src Committed By: skrll Date: Tue Feb 7 11:17:50 UTC 2017
Modified Files: src/sys/net: if_tap.c Log Message: KNF and trailing whitespace. No functional change. To generate a diff of this commit: cvs rdiff -u -r1.94 -r1.95 src/sys/net/if_tap.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/net/if_tap.c diff -u src/sys/net/if_tap.c:1.94 src/sys/net/if_tap.c:1.95 --- src/sys/net/if_tap.c:1.94 Thu Dec 15 09:28:06 2016 +++ src/sys/net/if_tap.c Tue Feb 7 11:17:50 2017 @@ -1,4 +1,4 @@ -/* $NetBSD: if_tap.c,v 1.94 2016/12/15 09:28:06 ozaki-r Exp $ */ +/* $NetBSD: if_tap.c,v 1.95 2017/02/07 11:17:50 skrll Exp $ */ /* * Copyright (c) 2003, 2004, 2008, 2009 The NetBSD Foundation. @@ -33,7 +33,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.94 2016/12/15 09:28:06 ozaki-r Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.95 2017/02/07 11:17:50 skrll Exp $"); #if defined(_KERNEL_OPT) @@ -259,7 +259,7 @@ tapinit(void) (void)config_cfdriver_detach(&tap_cd); return; } - + if_clone_attach(&tap_cloners); sysctl_tap_setup(&tap_sysctl_clog); #ifdef _MODULE @@ -295,7 +295,7 @@ static int tap_match(device_t parent, cfdata_t cfdata, void *arg) { - return (1); + return 1; } void @@ -449,7 +449,7 @@ tap_detach(device_t self, int flags) pmf_device_deregister(self); - return (0); + return 0; } /* @@ -460,7 +460,7 @@ tap_detach(device_t self, int flags) static int tap_mediachange(struct ifnet *ifp) { - return (0); + return 0; } /* @@ -587,7 +587,7 @@ tap_ioctl(struct ifnet *ifp, u_long cmd, splx(s); - return (error); + return error; } /* @@ -600,11 +600,11 @@ tap_lifaddr(struct ifnet *ifp, u_long cm const struct sockaddr *sa = &ifra->ifra_addr; if (sa->sa_family != AF_LINK) - return (EINVAL); + return EINVAL; if_set_sadl(ifp, sa->sa_data, ETHER_ADDR_LEN, false); - return (0); + return 0; } /* @@ -619,7 +619,7 @@ tap_init(struct ifnet *ifp) tap_start(ifp); - return (0); + return 0; } /* @@ -655,10 +655,10 @@ tap_clone_create(struct if_clone *ifc, i if (tap_clone_creator(unit) == NULL) { aprint_error("%s%d: unable to attach an instance\n", tap_cd.cd_name, unit); - return (ENXIO); + return ENXIO; } atomic_inc_uint(&tap_count); - return (0); + return 0; } /* @@ -714,7 +714,7 @@ tap_clone_destroyer(device_t dev) aprint_error_dev(dev, "unable to detach instance\n"); free(cf, M_DEVBUF); - return (error); + return error; } /* @@ -749,13 +749,13 @@ tap_cdev_open(dev_t dev, int flags, int sc = device_lookup_private(&tap_cd, minor(dev)); if (sc == NULL) - return (ENXIO); + return ENXIO; /* The device can only be opened once */ if (sc->sc_flags & TAP_INUSE) - return (EBUSY); + return EBUSY; sc->sc_flags |= TAP_INUSE; - return (0); + return 0; } /* @@ -788,11 +788,11 @@ tap_dev_cloner(struct lwp *l) int error, fd; if ((error = fd_allocfile(&fp, &fd)) != 0) - return (error); + return error; if ((sc = tap_clone_creator(-1)) == NULL) { fd_abort(curproc, fp, fd); - return (ENXIO); + return ENXIO; } sc->sc_flags |= TAP_INUSE; @@ -819,7 +819,7 @@ tap_cdev_close(dev_t dev, int flags, int device_lookup_private(&tap_cd, minor(dev)); if (sc == NULL) - return (ENXIO); + return ENXIO; return tap_dev_close(sc); } @@ -839,21 +839,21 @@ tap_fops_close(file_t *fp) sc = device_lookup_private(&tap_cd, unit); if (sc == NULL) - return (ENXIO); + return ENXIO; /* tap_dev_close currently always succeeds, but it might not * always be the case. */ KERNEL_LOCK(1, NULL); if ((error = tap_dev_close(sc)) != 0) { KERNEL_UNLOCK_ONE(NULL); - return (error); + return error; } /* Destroy the device now that it is no longer useful, * unless it's already being destroyed. */ if ((sc->sc_flags & TAP_GOING) != 0) { KERNEL_UNLOCK_ONE(NULL); - return (0); + return 0; } error = tap_clone_destroyer(sc->sc_dev); @@ -894,7 +894,7 @@ tap_dev_close(struct tap_softc *sc) } sc->sc_flags &= ~(TAP_INUSE | TAP_ASYNCIO); - return (0); + return 0; } static int @@ -924,20 +924,20 @@ tap_dev_read(int unit, struct uio *uio, int error = 0, s; if (sc == NULL) - return (ENXIO); + return ENXIO; getnanotime(&sc->sc_atime); ifp = &sc->sc_ec.ec_if; if ((ifp->if_flags & IFF_UP) == 0) - return (EHOSTDOWN); + return EHOSTDOWN; /* * In the TAP_NBIO case, we have to make sure we won't be sleeping */ if ((sc->sc_flags & TAP_NBIO) != 0) { if (!mutex_tryenter(&sc->sc_rdlock)) - return (EWOULDBLOCK); + return EWOULDBLOCK; } else { mutex_enter(&sc->sc_rdlock); } @@ -957,13 +957,13 @@ tap_dev_read(int unit, struct uio *uio, splx(s); if (error != 0) - return (error); + return error; /* The device might have been downed */ if ((ifp->if_flags & IFF_UP) == 0) - return (EHOSTDOWN); + return EHOSTDOWN; if ((sc->sc_flags & TAP_NBIO)) { if (!mutex_tryenter(&sc->sc_rdlock)) - return (EWOULDBLOCK); + return EWOULDBLOCK; } else { mutex_enter(&sc->sc_rdlock); } @@ -995,7 +995,7 @@ tap_dev_read(int unit, struct uio *uio, out: mutex_exit(&sc->sc_rdlock); - return (error); + return error; } static int @@ -1054,7 +1054,7 @@ tap_dev_write(int unit, struct uio *uio, int s; if (sc == NULL) - return (ENXIO); + return ENXIO; getnanotime(&sc->sc_mtime); ifp = &sc->sc_ec.ec_if; @@ -1063,7 +1063,7 @@ tap_dev_write(int unit, struct uio *uio, MGETHDR(m, M_DONTWAIT, MT_DATA); if (m == NULL) { ifp->if_ierrors++; - return (ENOBUFS); + return ENOBUFS; } m->m_pkthdr.len = uio->uio_resid; @@ -1083,7 +1083,7 @@ tap_dev_write(int unit, struct uio *uio, if (error) { ifp->if_ierrors++; m_freem(m); - return (error); + return error; } m_set_rcvif(m, ifp); @@ -1092,7 +1092,7 @@ tap_dev_write(int unit, struct uio *uio, if_input(ifp, m); splx(s); - return (0); + return 0; } static int @@ -1132,7 +1132,7 @@ tap_dev_ioctl(int unit, u_long cmd, void *(int *)data = m->m_pkthdr.len; splx(s); return 0; - } + } case TIOCSPGRP: case FIOSETOWN: return fsetown(&sc->sc_pgid, cmd, data); @@ -1219,7 +1219,7 @@ tap_dev_poll(int unit, int events, struc } revents |= events & (POLLOUT|POLLWRNORM); - return (revents); + return revents; } static struct filterops tap_read_filterops = { 1, NULL, tap_kqdetach, @@ -1246,7 +1246,7 @@ tap_dev_kqfilter(int unit, struct knote device_lookup_private(&tap_cd, unit); if (sc == NULL) - return (ENXIO); + return ENXIO; KERNEL_LOCK(1, NULL); switch(kn->kn_filter) { @@ -1258,7 +1258,7 @@ tap_dev_kqfilter(int unit, struct knote break; default: KERNEL_UNLOCK_ONE(NULL); - return (EINVAL); + return EINVAL; } kn->kn_hook = sc; @@ -1266,7 +1266,7 @@ tap_dev_kqfilter(int unit, struct knote SLIST_INSERT_HEAD(&sc->sc_rsel.sel_klist, kn, kn_selnext); mutex_spin_exit(&sc->sc_kqlock); KERNEL_UNLOCK_ONE(NULL); - return (0); + return 0; } static void @@ -1415,17 +1415,17 @@ tap_sysctl_handler(SYSCTLFN_ARGS) node.sysctl_data = addr; error = sysctl_lookup(SYSCTLFN_CALL(&node)); if (error || newp == NULL) - return (error); + return error; len = strlen(addr); if (len < 11 || len > 17) - return (EINVAL); + return EINVAL; /* Commit change */ if (ether_aton_r(enaddr, sizeof(enaddr), addr) != 0) - return (EINVAL); + return EINVAL; if_set_sadl(ifp, enaddr, ETHER_ADDR_LEN, false); - return (error); + return error; } /*