diff options
author | Visa Hankala <visa@cvs.openbsd.org> | 2020-12-25 12:59:54 +0000 |
---|---|---|
committer | Visa Hankala <visa@cvs.openbsd.org> | 2020-12-25 12:59:54 +0000 |
commit | 0ddae2e43bde351e699797b713fdfd0c4d71688b (patch) | |
tree | 5c305222f703a8c48618339303894fe5bf0e271e /sys/miscfs | |
parent | d5d6ba970dd241df83e52a3f686a5b3c47e2b215 (diff) |
Refactor klist insertion and removal
Rename klist_{insert,remove}() to klist_{insert,remove}_locked().
These functions assume that the caller has locked the klist. The current
state of locking remains intact because the kernel lock is still used
with all klists.
Add new functions klist_insert() and klist_remove() that lock the klist
internally. This allows some code simplification.
OK mpi@
Diffstat (limited to 'sys/miscfs')
-rw-r--r-- | sys/miscfs/fifofs/fifo_vnops.c | 8 | ||||
-rw-r--r-- | sys/miscfs/fuse/fuse_device.c | 6 | ||||
-rw-r--r-- | sys/miscfs/fuse/fuse_vnops.c | 6 |
3 files changed, 10 insertions, 10 deletions
diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c index 9a97752c3f5..e8150dd0d45 100644 --- a/sys/miscfs/fifofs/fifo_vnops.c +++ b/sys/miscfs/fifofs/fifo_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fifo_vnops.c,v 1.77 2020/06/15 15:29:40 mpi Exp $ */ +/* $OpenBSD: fifo_vnops.c,v 1.78 2020/12/25 12:59:52 visa Exp $ */ /* $NetBSD: fifo_vnops.c,v 1.18 1996/03/16 23:52:42 christos Exp $ */ /* @@ -532,7 +532,7 @@ fifo_kqfilter(void *v) ap->a_kn->kn_hook = so; - klist_insert(&sb->sb_sel.si_note, ap->a_kn); + klist_insert_locked(&sb->sb_sel.si_note, ap->a_kn); sb->sb_flagsintr |= SB_KNOTE; return (0); @@ -543,7 +543,7 @@ filt_fifordetach(struct knote *kn) { struct socket *so = (struct socket *)kn->kn_hook; - klist_remove(&so->so_rcv.sb_sel.si_note, kn); + klist_remove_locked(&so->so_rcv.sb_sel.si_note, kn); if (klist_empty(&so->so_rcv.sb_sel.si_note)) so->so_rcv.sb_flagsintr &= ~SB_KNOTE; } @@ -579,7 +579,7 @@ filt_fifowdetach(struct knote *kn) { struct socket *so = (struct socket *)kn->kn_hook; - klist_remove(&so->so_snd.sb_sel.si_note, kn); + klist_remove_locked(&so->so_snd.sb_sel.si_note, kn); if (klist_empty(&so->so_snd.sb_sel.si_note)) so->so_snd.sb_flagsintr &= ~SB_KNOTE; } diff --git a/sys/miscfs/fuse/fuse_device.c b/sys/miscfs/fuse/fuse_device.c index 33d16a15a9b..d06f8ec0f46 100644 --- a/sys/miscfs/fuse/fuse_device.c +++ b/sys/miscfs/fuse/fuse_device.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_device.c,v 1.34 2020/05/13 08:13:42 mpi Exp $ */ +/* $OpenBSD: fuse_device.c,v 1.35 2020/12/25 12:59:52 visa Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -555,7 +555,7 @@ fusekqfilter(dev_t dev, struct knote *kn) kn->kn_hook = fd; - klist_insert(klist, kn); + klist_insert_locked(klist, kn); return (0); } @@ -566,7 +566,7 @@ filt_fuse_rdetach(struct knote *kn) struct fuse_d *fd = kn->kn_hook; struct klist *klist = &fd->fd_rsel.si_note; - klist_remove(klist, kn); + klist_remove_locked(klist, kn); } int diff --git a/sys/miscfs/fuse/fuse_vnops.c b/sys/miscfs/fuse/fuse_vnops.c index 175c0f0524e..27fd296abf0 100644 --- a/sys/miscfs/fuse/fuse_vnops.c +++ b/sys/miscfs/fuse/fuse_vnops.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fuse_vnops.c,v 1.61 2020/06/11 09:18:43 mpi Exp $ */ +/* $OpenBSD: fuse_vnops.c,v 1.62 2020/12/25 12:59:52 visa Exp $ */ /* * Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com> * @@ -154,7 +154,7 @@ fusefs_kqfilter(void *v) kn->kn_hook = (caddr_t)vp; - klist_insert(&vp->v_selectinfo.si_note, kn); + klist_insert_locked(&vp->v_selectinfo.si_note, kn); return (0); } @@ -164,7 +164,7 @@ filt_fusefsdetach(struct knote *kn) { struct vnode *vp = (struct vnode *)kn->kn_hook; - klist_remove(&vp->v_selectinfo.si_note, kn); + klist_remove_locked(&vp->v_selectinfo.si_note, kn); } int |