Source-Changes-HG archive

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

[src/trunk]: src/sys/net Fix usage of pslist(9)



details:   https://anonhg.NetBSD.org/src/rev/e6ad13aeb398
branches:  trunk
changeset: 344678:e6ad13aeb398
user:      ozaki-r <ozaki-r%NetBSD.org@localhost>
date:      Mon Apr 11 05:40:47 2016 +0000

description:
Fix usage of pslist(9)

Pointed out by riastradh@.

diffstat:

 sys/net/bridgestp.c |  28 ++++++++++++++--------------
 sys/net/if_bridge.c |  13 ++++++-------
 2 files changed, 20 insertions(+), 21 deletions(-)

diffs (188 lines):

diff -r 7d3a92a8ee80 -r e6ad13aeb398 sys/net/bridgestp.c
--- a/sys/net/bridgestp.c       Mon Apr 11 03:46:47 2016 +0000
+++ b/sys/net/bridgestp.c       Mon Apr 11 05:40:47 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: bridgestp.c,v 1.20 2016/04/11 02:04:14 ozaki-r Exp $   */
+/*     $NetBSD: bridgestp.c,v 1.21 2016/04/11 05:40:47 ozaki-r Exp $   */
 
 /*
  * Copyright (c) 2000 Jason L. Wright (jason%thought.net@localhost)
@@ -40,7 +40,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: bridgestp.c,v 1.20 2016/04/11 02:04:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: bridgestp.c,v 1.21 2016/04/11 05:40:47 ozaki-r Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -341,7 +341,7 @@
 {
        struct bridge_iflist *bif;
 
-       PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+       PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
            bif_next) {
                if ((bif->bif_flags & IFBIF_STP) == 0)
                        continue;
@@ -416,7 +416,7 @@
 {
        struct bridge_iflist *root_port = NULL, *bif;
 
-       PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+       PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
            bif_next) {
                if ((bif->bif_flags & IFBIF_STP) == 0)
                        continue;
@@ -475,7 +475,7 @@
 {
        struct bridge_iflist *bif;
 
-       PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+       PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
            bif_next) {
                if ((bif->bif_flags & IFBIF_STP) == 0)
                        continue;
@@ -515,7 +515,7 @@
 {
        struct bridge_iflist *bif;
 
-       PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+       PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
            bif_next) {
                if ((bif->bif_flags & IFBIF_STP) == 0)
                        continue;
@@ -793,7 +793,7 @@
 
        struct bridge_iflist *bif;
 
-       PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+       PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
            bif_next) {
                if ((bif->bif_flags & IFBIF_STP) == 0)
                        continue;
@@ -833,7 +833,7 @@
 
        BRIDGE_LOCK(sc);
 
-       PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+       PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
            bif_next) {
                if ((bif->bif_flags & IFBIF_STP) == 0)
                        continue;
@@ -888,7 +888,7 @@
 
        BRIDGE_LOCK(sc);
 
-       PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+       PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
            bif_next) {
                if (bif->bif_flags & IFBIF_STP)
                        bstp_enable_port(sc, bif);
@@ -909,7 +909,7 @@
        struct bridge_iflist *bif;
 
        BRIDGE_LOCK(sc);
-       PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+       PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
            bif_next) {
                bstp_set_port_state(bif, BSTP_IFSTATE_DISABLED);
                bstp_timer_stop(&bif->bif_hold_timer);
@@ -982,7 +982,7 @@
 
        root = bstp_root_bridge(sc);
 
-       PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+       PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
            bif_next) {
                if ((bif->bif_flags & IFBIF_STP) == 0)
                        continue;
@@ -1076,7 +1076,7 @@
        s = splnet();
        BRIDGE_LOCK(sc);
 
-       PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+       PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
            bif_next) {
                if ((bif->bif_flags & IFBIF_STP) == 0)
                        continue;
@@ -1100,7 +1100,7 @@
            sc->sc_topology_change_time))
                bstp_topology_change_timer_expiry(sc);
 
-       PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+       PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
            bif_next) {
                if ((bif->bif_flags & IFBIF_STP) == 0)
                        continue;
@@ -1109,7 +1109,7 @@
                        bstp_message_age_timer_expiry(sc, bif);
        }
 
-       PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+       PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
            bif_next) {
                if ((bif->bif_flags & IFBIF_STP) == 0)
                        continue;
diff -r 7d3a92a8ee80 -r e6ad13aeb398 sys/net/if_bridge.c
--- a/sys/net/if_bridge.c       Mon Apr 11 03:46:47 2016 +0000
+++ b/sys/net/if_bridge.c       Mon Apr 11 05:40:47 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_bridge.c,v 1.112 2016/04/11 02:04:14 ozaki-r Exp $  */
+/*     $NetBSD: if_bridge.c,v 1.113 2016/04/11 05:40:47 ozaki-r Exp $  */
 
 /*
  * Copyright 2001 Wasabi Systems, Inc.
@@ -80,7 +80,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.112 2016/04/11 02:04:14 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_bridge.c,v 1.113 2016/04/11 05:40:47 ozaki-r Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_bridge_ipf.h"
@@ -713,8 +713,6 @@
        ifs->if_bridgeif = NULL;
 
        PSLIST_WRITER_REMOVE(bif, bif_next);
-       PSLIST_ENTRY_DESTROY(bif, bif_next);
-
        BRIDGE_PSZ_PERFORM(sc);
 
 #ifdef BRIDGE_MPSAFE
@@ -728,6 +726,7 @@
 #endif
        BRIDGE_UNLOCK(sc);
 
+       PSLIST_ENTRY_DESTROY(bif, bif_next);
        kmem_free(bif, sizeof(*bif));
 
        BRIDGE_LOCK(sc);
@@ -949,7 +948,7 @@
 retry:
        BRIDGE_LOCK(sc);
        count = 0;
-       PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+       PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
            bif_next)
                count++;
        BRIDGE_UNLOCK(sc);
@@ -970,7 +969,7 @@
        BRIDGE_LOCK(sc);
 
        i = 0;
-       PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+       PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
            bif_next)
                i++;
        if (i > count) {
@@ -984,7 +983,7 @@
        }
 
        i = 0;
-       PSLIST_READER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
+       PSLIST_WRITER_FOREACH(bif, &sc->sc_iflist, struct bridge_iflist,
            bif_next) {
                struct ifbreq *breq = &breqs[i++];
                memset(breq, 0, sizeof(*breq));



Home | Main Index | Thread Index | Old Index