Use sel{record,remove}_knote().

This commit is contained in:
thorpej 2020-12-18 02:54:34 +00:00
parent 821978d378
commit 69ed6f1cd6
3 changed files with 17 additions and 23 deletions

View File

@ -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 @@ filt_oboerdetach(struct knote *kn)
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 @@ filt_oboewdetach(struct knote *kn)
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 @@ static int
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 @@ oboe_kqfilter(void *h, struct knote *kn)
kn->kn_hook = sc;
s = splir();
SLIST_INSERT_HEAD(klist, kn, kn_selnext);
selrecord_knote(sip, kn);
splx(s);
return (0);

View File

@ -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 @@ filt_vio9p_detach(struct knote *kn)
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 @@ static int
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;

View File

@ -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 @@ filt_putterdetach(struct knote *kn)
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 @@ static int
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;