Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/12d2a3eaef7f
branches:  trunk
changeset: 957935:12d2a3eaef7f
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Fri Dec 18 02:54:34 2020 +0000

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

diffstat:

 sys/dev/pci/oboe.c      |  16 ++++++++--------
 sys/dev/pci/vio9p.c     |  14 +++++---------
 sys/dev/putter/putter.c |  10 ++++------
 3 files changed, 17 insertions(+), 23 deletions(-)

diffs (171 lines):

diff -r 1c52ccb24ae4 -r 12d2a3eaef7f sys/dev/pci/oboe.c
--- a/sys/dev/pci/oboe.c        Fri Dec 18 02:41:35 2020 +0000
+++ b/sys/dev/pci/oboe.c        Fri Dec 18 02:54:34 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: oboe.c,v 1.46 2018/12/09 11:14:02 jdolecek Exp $       */
+/*     $NetBSD: oboe.c,v 1.47 2020/12/18 02:55:32 thorpej Exp $        */
 
 /*     XXXXFVDL THIS DRIVER IS BROKEN FOR NON-i386 -- vtophys() usage  */
 
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: oboe.c,v 1.46 2018/12/09 11:14:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: oboe.c,v 1.47 2020/12/18 02:55:32 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -470,7 +470,7 @@
        int s;
 
        s = splir();
-       SLIST_REMOVE(&sc->sc_rsel.sel_klist, kn, knote, kn_selnext);
+       selremove_knote(&sc->sc_rsel, kn);
        splx(s);
 }
 
@@ -490,7 +490,7 @@
        int s;
 
        s = splir();
-       SLIST_REMOVE(&sc->sc_wsel.sel_klist, kn, knote, kn_selnext);
+       selremove_knote(&sc->sc_wsel, kn);
        splx(s);
 }
 
@@ -512,16 +512,16 @@
 oboe_kqfilter(void *h, struct knote *kn)
 {
        struct oboe_softc *sc = h;
-       struct klist *klist;
+       struct selinfo *sip;
        int s;
 
        switch (kn->kn_filter) {
        case EVFILT_READ:
-               klist = &sc->sc_rsel.sel_klist;
+               sip = &sc->sc_rsel;
                kn->kn_fop = &oboeread_filtops;
                break;
        case EVFILT_WRITE:
-               klist = &sc->sc_wsel.sel_klist;
+               sip = &sc->sc_wsel;
                kn->kn_fop = &oboewrite_filtops;
                break;
        default:
@@ -531,7 +531,7 @@
        kn->kn_hook = sc;
 
        s = splir();
-       SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+       selrecord_knote(sip, kn);
        splx(s);
 
        return (0);
diff -r 1c52ccb24ae4 -r 12d2a3eaef7f sys/dev/pci/vio9p.c
--- a/sys/dev/pci/vio9p.c       Fri Dec 18 02:41:35 2020 +0000
+++ b/sys/dev/pci/vio9p.c       Fri Dec 18 02:54:34 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: vio9p.c,v 1.1 2019/10/28 02:56:40 ozaki-r Exp $        */
+/*     $NetBSD: vio9p.c,v 1.2 2020/12/18 02:55:32 thorpej Exp $        */
 
 /*
  * Copyright (c) 2019 Internet Initiative Japan, Inc.
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vio9p.c,v 1.1 2019/10/28 02:56:40 ozaki-r Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vio9p.c,v 1.2 2020/12/18 02:55:32 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -390,7 +390,7 @@
        struct vio9p_softc *sc = kn->kn_hook;
 
        mutex_enter(&sc->sc_lock);
-       SLIST_REMOVE(&sc->sc_sel.sel_klist, kn, knote, kn_selnext);
+       selremove_knote(&sc->sc_sel, kn);
        mutex_exit(&sc->sc_lock);
 }
 
@@ -434,29 +434,25 @@
 vio9p_kqfilter(struct file *fp, struct knote *kn)
 {
        struct vio9p_softc *sc = fp->f_data;
-       struct klist *klist;
 
-       mutex_enter(&sc->sc_lock);
        switch (kn->kn_filter) {
        case EVFILT_READ:
-               klist = &sc->sc_sel.sel_klist;
                kn->kn_fop = &vio9p_read_filtops;
                break;
 
        case EVFILT_WRITE:
-               klist = &sc->sc_sel.sel_klist;
                kn->kn_fop = &vio9p_write_filtops;
                break;
 
        default:
-               mutex_exit(&sc->sc_lock);
                log(LOG_ERR, "%s: kn_filter=%u\n", __func__, kn->kn_filter);
                return EINVAL;
        }
 
        kn->kn_hook = sc;
 
-       SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+       mutex_enter(&sc->sc_lock);
+       selrecord_knote(&sc->sc_sel, kn);
        mutex_exit(&sc->sc_lock);
 
        return 0;
diff -r 1c52ccb24ae4 -r 12d2a3eaef7f sys/dev/putter/putter.c
--- a/sys/dev/putter/putter.c   Fri Dec 18 02:41:35 2020 +0000
+++ b/sys/dev/putter/putter.c   Fri Dec 18 02:54:34 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: putter.c,v 1.37 2017/11/30 20:25:55 christos Exp $     */
+/*     $NetBSD: putter.c,v 1.38 2020/12/18 02:54:34 thorpej Exp $      */
 
 /*
  * Copyright (c) 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: putter.c,v 1.37 2017/11/30 20:25:55 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: putter.c,v 1.38 2020/12/18 02:54:34 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -463,7 +463,7 @@
 
        KERNEL_LOCK(1, NULL);
        mutex_enter(&pi_mtx);
-       SLIST_REMOVE(&pi->pi_sel.sel_klist, kn, knote, kn_selnext);
+       selremove_knote(&pi->pi_sel, kn);
        mutex_exit(&pi_mtx);
        KERNEL_UNLOCK_ONE(NULL);
 }
@@ -502,18 +502,16 @@
 putter_fop_kqfilter(file_t *fp, struct knote *kn)
 {
        struct putter_instance *pi = fp->f_data;
-       struct klist *klist;
 
        KERNEL_LOCK(1, NULL);
 
        switch (kn->kn_filter) {
        case EVFILT_READ:
-               klist = &pi->pi_sel.sel_klist;
                kn->kn_fop = &putter_filtops;
                kn->kn_hook = pi;
 
                mutex_enter(&pi_mtx);
-               SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+               selrecord_knote(&pi->pi_sel, kn);
                mutex_exit(&pi_mtx);
 
                break;



Home | Main Index | Thread Index | Old Index