Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net KNF. No functional change.



details:   https://anonhg.NetBSD.org/src/rev/348e4aa3e2f4
branches:  trunk
changeset: 999139:348e4aa3e2f4
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Tue May 21 09:18:37 2019 +0000

description:
KNF. No functional change.

diffstat:

 sys/net/if.c       |  20 ++++++++--------
 sys/net/if_media.c |   7 ++---
 sys/net/if_tap.c   |  67 ++++++++++++++++++++++++++++-------------------------
 3 files changed, 48 insertions(+), 46 deletions(-)

diffs (truncated from 353 to 300 lines):

diff -r e1adeff1f9ad -r 348e4aa3e2f4 sys/net/if.c
--- a/sys/net/if.c      Tue May 21 05:29:21 2019 +0000
+++ b/sys/net/if.c      Tue May 21 09:18:37 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if.c,v 1.454 2019/05/17 07:37:12 msaitoh Exp $ */
+/*     $NetBSD: if.c,v 1.455 2019/05/21 09:18:37 msaitoh Exp $ */
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.454 2019/05/17 07:37:12 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if.c,v 1.455 2019/05/21 09:18:37 msaitoh Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -452,7 +452,7 @@
        addrlen = ifp->if_addrlen;
        socksize = roundup(sockaddr_dl_measure(namelen, addrlen), sizeof(long));
        ifasize = sizeof(*ifa) + 2 * socksize;
-       ifa = malloc(ifasize, M_IFADDR, M_WAITOK|M_ZERO);
+       ifa = malloc(ifasize, M_IFADDR, M_WAITOK | M_ZERO);
 
        sdl = (struct sockaddr_dl *)(ifa + 1);
        mask = (struct sockaddr_dl *)(socksize + (char *)sdl);
@@ -657,7 +657,7 @@
                /* grow ifindex2ifnet */
                m = oldlim * sizeof(struct ifnet *);
                n = if_indexlim * sizeof(struct ifnet *);
-               q = malloc(n, M_IFADDR, M_WAITOK|M_ZERO);
+               q = malloc(n, M_IFADDR, M_WAITOK | M_ZERO);
                if (ifindex2ifnet != NULL) {
                        memcpy(q, ifindex2ifnet, m);
                        free(ifindex2ifnet, M_IFADDR);
@@ -985,7 +985,7 @@
                goto bad;
 
        if (sysctl_createv(clog, 0, &rnode, &cnode,
-                      CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+                      CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
                       CTLTYPE_INT, "maxlen",
                       SYSCTL_DESCR("Maximum allowed input queue length"),
                       sysctl_percpuq_maxlen_handler, 0, (void *)ipq, 0,
@@ -1643,7 +1643,7 @@
 if_is_unit(const char *name)
 {
 
-       while(*name != '\0') {
+       while (*name != '\0') {
                if (*name < '0' || *name > '9')
                        return false;
                name++;
@@ -3583,8 +3583,8 @@
                 * XXX: we should rather mark "tentative" on such addresses,
                 * and do DAD after the interface becomes ready.
                 */
-               if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) !=
-                   (IFF_UP|IFF_RUNNING))
+               if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) !=
+                   (IFF_UP | IFF_RUNNING))
                        return 0;
 
                return 1;
@@ -3684,7 +3684,7 @@
                goto bad;
 
        if (sysctl_createv(clog, 0, &rnode, &cnode,
-                      CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+                      CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
                       CTLTYPE_INT, "maxlen",
                       SYSCTL_DESCR("Maximum allowed output queue length"),
                       NULL, 0, &ifq->ifq_maxlen, 0,
@@ -3788,7 +3788,7 @@
                       len_func, 0, NULL, 0,
                       CTL_NET, pf, ipn, qid, IFQCTL_LEN, CTL_EOL);
        sysctl_createv(clog, 0, NULL, NULL,
-                      CTLFLAG_PERMANENT|CTLFLAG_READWRITE,
+                      CTLFLAG_PERMANENT | CTLFLAG_READWRITE,
                       CTLTYPE_INT, "maxlen",
                       SYSCTL_DESCR("Maximum allowed input queue length"),
                       maxlen_func, 0, NULL, 0,
diff -r e1adeff1f9ad -r 348e4aa3e2f4 sys/net/if_media.c
--- a/sys/net/if_media.c        Tue May 21 05:29:21 2019 +0000
+++ b/sys/net/if_media.c        Tue May 21 09:18:37 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_media.c,v 1.45 2019/05/17 07:37:12 msaitoh Exp $    */
+/*     $NetBSD: if_media.c,v 1.46 2019/05/21 09:18:37 msaitoh Exp $    */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -76,7 +76,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_media.c,v 1.45 2019/05/17 07:37:12 msaitoh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_media.c,v 1.46 2019/05/21 09:18:37 msaitoh Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -134,8 +134,7 @@
 }
 
 static void
-ifmedia_status(struct ifmedia *ifm, struct ifnet *ifp,
-       struct ifmediareq *ifmr)
+ifmedia_status(struct ifmedia *ifm, struct ifnet *ifp, struct ifmediareq *ifmr)
 {
 
        if (ifm->ifm_status == NULL)
diff -r e1adeff1f9ad -r 348e4aa3e2f4 sys/net/if_tap.c
--- a/sys/net/if_tap.c  Tue May 21 05:29:21 2019 +0000
+++ b/sys/net/if_tap.c  Tue May 21 09:18:37 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_tap.c,v 1.111 2019/04/26 11:51:56 pgoyette Exp $    */
+/*     $NetBSD: if_tap.c,v 1.112 2019/05/21 09:18:37 msaitoh 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.111 2019/04/26 11:51:56 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_tap.c,v 1.112 2019/05/21 09:18:37 msaitoh Exp $");
 
 #if defined(_KERNEL_OPT)
 
@@ -251,6 +251,7 @@
 tapinit(void)
 {
        int error = config_cfattach_attach(tap_cd.cd_name, &tap_ca);
+
        if (error) {
                aprint_error("%s: unable to register cfattach\n",
                    tap_cd.cd_name);
@@ -350,14 +351,14 @@
         * of them.
         */
        ifmedia_init(&sc->sc_im, 0, tap_mediachange, tap_mediastatus);
-       ifmedia_add(&sc->sc_im, IFM_ETHER|IFM_1000_T, 0, NULL);
-       ifmedia_add(&sc->sc_im, IFM_ETHER|IFM_1000_T|IFM_FDX, 0, NULL);
-       ifmedia_add(&sc->sc_im, IFM_ETHER|IFM_100_TX, 0, NULL);
-       ifmedia_add(&sc->sc_im, IFM_ETHER|IFM_100_TX|IFM_FDX, 0, NULL);
-       ifmedia_add(&sc->sc_im, IFM_ETHER|IFM_10_T, 0, NULL);
-       ifmedia_add(&sc->sc_im, IFM_ETHER|IFM_10_T|IFM_FDX, 0, NULL);
-       ifmedia_add(&sc->sc_im, IFM_ETHER|IFM_AUTO, 0, NULL);
-       ifmedia_set(&sc->sc_im, IFM_ETHER|IFM_AUTO);
+       ifmedia_add(&sc->sc_im, IFM_ETHER | IFM_1000_T, 0, NULL);
+       ifmedia_add(&sc->sc_im, IFM_ETHER | IFM_1000_T | IFM_FDX, 0, NULL);
+       ifmedia_add(&sc->sc_im, IFM_ETHER | IFM_100_TX, 0, NULL);
+       ifmedia_add(&sc->sc_im, IFM_ETHER | IFM_100_TX | IFM_FDX, 0, NULL);
+       ifmedia_add(&sc->sc_im, IFM_ETHER | IFM_10_T, 0, NULL);
+       ifmedia_add(&sc->sc_im, IFM_ETHER | IFM_10_T | IFM_FDX, 0, NULL);
+       ifmedia_add(&sc->sc_im, IFM_ETHER | IFM_AUTO, 0, NULL);
+       ifmedia_set(&sc->sc_im, IFM_ETHER | IFM_AUTO);
 
        /*
         * One should note that an interface must do multicast in order
@@ -477,6 +478,7 @@
 tap_mediastatus(struct ifnet *ifp, struct ifmediareq *imr)
 {
        struct tap_softc *sc = (struct tap_softc *)ifp->if_softc;
+
        imr->ifm_active = sc->sc_im.ifm_cur->ifm_media;
 }
 
@@ -516,7 +518,7 @@
        mutex_enter(&sc->sc_lock);
        if ((sc->sc_flags & TAP_INUSE) == 0) {
                /* Simply drop packets */
-               for(;;) {
+               for (;;) {
                        IFQ_DEQUEUE(&ifp->if_snd, m0);
                        if (m0 == NULL)
                                goto done;
@@ -550,7 +552,7 @@
                ifp = &sc->sc_ec.ec_if;
                if (ifp->if_flags & IFF_RUNNING) {
                        a = POLL_IN;
-                       b = POLLIN|POLLRDNORM;
+                       b = POLLIN | POLLRDNORM;
                } else {
                        a = POLL_HUP;
                        b = 0;
@@ -661,6 +663,7 @@
 static int
 tap_clone_create(struct if_clone *ifc, int unit)
 {
+
        if (tap_clone_creator(unit) == NULL) {
                aprint_error("%s%d: unable to attach an instance\n",
                    tap_cd.cd_name, unit);
@@ -806,7 +809,7 @@
 
        sc->sc_flags |= TAP_INUSE;
 
-       return fd_clone(fp, fd, FREAD|FWRITE, &tap_fileops,
+       return fd_clone(fp, fd, FREAD | FWRITE, &tap_fileops,
            (void *)(intptr_t)device_unit(sc->sc_dev));
 }
 
@@ -821,11 +824,9 @@
  * created it closes it.
  */
 static int
-tap_cdev_close(dev_t dev, int flags, int fmt,
-    struct lwp *l)
+tap_cdev_close(dev_t dev, int flags, int fmt, struct lwp *l)
 {
-       struct tap_softc *sc =
-           device_lookup_private(&tap_cd, minor(dev));
+       struct tap_softc *sc = device_lookup_private(&tap_cd, minor(dev));
 
        if (sc == NULL)
                return ENXIO;
@@ -842,8 +843,8 @@
 static int
 tap_fops_close(file_t *fp)
 {
+       struct tap_softc *sc;
        int unit = fp->f_devunit;
-       struct tap_softc *sc;
        int error;
 
        sc = device_lookup_private(&tap_cd, unit);
@@ -909,6 +910,7 @@
 static int
 tap_cdev_read(dev_t dev, struct uio *uio, int flags)
 {
+
        return tap_dev_read(minor(dev), uio, flags);
 }
 
@@ -941,15 +943,12 @@
        if ((ifp->if_flags & IFF_UP) == 0)
                return EHOSTDOWN;
 
-       /*
-        * In the TAP_NBIO case, we have to make sure we won't be sleeping
-        */
+       /* 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_lock))
                        return EWOULDBLOCK;
-       } else {
+       } else
                mutex_enter(&sc->sc_lock);
-       }
 
        if (IFQ_IS_EMPTY(&ifp->if_snd)) {
                ifp->if_flags &= ~IFF_OACTIVE;
@@ -1027,6 +1026,7 @@
 static int
 tap_cdev_write(dev_t dev, struct uio *uio, int flags)
 {
+
        return tap_dev_write(minor(dev), uio, flags);
 }
 
@@ -1092,15 +1092,16 @@
 }
 
 static int
-tap_cdev_ioctl(dev_t dev, u_long cmd, void *data, int flags,
-    struct lwp *l)
+tap_cdev_ioctl(dev_t dev, u_long cmd, void *data, int flags, struct lwp *l)
 {
+
        return tap_dev_ioctl(minor(dev), cmd, data, l);
 }
 
 static int
 tap_fops_ioctl(file_t *fp, u_long cmd, void *data)
 {
+
        return tap_dev_ioctl(fp->f_devunit, cmd, data, curlwp);
 }
 
@@ -1174,26 +1175,27 @@
 static int
 tap_cdev_poll(dev_t dev, int events, struct lwp *l)
 {
+
        return tap_dev_poll(minor(dev), events, l);
 }
 
 static int
 tap_fops_poll(file_t *fp, int events)
 {
+
        return tap_dev_poll(fp->f_devunit, events, curlwp);
 }
 
 static int
 tap_dev_poll(int unit, int events, struct lwp *l)
 {
-       struct tap_softc *sc =
-           device_lookup_private(&tap_cd, unit);



Home | Main Index | Thread Index | Old Index