Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet Style (realign everything correctly), and fix a ...



details:   https://anonhg.NetBSD.org/src/rev/1f2a6f41e11b
branches:  trunk
changeset: 359418:1f2a6f41e11b
user:      maxv <maxv%NetBSD.org@localhost>
date:      Fri Feb 09 08:03:33 2018 +0000

description:
Style (realign everything correctly), and fix a typo.

diffstat:

 sys/netinet/ip_mroute.c |  1006 +++++++++++++++++++++++-----------------------
 1 files changed, 503 insertions(+), 503 deletions(-)

diffs (truncated from 1095 to 300 lines):

diff -r 6bc1fd18f55c -r 1f2a6f41e11b sys/netinet/ip_mroute.c
--- a/sys/netinet/ip_mroute.c   Fri Feb 09 04:38:24 2018 +0000
+++ b/sys/netinet/ip_mroute.c   Fri Feb 09 08:03:33 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_mroute.c,v 1.153 2018/02/07 13:22:41 maxv Exp $     */
+/*     $NetBSD: ip_mroute.c,v 1.154 2018/02/09 08:03:33 maxv Exp $     */
 
 /*
  * Copyright (c) 1992, 1993
@@ -93,7 +93,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.153 2018/02/07 13:22:41 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_mroute.c,v 1.154 2018/02/09 08:03:33 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -2559,88 +2559,88 @@
 static void
 bw_meter_process(void)
 {
-    int s;
-    static uint32_t last_tv_sec;       /* last time we processed this */
-
-    uint32_t loops;
-    int i;
-    struct timeval now, process_endtime;
-
-    microtime(&now);
-    if (last_tv_sec == now.tv_sec)
-       return;         /* nothing to do */
-
-    loops = now.tv_sec - last_tv_sec;
-    last_tv_sec = now.tv_sec;
-    if (loops > BW_METER_BUCKETS)
-       loops = BW_METER_BUCKETS;
-
-    s = splsoftnet();
-    /*
-     * Process all bins of bw_meter entries from the one after the last
-     * processed to the current one. On entry, i points to the last bucket
-     * visited, so we need to increment i at the beginning of the loop.
-     */
-    for (i = (now.tv_sec - loops) % BW_METER_BUCKETS; loops > 0; loops--) {
-       struct bw_meter *x, *tmp_list;
-
-       if (++i >= BW_METER_BUCKETS)
-           i = 0;
-
-       /* Disconnect the list of bw_meter entries from the bin */
-       tmp_list = bw_meter_timers[i];
-       bw_meter_timers[i] = NULL;
-
-       /* Process the list of bw_meter entries */
-       while (tmp_list != NULL) {
-           x = tmp_list;
-           tmp_list = tmp_list->bm_time_next;
-
-           /* Test if the time interval is over */
-           process_endtime = x->bm_start_time;
-           BW_TIMEVALADD(&process_endtime, &x->bm_threshold.b_time);
-           if (BW_TIMEVALCMP(&process_endtime, &now, >)) {
-               /* Not yet: reschedule, but don't reset */
-               int time_hash;
-
-               BW_METER_TIMEHASH(x, time_hash);
-               if (time_hash == i && process_endtime.tv_sec == now.tv_sec) {
-                   /*
-                    * XXX: somehow the bin processing is a bit ahead of time.
-                    * Put the entry in the next bin.
-                    */
-                   if (++time_hash >= BW_METER_BUCKETS)
-                       time_hash = 0;
+       int s;
+       static uint32_t last_tv_sec;    /* last time we processed this */
+
+       uint32_t loops;
+       int i;
+       struct timeval now, process_endtime;
+
+       microtime(&now);
+       if (last_tv_sec == now.tv_sec)
+               return;         /* nothing to do */
+
+       loops = now.tv_sec - last_tv_sec;
+       last_tv_sec = now.tv_sec;
+       if (loops > BW_METER_BUCKETS)
+               loops = BW_METER_BUCKETS;
+
+       s = splsoftnet();
+       /*
+        * Process all bins of bw_meter entries from the one after the last
+        * processed to the current one. On entry, i points to the last bucket
+        * visited, so we need to increment i at the beginning of the loop.
+        */
+       for (i = (now.tv_sec - loops) % BW_METER_BUCKETS; loops > 0; loops--) {
+               struct bw_meter *x, *tmp_list;
+
+               if (++i >= BW_METER_BUCKETS)
+                       i = 0;
+
+               /* Disconnect the list of bw_meter entries from the bin */
+               tmp_list = bw_meter_timers[i];
+               bw_meter_timers[i] = NULL;
+
+               /* Process the list of bw_meter entries */
+               while (tmp_list != NULL) {
+                       x = tmp_list;
+                       tmp_list = tmp_list->bm_time_next;
+
+                       /* Test if the time interval is over */
+                       process_endtime = x->bm_start_time;
+                       BW_TIMEVALADD(&process_endtime, &x->bm_threshold.b_time);
+                       if (BW_TIMEVALCMP(&process_endtime, &now, >)) {
+                               /* Not yet: reschedule, but don't reset */
+                               int time_hash;
+
+                               BW_METER_TIMEHASH(x, time_hash);
+                               if (time_hash == i && process_endtime.tv_sec == now.tv_sec) {
+                                       /*
+                                        * XXX: somehow the bin processing is a bit ahead of time.
+                                        * Put the entry in the next bin.
+                                        */
+                                       if (++time_hash >= BW_METER_BUCKETS)
+                                               time_hash = 0;
+                               }
+                               x->bm_time_next = bw_meter_timers[time_hash];
+                               bw_meter_timers[time_hash] = x;
+                               x->bm_time_hash = time_hash;
+
+                               continue;
+                       }
+
+                       /*
+                        * Test if we should deliver an upcall
+                        */
+                       if (((x->bm_flags & BW_METER_UNIT_PACKETS) &&
+                           (x->bm_measured.b_packets <= x->bm_threshold.b_packets)) ||
+                           ((x->bm_flags & BW_METER_UNIT_BYTES) &&
+                           (x->bm_measured.b_bytes <= x->bm_threshold.b_bytes))) {
+                               /* Prepare an upcall for delivery */
+                               bw_meter_prepare_upcall(x, &now);
+                       }
+
+                       /*
+                         * Reschedule for next processing
+                        */
+                       schedule_bw_meter(x, &now);
                }
-               x->bm_time_next = bw_meter_timers[time_hash];
-               bw_meter_timers[time_hash] = x;
-               x->bm_time_hash = time_hash;
-
-               continue;
-           }
-
-           /*
-            * Test if we should deliver an upcall
-            */
-           if (((x->bm_flags & BW_METER_UNIT_PACKETS) &&
-                (x->bm_measured.b_packets <= x->bm_threshold.b_packets)) ||
-               ((x->bm_flags & BW_METER_UNIT_BYTES) &&
-                (x->bm_measured.b_bytes <= x->bm_threshold.b_bytes))) {
-               /* Prepare an upcall for delivery */
-               bw_meter_prepare_upcall(x, &now);
-           }
-
-           /*
-            * Reschedule for next processing
-            */
-           schedule_bw_meter(x, &now);
        }
-    }
-
-    /* Send all upcalls that are pending delivery */
-    bw_upcalls_send();
-
-    splx(s);
+
+       /* Send all upcalls that are pending delivery */
+       bw_upcalls_send();
+
+       splx(s);
 }
 
 /*
@@ -2649,14 +2649,14 @@
 static void
 expire_bw_upcalls_send(void *unused)
 {
-    int s;
-
-    s = splsoftnet();
-    bw_upcalls_send();
-    splx(s);
-
-    callout_reset(&bw_upcalls_ch, BW_UPCALLS_PERIOD,
-                 expire_bw_upcalls_send, NULL);
+       int s;
+
+       s = splsoftnet();
+       bw_upcalls_send();
+       splx(s);
+
+       callout_reset(&bw_upcalls_ch, BW_UPCALLS_PERIOD,
+           expire_bw_upcalls_send, NULL);
 }
 
 /*
@@ -2666,11 +2666,11 @@
 static void
 expire_bw_meter_process(void *unused)
 {
-    if (mrt_api_config & MRT_MFC_BW_UPCALL)
-       bw_meter_process();
-
-    callout_reset(&bw_meter_ch, BW_METER_PERIOD,
-                 expire_bw_meter_process, NULL);
+       if (mrt_api_config & MRT_MFC_BW_UPCALL)
+               bw_meter_process();
+
+       callout_reset(&bw_meter_ch, BW_METER_PERIOD,
+           expire_bw_meter_process, NULL);
 }
 
 /*
@@ -2682,38 +2682,38 @@
  * Send the packet up to the user daemon, or eventually do kernel encapsulation
  */
 static int
-pim_register_send(struct ip *ip, struct vif *vifp,
-       struct mbuf *m, struct mfc *rt)
+pim_register_send(struct ip *ip, struct vif *vifp, struct mbuf *m,
+    struct mfc *rt)
 {
-    struct mbuf *mb_copy, *mm;
-
-    if (mrtdebug & DEBUG_PIM)
-        log(LOG_DEBUG, "pim_register_send: \n");
-
-    mb_copy = pim_register_prepare(ip, m);
-    if (mb_copy == NULL)
-       return ENOBUFS;
-
-    /*
-     * Send all the fragments. Note that the mbuf for each fragment
-     * is freed by the sending machinery.
-     */
-    for (mm = mb_copy; mm; mm = mb_copy) {
-       mb_copy = mm->m_nextpkt;
-       mm->m_nextpkt = NULL;
-       mm = m_pullup(mm, sizeof(struct ip));
-       if (mm != NULL) {
-           ip = mtod(mm, struct ip *);
-           if ((mrt_api_config & MRT_MFC_RP) &&
-               !in_nullhost(rt->mfc_rp)) {
-               pim_register_send_rp(ip, vifp, mm, rt);
-           } else {
-               pim_register_send_upcall(ip, vifp, mm, rt);
-           }
+       struct mbuf *mb_copy, *mm;
+
+       if (mrtdebug & DEBUG_PIM)
+               log(LOG_DEBUG, "pim_register_send: \n");
+
+       mb_copy = pim_register_prepare(ip, m);
+       if (mb_copy == NULL)
+               return ENOBUFS;
+
+       /*
+        * Send all the fragments. Note that the mbuf for each fragment
+        * is freed by the sending machinery.
+        */
+       for (mm = mb_copy; mm; mm = mb_copy) {
+               mb_copy = mm->m_nextpkt;
+               mm->m_nextpkt = NULL;
+               mm = m_pullup(mm, sizeof(struct ip));
+               if (mm != NULL) {
+                       ip = mtod(mm, struct ip *);
+                       if ((mrt_api_config & MRT_MFC_RP) &&
+                           !in_nullhost(rt->mfc_rp)) {
+                               pim_register_send_rp(ip, vifp, mm, rt);
+                       } else {
+                               pim_register_send_upcall(ip, vifp, mm, rt);
+                       }
+               }
        }
-    }
-
-    return 0;
+
+       return 0;
 }
 
 /*
@@ -2724,45 +2724,45 @@
 static struct mbuf *
 pim_register_prepare(struct ip *ip, struct mbuf *m)
 {



Home | Main Index | Thread Index | Old Index