Instead of redefining a custom `filterop' with the same `f_event'
handler pointing to filt_seltrue() simply use seltrue_kqfilter().

Ok?

Index: dev/usb/ugen.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/ugen.c,v
retrieving revision 1.105
diff -u -p -r1.105 ugen.c
--- dev/usb/ugen.c      7 Apr 2020 13:27:51 -0000       1.105
+++ dev/usb/ugen.c      11 May 2020 09:17:34 -0000
@@ -1342,13 +1342,6 @@ const struct filterops ugenread_isoc_fil
        .f_event        = filt_ugenread_isoc,
 };
 
-const struct filterops ugen_seltrue_filtops = {
-       .f_flags        = FILTEROP_ISFD,
-       .f_attach       = NULL,
-       .f_detach       = filt_ugenrdetach,
-       .f_event        = filt_seltrue,
-};
-
 int
 ugenkqfilter(dev_t dev, struct knote *kn)
 {
@@ -1378,13 +1371,11 @@ ugenkqfilter(dev_t dev, struct knote *kn
                        kn->kn_fop = &ugenread_isoc_filtops;
                        break;
                case UE_BULK:
-                       /* 
+                       /*
                         * We have no easy way of determining if a read will
                         * yield any data or a write will happen.
-                        * So, emulate "seltrue".
                         */
-                       kn->kn_fop = &ugen_seltrue_filtops;
-                       break;
+                       return (seltrue_kqfilter(dev, kn));
                default:
                        return (EINVAL);
                }
@@ -1402,10 +1393,8 @@ ugenkqfilter(dev_t dev, struct knote *kn
                        /*
                         * We have no easy way of determining if a read will
                         * yield any data or a write will happen.
-                        * So, emulate "seltrue".
                         */
-                       kn->kn_fop = &ugen_seltrue_filtops;
-                       break;
+                       return (seltrue_kqfilter(dev, kn));
                default:
                        return (EINVAL);
                }
Index: dev/usb/uhid.c
===================================================================
RCS file: /cvs/src/sys/dev/usb/uhid.c,v
retrieving revision 1.79
diff -u -p -r1.79 uhid.c
--- dev/usb/uhid.c      7 Apr 2020 13:27:51 -0000       1.79
+++ dev/usb/uhid.c      11 May 2020 09:17:34 -0000
@@ -467,13 +467,6 @@ const struct filterops uhidread_filtops 
        .f_event        = filt_uhidread,
 };
 
-const struct filterops uhid_seltrue_filtops = {
-       .f_flags        = FILTEROP_ISFD,
-       .f_attach       = NULL,
-       .f_detach       = filt_uhidrdetach,
-       .f_event        = filt_seltrue,
-};
-
 int
 uhidkqfilter(dev_t dev, struct knote *kn)
 {
@@ -494,9 +487,7 @@ uhidkqfilter(dev_t dev, struct knote *kn
                break;
 
        case EVFILT_WRITE:
-               klist = &sc->sc_rsel.si_note;
-               kn->kn_fop = &uhid_seltrue_filtops;
-               break;
+               return (seltrue_kqfilter(dev, kn));
 
        default:
                return (EINVAL);
Index: miscfs/fuse/fuse_device.c
===================================================================
RCS file: /cvs/src/sys/miscfs/fuse/fuse_device.c,v
retrieving revision 1.33
diff -u -p -r1.33 fuse_device.c
--- miscfs/fuse/fuse_device.c   7 Apr 2020 13:27:51 -0000       1.33
+++ miscfs/fuse/fuse_device.c   11 May 2020 09:17:34 -0000
@@ -76,13 +76,6 @@ const static struct filterops fuse_rd_fi
        .f_event        = filt_fuse_read,
 };
 
-const static struct filterops fuse_seltrue_filtops = {
-       .f_flags        = FILTEROP_ISFD,
-       .f_attach       = NULL,
-       .f_detach       = filt_fuse_rdetach,
-       .f_event        = filt_seltrue,
-};
-
 #ifdef FUSE_DEBUG
 static void
 fuse_dump_buff(char *buff, int len)
@@ -555,9 +548,7 @@ fusekqfilter(dev_t dev, struct knote *kn
                kn->kn_fop = &fuse_rd_filtops;
                break;
        case EVFILT_WRITE:
-               klist = &fd->fd_rsel.si_note;
-               kn->kn_fop = &fuse_seltrue_filtops;
-               break;
+               return (seltrue_kqfilter(dev, kn));
        default:
                return (EINVAL);
        }

Reply via email to