Source-Changes-HG archive

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

[src/kqueue]: src/sys/arch/arm/iomd provide kqfilter hooks



details:   https://anonhg.NetBSD.org/src/rev/9f81be5ac9f6
branches:  kqueue
changeset: 512469:9f81be5ac9f6
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Mon Jun 17 19:49:40 2002 +0000

description:
provide kqfilter hooks
XXX not tested

diffstat:

 sys/arch/arm/iomd/console/console.c |  22 +++++++++++++--
 sys/arch/arm/iomd/pms.c             |  54 +++++++++++++++++++++++++++++++++++-
 sys/arch/arm/iomd/qms.c             |  52 ++++++++++++++++++++++++++++++++++-
 3 files changed, 122 insertions(+), 6 deletions(-)

diffs (181 lines):

diff -r 930ede9b5d48 -r 9f81be5ac9f6 sys/arch/arm/iomd/console/console.c
--- a/sys/arch/arm/iomd/console/console.c       Mon Jun 17 18:56:06 2002 +0000
+++ b/sys/arch/arm/iomd/console/console.c       Mon Jun 17 19:49:40 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: console.c,v 1.2.2.2 2002/01/10 19:38:25 thorpej Exp $  */
+/*     $NetBSD: console.c,v 1.2.2.3 2002/06/17 19:49:41 jdolecek Exp $ */
 
 /*
  * Copyright (c) 1994-1995 Melvyn Tang-Richardson
@@ -103,9 +103,9 @@
  */
 
 int    physcon_switch  __P((u_int /*number*/));
-void   physconstart    __P((struct tty */*tp*/));
+void   physconstart    __P((struct tty *));
 static struct vconsole *vconsole_spawn __P((dev_t , struct vconsole *));
-int    physconparam    __P((struct tty */*tp*/, struct termios */*t*/));
+int    physconparam    __P((struct tty *, struct termios *));
 int    physcon_switchup __P((void));
 int    physcon_switchdown      __P((void));
 
@@ -531,6 +531,22 @@
        return ((*tp->t_linesw->l_poll)(tp, events, p));
 }
 
+/* XXXLUKEM (jdolecek) kqueue hooks not tested */
+int
+physconkqfilter(dev, kn)
+       dev_t dev;
+       struct knote *kn;
+{
+       register struct tty *tp;
+
+       tp = find_tp(dev);
+       
+       if (tp == NULL)
+               return (0);
+
+       return (ttykqfilter(dev, kn));
+}
+
 struct tty *
 physcontty(dev)
        dev_t dev;
diff -r 930ede9b5d48 -r 9f81be5ac9f6 sys/arch/arm/iomd/pms.c
--- a/sys/arch/arm/iomd/pms.c   Mon Jun 17 18:56:06 2002 +0000
+++ b/sys/arch/arm/iomd/pms.c   Mon Jun 17 19:49:40 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: pms.c,v 1.1.6.3 2002/03/16 15:56:12 jdolecek Exp $     */
+/*     $NetBSD: pms.c,v 1.1.6.4 2002/06/17 19:49:40 jdolecek Exp $     */
 
 /*-
  * Copyright (c) 1996 D.C. Tsen
@@ -41,7 +41,7 @@
 
 #include <sys/param.h>
 
-__RCSID("$NetBSD: pms.c,v 1.1.6.3 2002/03/16 15:56:12 jdolecek Exp $");
+__RCSID("$NetBSD: pms.c,v 1.1.6.4 2002/06/17 19:49:40 jdolecek Exp $");
 
 #include <sys/kernel.h>
 #include <sys/systm.h>
@@ -695,4 +695,54 @@
 }
 #endif
 
+/* XXXLUKEM (jdolecek) kqueue hooks not tested */
+static void
+filt_pmsrdetach(struct knote *kn)
+{
+       struct pms_softc *sc = (void *) kn->kn_hook;
+       int s;
+
+       s = spltty();
+       SLIST_REMOVE(&sc->sc_rsel.si_klist, kn, knote, kn_selnext);
+       splx(s);
+}
+
+static int
+filt_pmsread(struct knote *kn, long hint)
+{
+       struct pms_softc *sc = (void *) kn->kn_hook;
+
+       kn->kn_data = sc->sc_q.c_cc;
+       return (kn->kn_data > 0);
+}
+
+static const struct filterops pmsread_filtops =
+       { 1, NULL, filt_pmsrdetach, filt_pmsread };
+
+int
+pmskqfilter(dev_t dev, struct knote *kn)
+{
+       struct pms_softc *sc = opms_cd.cd_devs[PMSUNIT(dev)];
+       struct klist *klist;
+       int s;
+
+       switch (kn->kn_filter) {
+       case EVFILT_READ:
+               klist = &sc->sc_rsel.si_klist;
+               kn->kn_fop = &pmsread_filtops;
+               break;
+
+       default:
+               return (1);
+       }
+
+       kn->kn_hook = (void *) sc;
+
+       s = spltty();
+       SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+       splx(s);
+
+       return (0);
+}
+
 /* End of pms.c */
diff -r 930ede9b5d48 -r 9f81be5ac9f6 sys/arch/arm/iomd/qms.c
--- a/sys/arch/arm/iomd/qms.c   Mon Jun 17 18:56:06 2002 +0000
+++ b/sys/arch/arm/iomd/qms.c   Mon Jun 17 19:49:40 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: qms.c,v 1.1.6.2 2002/01/10 19:38:14 thorpej Exp $      */
+/*     $NetBSD: qms.c,v 1.1.6.3 2002/06/17 19:49:40 jdolecek Exp $     */
 
 /*
  * Copyright (c) Scott Stevens 1995 All rights reserved
@@ -467,4 +467,54 @@
 }
 #endif
 
+/* XXXLUKEM (jdolecek) kqueue hooks not tested */
+static void
+filt_qmsrdetach(struct knote *kn)
+{
+       struct qms_softc *sc = (void *) kn->kn_hook;
+       int s;
+
+       s = spltty();
+       SLIST_REMOVE(&sc->sc_rsel.si_klist, kn, knote, kn_selnext);
+       splx(s);
+}
+
+static int
+filt_qmsread(struct knote *kn, long hint)
+{
+       struct qms_softc *sc = (void *) kn->kn_hook;
+
+       kn->kn_data = sc->sc_buffer.c_cc;
+       return (kn->kn_data > 0);
+}
+
+static const struct filterops qmsread_filtops =
+       { 1, NULL, filt_qmsrdetach, filt_qmsread };
+
+int
+qmskqfilter(dev_t dev, struct knote *kn)
+{
+       struct qms_softc *sc = qms_cd.cd_devs[minor(dev)];
+       struct klist *klist;
+       int s;
+
+       switch (kn->kn_filter) {
+       case EVFILT_READ:
+               klist = &sc->sc_rsel.si_klist;
+               kn->kn_fop = &qmsread_filtops;
+               break;
+
+       default:
+               return (1);
+       }
+
+       kn->kn_hook = (void *) sc;
+
+       s = spltty();
+       SLIST_INSERT_HEAD(klist, kn, kn_selnext);
+       splx(s);
+
+       return (0);
+}
+
 /* End of qms.c */



Home | Main Index | Thread Index | Old Index