Source-Changes-HG archive

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

[src/trunk]: src/sys/net Use sel{record,remove}_knote().



details:   https://anonhg.NetBSD.org/src/rev/1939d0523289
branches:  trunk
changeset: 979154:1939d0523289
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri Dec 18 01:31:49 2020 +0000

description:
Use sel{record,remove}_knote().

diffstat:

 sys/dev/usb/udsir.c      |  16 ++++++++--------
 sys/dev/usb/ugen.c       |  14 +++++++-------
 sys/dev/usb/uhid.c       |  11 ++++-------
 sys/dev/usb/uirda.c      |  16 ++++++++--------
 sys/dev/usb/usb.c        |  10 ++++------
 sys/dev/usb/uscanner.c   |  12 ++++++------
 sys/dev/usb/ustir.c      |  16 ++++++++--------
 sys/dev/wscons/wsevent.c |  10 ++++------
 sys/net/bpf.c            |  13 +++++--------
 sys/net/if_tap.c         |   8 ++++----
 sys/net/if_tun.c         |  11 ++++-------
 11 files changed, 62 insertions(+), 75 deletions(-)

diffs (truncated from 613 to 300 lines):

diff -r 3eb6e5edfba5 -r 1939d0523289 sys/dev/usb/udsir.c
--- a/sys/dev/usb/udsir.c       Fri Dec 18 01:08:13 2020 +0000
+++ b/sys/dev/usb/udsir.c       Fri Dec 18 01:31:49 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: udsir.c,v 1.11 2020/03/14 02:35:33 christos Exp $      */
+/*     $NetBSD: udsir.c,v 1.12 2020/12/18 01:40:20 thorpej Exp $       */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: udsir.c,v 1.11 2020/03/14 02:35:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: udsir.c,v 1.12 2020/12/18 01:40:20 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -680,16 +680,16 @@
 udsir_kqfilter(void *h, struct knote *kn)
 {
        struct udsir_softc *sc = h;
-       struct klist *klist;
+       struct selinfo *sip;
        int s;
 
        switch (kn->kn_filter) {
        case EVFILT_READ:
-               klist = &sc->sc_rd_sel.sel_klist;
+               sip = &sc->sc_rd_sel;
                kn->kn_fop = &udsirread_filtops;
                break;
        case EVFILT_WRITE:
-               klist = &sc->sc_wr_sel.sel_klist;
+               sip = &sc->sc_wr_sel;
                kn->kn_fop = &udsirwrite_filtops;
                break;
        default:
@@ -699,7 +699,7 @@
        kn->kn_hook = sc;
 
        s = splusb();
-       SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+       selrecord_knote(sip, kn);
        splx(s);
 
        return 0;
@@ -772,7 +772,7 @@
        int s;
 
        s = splusb();
-       SLIST_REMOVE(&sc->sc_rd_sel.sel_klist, kn, knote, kn_selnext);
+       selremove_knote(&sc->sc_rd_sel, kn);
        splx(s);
 }
 
@@ -793,7 +793,7 @@
        int s;
 
        s = splusb();
-       SLIST_REMOVE(&sc->sc_wr_sel.sel_klist, kn, knote, kn_selnext);
+       selremove_knote(&sc->sc_wr_sel, kn);
        splx(s);
 }
 
diff -r 3eb6e5edfba5 -r 1939d0523289 sys/dev/usb/ugen.c
--- a/sys/dev/usb/ugen.c        Fri Dec 18 01:08:13 2020 +0000
+++ b/sys/dev/usb/ugen.c        Fri Dec 18 01:31:49 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ugen.c,v 1.157 2020/08/18 14:32:34 riastradh Exp $     */
+/*     $NetBSD: ugen.c,v 1.158 2020/12/18 01:40:20 thorpej Exp $       */
 
 /*
  * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
 
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.157 2020/08/18 14:32:34 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ugen.c,v 1.158 2020/12/18 01:40:20 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -2031,7 +2031,7 @@
        struct ugen_softc *sc = sce->sc;
 
        mutex_enter(&sc->sc_lock);
-       SLIST_REMOVE(&sce->rsel.sel_klist, kn, knote, kn_selnext);
+       selremove_knote(&sce->rsel, kn);
        mutex_exit(&sc->sc_lock);
 }
 
@@ -2168,7 +2168,7 @@
 {
        struct ugen_softc *sc;
        struct ugen_endpoint *sce;
-       struct klist *klist;
+       struct selinfo *sip;
        int error;
 
        if ((sc = ugenif_acquire(UGENUNIT(dev))) == NULL)
@@ -2187,7 +2187,7 @@
                        goto out;
                }
 
-               klist = &sce->rsel.sel_klist;
+               sip = &sce->rsel;
                switch (sce->edesc->bmAttributes & UE_XFERTYPE) {
                case UE_INTERRUPT:
                        kn->kn_fop = &ugenread_intr_filtops;
@@ -2211,7 +2211,7 @@
                        goto out;
                }
 
-               klist = &sce->rsel.sel_klist;
+               sip = &sce->rsel;
                switch (sce->edesc->bmAttributes & UE_XFERTYPE) {
                case UE_INTERRUPT:
                case UE_ISOCHRONOUS:
@@ -2236,7 +2236,7 @@
        kn->kn_hook = sce;
 
        mutex_enter(&sc->sc_lock);
-       SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+       selrecord_knote(sip, kn);
        mutex_exit(&sc->sc_lock);
 
        error = 0;
diff -r 3eb6e5edfba5 -r 1939d0523289 sys/dev/usb/uhid.c
--- a/sys/dev/usb/uhid.c        Fri Dec 18 01:08:13 2020 +0000
+++ b/sys/dev/usb/uhid.c        Fri Dec 18 01:31:49 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uhid.c,v 1.116 2020/11/30 00:48:35 riastradh Exp $     */
+/*     $NetBSD: uhid.c,v 1.117 2020/12/18 01:40:20 thorpej Exp $       */
 
 /*
  * Copyright (c) 1998, 2004, 2008, 2012 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.116 2020/11/30 00:48:35 riastradh Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhid.c,v 1.117 2020/12/18 01:40:20 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -831,7 +831,7 @@
        struct uhid_softc *sc = kn->kn_hook;
 
        mutex_enter(&sc->sc_lock);
-       SLIST_REMOVE(&sc->sc_rsel.sel_klist, kn, knote, kn_selnext);
+       selremove_knote(&sc->sc_rsel, kn);
        mutex_exit(&sc->sc_lock);
 }
 
@@ -873,7 +873,6 @@
 uhidkqfilter(dev_t dev, struct knote *kn)
 {
        struct uhid_softc *sc;
-       struct klist *klist;
        int error;
 
        error = uhid_enter(dev, &sc);
@@ -882,11 +881,9 @@
 
        switch (kn->kn_filter) {
        case EVFILT_READ:
-               klist = &sc->sc_rsel.sel_klist;
                kn->kn_fop = &uhidread_filtops;
                break;
        case EVFILT_WRITE:
-               klist = &sc->sc_rsel.sel_klist;
                kn->kn_fop = &uhid_seltrue_filtops;
                break;
        default:
@@ -897,7 +894,7 @@
        kn->kn_hook = sc;
 
        mutex_enter(&sc->sc_lock);
-       SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+       selrecord_knote(&sc->sc_rsel, kn);
        mutex_exit(&sc->sc_lock);
 
 out:   uhid_exit(sc);
diff -r 3eb6e5edfba5 -r 1939d0523289 sys/dev/usb/uirda.c
--- a/sys/dev/usb/uirda.c       Fri Dec 18 01:08:13 2020 +0000
+++ b/sys/dev/usb/uirda.c       Fri Dec 18 01:31:49 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uirda.c,v 1.47 2020/03/14 02:35:33 christos Exp $      */
+/*     $NetBSD: uirda.c,v 1.48 2020/12/18 01:40:20 thorpej Exp $       */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uirda.c,v 1.47 2020/03/14 02:35:33 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uirda.c,v 1.48 2020/12/18 01:40:20 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -616,7 +616,7 @@
        int s;
 
        s = splusb();
-       SLIST_REMOVE(&sc->sc_rd_sel.sel_klist, kn, knote, kn_selnext);
+       selremove_knote(&sc->sc_rd_sel, kn);
        splx(s);
 }
 
@@ -636,7 +636,7 @@
        int s;
 
        s = splusb();
-       SLIST_REMOVE(&sc->sc_wr_sel.sel_klist, kn, knote, kn_selnext);
+       selremove_knote(&sc->sc_wr_sel, kn);
        splx(s);
 }
 
@@ -658,16 +658,16 @@
 uirda_kqfilter(void *h, struct knote *kn)
 {
        struct uirda_softc *sc = kn->kn_hook;
-       struct klist *klist;
+       struct selinfo *sip;
        int s;
 
        switch (kn->kn_filter) {
        case EVFILT_READ:
-               klist = &sc->sc_rd_sel.sel_klist;
+               sip = &sc->sc_rd_sel;
                kn->kn_fop = &uirdaread_filtops;
                break;
        case EVFILT_WRITE:
-               klist = &sc->sc_wr_sel.sel_klist;
+               sip = &sc->sc_wr_sel;
                kn->kn_fop = &uirdawrite_filtops;
                break;
        default:
@@ -677,7 +677,7 @@
        kn->kn_hook = sc;
 
        s = splusb();
-       SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+       selrecord_knote(sip, kn);
        splx(s);
 
        return 0;
diff -r 3eb6e5edfba5 -r 1939d0523289 sys/dev/usb/usb.c
--- a/sys/dev/usb/usb.c Fri Dec 18 01:08:13 2020 +0000
+++ b/sys/dev/usb/usb.c Fri Dec 18 01:31:49 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: usb.c,v 1.187 2020/05/27 07:17:45 skrll Exp $  */
+/*     $NetBSD: usb.c,v 1.188 2020/12/18 01:40:20 thorpej Exp $        */
 
 /*
  * Copyright (c) 1998, 2002, 2008, 2012 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.187 2020/05/27 07:17:45 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.188 2020/12/18 01:40:20 thorpej Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_usb.h"
@@ -1022,7 +1022,7 @@
 {
 
        mutex_enter(&usb_event_lock);
-       SLIST_REMOVE(&usb_selevent.sel_klist, kn, knote, kn_selnext);
+       selremove_knote(&usb_selevent, kn);
        mutex_exit(&usb_event_lock);
 }
 
@@ -1047,13 +1047,11 @@
 int
 usbkqfilter(dev_t dev, struct knote *kn)
 {
-       struct klist *klist;
 
        switch (kn->kn_filter) {
        case EVFILT_READ:
                if (minor(dev) != USB_DEV_MINOR)
                        return 1;
-               klist = &usb_selevent.sel_klist;
                kn->kn_fop = &usbread_filtops;
                break;
 
@@ -1064,7 +1062,7 @@
        kn->kn_hook = NULL;
 
        mutex_enter(&usb_event_lock);
-       SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+       selrecord_knote(&usb_selevent, kn);
        mutex_exit(&usb_event_lock);
 
        return 0;
diff -r 3eb6e5edfba5 -r 1939d0523289 sys/dev/usb/uscanner.c



Home | Main Index | Thread Index | Old Index