Source-Changes-HG archive

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

[src/trunk]: src/sys/net - Modify ether_ioctl() for readability. No functiona...



details:   https://anonhg.NetBSD.org/src/rev/c20e7c429fcc
branches:  trunk
changeset: 828003:c20e7c429fcc
user:      msaitoh <msaitoh%NetBSD.org@localhost>
date:      Wed Nov 22 04:27:57 2017 +0000

description:
- Modify ether_ioctl() for readability. No functional change.
- KNF

diffstat:

 sys/net/if_ethersubr.c |  43 +++++++++++++++++++++++--------------------
 1 files changed, 23 insertions(+), 20 deletions(-)

diffs (97 lines):

diff -r 2154a7457723 -r c20e7c429fcc sys/net/if_ethersubr.c
--- a/sys/net/if_ethersubr.c    Wed Nov 22 03:45:15 2017 +0000
+++ b/sys/net/if_ethersubr.c    Wed Nov 22 04:27:57 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ethersubr.c,v 1.246 2017/11/16 03:07:18 ozaki-r Exp $       */
+/*     $NetBSD: if_ethersubr.c,v 1.247 2017/11/22 04:27:57 msaitoh Exp $       */
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -61,7 +61,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.246 2017/11/16 03:07:18 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ethersubr.c,v 1.247 2017/11/22 04:27:57 msaitoh Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -226,13 +226,13 @@
                ifp = ifp->if_carpdev;
                /* ac = (struct arpcom *)ifp; */
 
-               if ((ifp0->if_flags & (IFF_UP|IFF_RUNNING)) !=
-                   (IFF_UP|IFF_RUNNING))
+               if ((ifp0->if_flags & (IFF_UP | IFF_RUNNING)) !=
+                   (IFF_UP | IFF_RUNNING))
                        senderr(ENETDOWN);
        }
 #endif /* NCARP > 0 */
 
-       if ((ifp->if_flags & (IFF_UP|IFF_RUNNING)) != (IFF_UP|IFF_RUNNING))
+       if ((ifp->if_flags & (IFF_UP | IFF_RUNNING)) != (IFF_UP | IFF_RUNNING))
                senderr(ENETDOWN);
 
        switch (dst->sa_family) {
@@ -640,7 +640,7 @@
                        return;
        }
 #endif /* NCARP > 0 */
-       if ((m->m_flags & (M_BCAST|M_MCAST|M_PROMISC)) == 0 &&
+       if ((m->m_flags & (M_BCAST | M_MCAST | M_PROMISC)) == 0 &&
            (ifp->if_flags & IFF_PROMISC) != 0 &&
            memcmp(CLLADDR(ifp->if_sadl), eh->ether_dhost,
                   ETHER_ADDR_LEN) != 0) {
@@ -1348,8 +1348,8 @@
            {
                struct ifaddr *ifa = (struct ifaddr *)data;
                if (ifa->ifa_addr->sa_family != AF_LINK
-                   && (ifp->if_flags & (IFF_UP|IFF_RUNNING)) !=
-                      (IFF_UP|IFF_RUNNING)) {
+                   && (ifp->if_flags & (IFF_UP | IFF_RUNNING)) !=
+                      (IFF_UP | IFF_RUNNING)) {
                        ifp->if_flags |= IFF_UP;
                        if ((error = (*ifp->if_init)(ifp)) != 0)
                                return error;
@@ -1384,7 +1384,7 @@
        case SIOCSIFFLAGS:
                if ((error = ifioctl_common(ifp, cmd, data)) != 0)
                        return error;
-               switch (ifp->if_flags & (IFF_UP|IFF_RUNNING)) {
+               switch (ifp->if_flags & (IFF_UP | IFF_RUNNING)) {
                case IFF_RUNNING:
                        /*
                         * If interface is marked down and it is running,
@@ -1398,18 +1398,21 @@
                         * start it.
                         */
                        return (*ifp->if_init)(ifp);
-               case IFF_UP|IFF_RUNNING:
+               case IFF_UP | IFF_RUNNING:
                        error = 0;
-                       if (ec->ec_ifflags_cb == NULL ||
-                           (error = (*ec->ec_ifflags_cb)(ec)) == ENETRESET) {
-                               /*
-                                * Reset the interface to pick up
-                                * changes in any other flags that
-                                * affect the hardware state.
-                                */
-                               return (*ifp->if_init)(ifp);
-                       } else 
-                               return error;
+                       if (ec->ec_ifflags_cb != NULL) {
+                               error = (*ec->ec_ifflags_cb)(ec);
+                               if (error == ENETRESET) {
+                                       /*
+                                        * Reset the interface to pick up
+                                        * changes in any other flags that
+                                        * affect the hardware state.
+                                        */
+                                       return (*ifp->if_init)(ifp);
+                               }
+                       } else
+                               error = (*ifp->if_init)(ifp);
+                       return error;
                case 0:
                        break;
                }



Home | Main Index | Thread Index | Old Index