Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/734dfcc74d9c
branches:  gehenna-devsw
changeset: 527078:734dfcc74d9c
user:      gehenna <gehenna%NetBSD.org@localhost>
date:      Thu May 16 11:50:41 2002 +0000

description:
Add the block/character device switch.
Replace the hard-coded major with calling devsw API.

diffstat:

 sys/dev/qbus/rl.c |  28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)

diffs (64 lines):

diff -r e751f3959c36 -r 734dfcc74d9c sys/dev/qbus/rl.c
--- a/sys/dev/qbus/rl.c Thu May 16 11:49:10 2002 +0000
+++ b/sys/dev/qbus/rl.c Thu May 16 11:50:41 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rl.c,v 1.11 2002/03/23 18:12:09 ragge Exp $    */
+/*     $NetBSD: rl.c,v 1.11.2.1 2002/05/16 11:50:41 gehenna Exp $      */
 
 /*
  * Copyright (c) 2000 Ludd, University of Lule}, Sweden. All rights reserved.
@@ -43,7 +43,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: rl.c,v 1.11 2002/03/23 18:12:09 ragge Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rl.c,v 1.11.2.1 2002/05/16 11:50:41 gehenna Exp $");
 
 #include <sys/param.h>
 #include <sys/device.h>
@@ -77,8 +77,6 @@
 static void rlcstart(struct rlc_softc *, struct buf *);
 static void waitcrdy(struct rlc_softc *);
 static void rlcreset(struct device *);
-cdev_decl(rl);
-bdev_decl(rl);
 
 struct cfattach rlc_ca = {
        sizeof(struct rlc_softc), rlcmatch, rlcattach
@@ -88,8 +86,25 @@
        sizeof(struct rl_softc), rlmatch, rlattach
 };
 
+dev_type_open(rlopen);
+dev_type_close(rlclose);
+dev_type_read(rlread);
+dev_type_write(rlwrite);
+dev_type_ioctl(rlioctl);
+dev_type_strategy(rlstrategy);
+dev_type_dump(rldump);
+dev_type_size(rlsize);
+
+const struct bdevsw rl_bdevsw = {
+       rlopen, rlclose, rlstrategy, rlioctl, rldump, rlsize, D_DISK
+};
+
+const struct cdevsw rl_cdevsw = {
+       rlopen, rlclose, rlread, rlwrite, rlioctl,
+       nostop, notty, nopoll, nommap, D_DISK
+};
+
 #define        MAXRLXFER (RL_BPS * RL_SPT)
-#define        RLMAJOR 14
 
 #define        RL_WREG(reg, val) \
        bus_space_write_2(sc->sc_iot, sc->sc_ioh, (reg), (val))
@@ -297,7 +312,8 @@
                rc->rc_state = DK_OPEN;
                /* Get disk label */
                printf("%s: ", rc->rc_dev.dv_xname);
-               if ((msg = readdisklabel(MAKEDISKDEV(RLMAJOR,
+               maj = cdevsw_lookup_major(&rl_cdevsw);
+               if ((msg = readdisklabel(MAKEDISKDEV(maj,
                    rc->rc_dev.dv_unit, RAW_PART), rlstrategy, dl, NULL)))
                        printf("%s: ", msg);
                printf("size %d sectors\n", dl->d_secperunit);



Home | Main Index | Thread Index | Old Index