Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Use seltrue_filtops rather than rolling our own wit...



details:   https://anonhg.NetBSD.org/src/rev/a55795257633
branches:  trunk
changeset: 987428:a55795257633
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Sun Sep 26 14:32:02 2021 +0000

description:
Use seltrue_filtops rather than rolling our own with filt_seltrue.

diffstat:

 sys/arch/landisk/dev/button.c |  20 ++++++--------------
 sys/arch/mac68k/dev/aed.c     |  22 ++++++----------------
 sys/arch/macppc/dev/aed.c     |  22 ++++++----------------
 3 files changed, 18 insertions(+), 46 deletions(-)

diffs (173 lines):

diff -r 4c8047aed8db -r a55795257633 sys/arch/landisk/dev/button.c
--- a/sys/arch/landisk/dev/button.c     Sun Sep 26 14:28:22 2021 +0000
+++ b/sys/arch/landisk/dev/button.c     Sun Sep 26 14:32:02 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: button.c,v 1.12 2021/09/26 01:16:07 thorpej Exp $      */
+/*     $NetBSD: button.c,v 1.13 2021/09/26 14:32:02 thorpej Exp $      */
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: button.c,v 1.12 2021/09/26 01:16:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: button.c,v 1.13 2021/09/26 14:32:02 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/conf.h>
@@ -312,13 +312,6 @@
     .f_event = filt_btn_read,
 };
 
-static const struct filterops btn_write_filtops = {
-    .f_flags = FILTEROP_ISFD,
-    .f_attach = NULL,
-    .f_detach = filt_btn_rdetach,
-    .f_event = filt_seltrue,
-};
-
 int
 btnkqfilter(dev_t dev, struct knote *kn)
 {
@@ -330,20 +323,19 @@
        switch (kn->kn_filter) {
        case EVFILT_READ:
                kn->kn_fop = &btn_read_filtops;
+               mutex_enter(&btn_event_queue_lock);
+               selrecord_knote(&btn_event_queue_selinfo, kn);
+               mutex_exit(&btn_event_queue_lock);
                break;
 
        case EVFILT_WRITE:
-               kn->kn_fop = &btn_write_filtops;
+               kn->kn_fop = &seltrue_filtops;
                break;
 
        default:
                return (1);
        }
 
-       mutex_enter(&btn_event_queue_lock);
-       selrecord_knote(&btn_event_queue_selinfo, kn);
-       mutex_exit(&btn_event_queue_lock);
-
        return (0);
 }
 
diff -r 4c8047aed8db -r a55795257633 sys/arch/mac68k/dev/aed.c
--- a/sys/arch/mac68k/dev/aed.c Sun Sep 26 14:28:22 2021 +0000
+++ b/sys/arch/mac68k/dev/aed.c Sun Sep 26 14:32:02 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aed.c,v 1.36 2021/09/26 01:16:07 thorpej Exp $ */
+/*     $NetBSD: aed.c,v 1.37 2021/09/26 14:36:48 thorpej Exp $ */
 
 /*
  * Copyright (C) 1994  Bradley A. Grantham
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.36 2021/09/26 01:16:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.37 2021/09/26 14:36:48 thorpej Exp $");
 
 #include "opt_adb.h"
 
@@ -604,13 +604,6 @@
        .f_event = filt_aedread,
 };
 
-static const struct filterops aed_seltrue_filtops = {
-       .f_flags = FILTEROP_ISFD,
-       .f_attach = NULL,
-       .f_detach = filt_aedrdetach,
-       .f_event = filt_seltrue,
-};
-
 int
 aedkqfilter(dev_t dev, struct knote *kn)
 {
@@ -619,21 +612,18 @@
        switch (kn->kn_filter) {
        case EVFILT_READ:
                kn->kn_fop = &aedread_filtops;
+               s = splvm();
+               selrecord_knote(&aed_sc->sc_selinfo, kn);
+               splx(s);
                break;
 
        case EVFILT_WRITE:
-               kn->kn_fop = &aed_seltrue_filtops;
+               kn->kn_fop = &seltrue_filtops;
                break;
 
        default:
                return (1);
        }
 
-       kn->kn_hook = NULL;
-
-       s = splvm();
-       selrecord_knote(&aed_sc->sc_selinfo, kn);
-       splx(s);
-
        return (0);
 }
diff -r 4c8047aed8db -r a55795257633 sys/arch/macppc/dev/aed.c
--- a/sys/arch/macppc/dev/aed.c Sun Sep 26 14:28:22 2021 +0000
+++ b/sys/arch/macppc/dev/aed.c Sun Sep 26 14:32:02 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: aed.c,v 1.32 2021/09/26 01:16:07 thorpej Exp $ */
+/*     $NetBSD: aed.c,v 1.33 2021/09/26 14:36:48 thorpej Exp $ */
 
 /*
  * Copyright (C) 1994  Bradley A. Grantham
@@ -26,7 +26,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.32 2021/09/26 01:16:07 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: aed.c,v 1.33 2021/09/26 14:36:48 thorpej Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -609,13 +609,6 @@
        .f_event = filt_aedread
 };
 
-static const struct filterops aed_seltrue_filtops = {
-       .f_flags = FILTEROP_ISFD,
-       .f_attach = NULL,
-       .f_detach = filt_aedrdetach,
-       .f_event = filt_seltrue
-};
-
 int
 aedkqfilter(dev_t dev, struct knote *kn)
 {
@@ -624,21 +617,18 @@
        switch (kn->kn_filter) {
        case EVFILT_READ:
                kn->kn_fop = &aedread_filtops;
+               s = spladb();
+               selrecord_knote(&aed_sc->sc_selinfo, kn);
+               splx(s);
                break;
 
        case EVFILT_WRITE:
-               kn->kn_fop = &aed_seltrue_filtops;
+               kn->kn_fop = &seltrue_filtops;
                break;
 
        default:
                return (1);
        }
 
-       kn->kn_hook = NULL;
-
-       s = spladb();
-       selrecord_knote(&aed_sc->sc_selinfo, kn);
-       splx(s);
-
        return (0);
 }



Home | Main Index | Thread Index | Old Index