Source-Changes-HG archive

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

[src/gehenna-devsw]: src/sys/dev/scsipi Add the character device switch.



details:   https://anonhg.NetBSD.org/src/rev/69a12eba81ac
branches:  gehenna-devsw
changeset: 527072:69a12eba81ac
user:      gehenna <gehenna%NetBSD.org@localhost>
date:      Thu May 16 11:41:21 2002 +0000

description:
Add the character device switch.
Replace the direct-access to devsw table with calling devsw API.

diffstat:

 sys/dev/scsipi/ss.c |  18 +++++++++++++-----
 sys/dev/scsipi/uk.c |  17 +++++++++++------
 2 files changed, 24 insertions(+), 11 deletions(-)

diffs (91 lines):

diff -r 8732290b7773 -r 69a12eba81ac sys/dev/scsipi/ss.c
--- a/sys/dev/scsipi/ss.c       Thu May 16 11:40:53 2002 +0000
+++ b/sys/dev/scsipi/ss.c       Thu May 16 11:41:21 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ss.c,v 1.38 2001/11/15 09:48:18 lukem Exp $    */
+/*     $NetBSD: ss.c,v 1.38.8.1 2002/05/16 11:41:21 gehenna Exp $      */
 
 /*
  * Copyright (c) 1995 Kenneth Stailey.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ss.c,v 1.38 2001/11/15 09:48:18 lukem Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ss.c,v 1.38.8.1 2002/05/16 11:41:21 gehenna Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -79,6 +79,16 @@
 
 extern struct cfdriver ss_cd;
 
+dev_type_open(ssopen);
+dev_type_close(ssclose);
+dev_type_read(ssread);
+dev_type_ioctl(ssioctl);
+
+const struct cdevsw ss_cdevsw = {
+       ssopen, ssclose, ssread, nowrite, ssioctl,
+       nostop, notty, nopoll, nommap,
+};
+
 void    ssstrategy __P((struct buf *));
 void    ssstart __P((struct scsipi_periph *));
 void   ssminphys __P((struct buf *));
@@ -174,9 +184,7 @@
        int s, cmaj, mn;
 
        /* locate the major number */
-       for (cmaj = 0; cmaj <= nchrdev; cmaj++)
-               if (cdevsw[cmaj].d_open == ssopen)
-                       break;
+       cmaj = cdevsw_lookup_major(&ss_cdevsw);
 
        s = splbio();
 
diff -r 8732290b7773 -r 69a12eba81ac sys/dev/scsipi/uk.c
--- a/sys/dev/scsipi/uk.c       Thu May 16 11:40:53 2002 +0000
+++ b/sys/dev/scsipi/uk.c       Thu May 16 11:41:21 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: uk.c,v 1.33 2002/02/10 23:28:27 thorpej Exp $  */
+/*     $NetBSD: uk.c,v 1.33.8.1 2002/05/16 11:41:21 gehenna Exp $      */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -42,7 +42,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uk.c,v 1.33 2002/02/10 23:28:27 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uk.c,v 1.33.8.1 2002/05/16 11:41:21 gehenna Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -80,7 +80,14 @@
 
 extern struct cfdriver uk_cd;
 
-cdev_decl(uk);
+dev_type_open(ukopen);
+dev_type_close(ukclose);
+dev_type_ioctl(ukioctl);
+
+const struct cdevsw uk_cdevsw = {
+       ukopen, ukclose, noread, nowrite, ukioctl,
+       nostop, notty, nopoll, nommap,
+};
 
 int
 ukmatch(parent, match, aux)
@@ -146,9 +153,7 @@
        int cmaj, mn;
  
        /* locate the major number */
-       for (cmaj = 0; cmaj <= nchrdev; cmaj++)
-               if (cdevsw[cmaj].d_open == ukopen)
-                       break;
+       cmaj = cdevsw_lookup_major(&uk_cdevsw);
  
        /* Nuke the vnodes for any open instances */
        mn = self->dv_unit;



Home | Main Index | Thread Index | Old Index