Replace selinfo remnants with knote(9) API. Mechanical conversion
because `fuse_rd_filtops' left non MP safe. knote_locked(9) used because
the path covered by kernel lock.

We have some places where selinfo is still used. All of them could be
mechanically converted in this way and obsolete selwakeup() API could
go away. I don't want mix this code cleanup with making filterops MP
safe.

ok?

Index: sys/miscfs/fuse/fuse_device.c
===================================================================
RCS file: /cvs/src/sys/miscfs/fuse/fuse_device.c,v
retrieving revision 1.39
diff -u -p -r1.39 fuse_device.c
--- sys/miscfs/fuse/fuse_device.c       8 Sep 2023 20:00:28 -0000       1.39
+++ sys/miscfs/fuse/fuse_device.c       10 Sep 2023 12:58:28 -0000
@@ -17,6 +17,7 @@
 
 #include <sys/param.h>
 #include <sys/systm.h>
+#include <sys/event.h>
 #include <sys/fcntl.h>
 #include <sys/ioctl.h>
 #include <sys/malloc.h>
@@ -25,7 +26,6 @@
 #include <sys/statvfs.h>
 #include <sys/vnode.h>
 #include <sys/fusebuf.h>
-#include <sys/selinfo.h>
 
 #include "fusefs_node.h"
 #include "fusefs.h"
@@ -47,7 +47,7 @@ struct fuse_d {
        struct fusebuf_head fd_fbufs_wait;
 
        /* kq fields */
-       struct selinfo fd_rsel;
+       struct klist fd_rklist;
        LIST_ENTRY(fuse_d) fd_list;
 };
 
@@ -184,7 +184,7 @@ fuse_device_queue_fbuf(dev_t dev, struct
 
        SIMPLEQ_INSERT_TAIL(&fd->fd_fbufs_in, fbuf, fb_next);
        stat_fbufs_in++;
-       selwakeup(&fd->fd_rsel);
+       knote_locked(&fd->fd_rklist, 0);
 }
 
 void
@@ -519,7 +519,7 @@ fusekqfilter(dev_t dev, struct knote *kn
 
        switch (kn->kn_filter) {
        case EVFILT_READ:
-               klist = &fd->fd_rsel.si_note;
+               klist = &fd->fd_rklist;
                kn->kn_fop = &fuse_rd_filtops;
                break;
        case EVFILT_WRITE:
@@ -539,9 +539,8 @@ void
 filt_fuse_rdetach(struct knote *kn)
 {
        struct fuse_d *fd = kn->kn_hook;
-       struct klist *klist = &fd->fd_rsel.si_note;
 
-       klist_remove_locked(klist, kn);
+       klist_remove_locked(&fd->fd_rklist, kn);
 }
 
 int

Reply via email to