Source-Changes-HG archive

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

[src/gehenna-devsw]: src/sys/dev/sun Replace the direct-access to devsw table...



details:   https://anonhg.NetBSD.org/src/rev/3bcb1bc9f268
branches:  gehenna-devsw
changeset: 527069:3bcb1bc9f268
user:      gehenna <gehenna%NetBSD.org@localhost>
date:      Thu May 16 11:36:21 2002 +0000

description:
Replace the direct-access to devsw table with calling devsw API.
Fix conflicts of namespace.

diffstat:

 sys/dev/sun/sunkbd.c |  17 ++++++++++-------
 sys/dev/sun/sunms.c  |  17 ++++++++++-------
 2 files changed, 20 insertions(+), 14 deletions(-)

diffs (102 lines):

diff -r ef86210efeb5 -r 3bcb1bc9f268 sys/dev/sun/sunkbd.c
--- a/sys/dev/sun/sunkbd.c      Thu May 16 11:32:40 2002 +0000
+++ b/sys/dev/sun/sunkbd.c      Thu May 16 11:36:21 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sunkbd.c,v 1.8 2001/12/11 17:27:25 pk Exp $    */
+/*     $NetBSD: sunkbd.c,v 1.8.8.1 2002/05/16 11:36:21 gehenna Exp $   */
 
 /*
  * Copyright (c) 1992, 1993
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunkbd.c,v 1.8 2001/12/11 17:27:25 pk Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunkbd.c,v 1.8.8.1 2002/05/16 11:36:21 gehenna Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -104,7 +104,7 @@
 };
 
 struct  linesw sunkbd_disc =
-       { "sunkbd", 7, ttylopen, ttylclose, ttyerrio, ttyerrio, nullioctl,
+       { "sunkbd", 7, ttylopen, ttylclose, ttyerrio, ttyerrio, ttynullioctl,
          sunkbdinput, sunkbdstart, nullmodem, ttpoll }; /* 7- SUNKBDDISC */
 
 /*
@@ -220,16 +220,19 @@
        struct tty *tp = (struct tty *)k->k_priv;
        struct proc *p = curproc;
        struct termios t;
-       int maj;
+       const struct cdevsw *cdev;
        int error;
 
-       maj = major(tp->t_dev);
        if (p == NULL)
                p = &proc0;
 
+       cdev = cdevsw_lookup(tp->t_dev);
+       if (cdev == NULL)
+               return (ENXIO);
+
        /* Open the lower device */
-       if ((error = (*cdevsw[maj].d_open)(tp->t_dev, O_NONBLOCK|flags,
-                                          0/* ignored? */, p)) != 0)
+       if ((error = (*cdev->d_open)(tp->t_dev, O_NONBLOCK|flags,
+                                    0/* ignored? */, p)) != 0)
                return (error);
 
        /* Now configure it for the console. */
diff -r ef86210efeb5 -r 3bcb1bc9f268 sys/dev/sun/sunms.c
--- a/sys/dev/sun/sunms.c       Thu May 16 11:32:40 2002 +0000
+++ b/sys/dev/sun/sunms.c       Thu May 16 11:36:21 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: sunms.c,v 1.7 2001/12/11 17:27:25 pk Exp $     */
+/*     $NetBSD: sunms.c,v 1.7.8.1 2002/05/16 11:36:21 gehenna Exp $    */
 
 /*
  * Copyright (c) 1992, 1993
@@ -56,7 +56,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunms.c,v 1.7 2001/12/11 17:27:25 pk Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunms.c,v 1.7.8.1 2002/05/16 11:36:21 gehenna Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -99,7 +99,7 @@
 };
 
 struct  linesw sunms_disc =
-       { "sunms", 8, ttylopen, ttylclose, ttyerrio, ttyerrio, nullioctl,
+       { "sunms", 8, ttylopen, ttylclose, ttyerrio, ttyerrio, ttynullioctl,
          sunmsinput, ttstart, nullmodem, ttpoll };     /* 8- SUNMOUSEDISC */
 
 /*
@@ -168,16 +168,19 @@
        struct tty *tp = (struct tty *)ms->ms_cs;
        struct proc *p = curproc;
        struct termios t;
-       int maj;
+       const struct cdevsw *cdev;
        int error;
 
-       maj = major(tp->t_dev);
        if (p == NULL)
                p = &proc0;
 
+       cdev = cdevsw_lookup(tp->t_dev);
+       if (cdev == NULL)
+               return (ENXIO);
+
        /* Open the lower device */
-       if ((error = (*cdevsw[maj].d_open)(tp->t_dev, O_NONBLOCK|flags,
-                                          0/* ignored? */, p)) != 0)
+       if ((error = (*cdev->d_open)(tp->t_dev, O_NONBLOCK|flags,
+                                    0/* ignored? */, p)) != 0)
                return (error);
 
        /* Now configure it for the console. */



Home | Main Index | Thread Index | Old Index