Source-Changes-HG archive

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

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



details:   https://anonhg.NetBSD.org/src/rev/a0e433d80471
branches:  gehenna-devsw
changeset: 527092:a0e433d80471
user:      gehenna <gehenna%NetBSD.org@localhost>
date:      Thu May 16 12:08:18 2002 +0000

description:
Add the block/character device switches.

diffstat:

 sys/dev/isa/fd.c     |  45 ++++++++++++++++++---------------------------
 sys/dev/isa/mcd.c    |  28 ++++++++++++++++++++--------
 sys/dev/isa/wt.c     |  24 +++++++++++++++++++-----
 sys/dev/mca/ed_mca.c |  27 +++++++++++++++++++++------
 4 files changed, 78 insertions(+), 46 deletions(-)

diffs (241 lines):

diff -r 4a0fc0124773 -r a0e433d80471 sys/dev/isa/fd.c
--- a/sys/dev/isa/fd.c  Thu May 16 12:07:28 2002 +0000
+++ b/sys/dev/isa/fd.c  Thu May 16 12:08:18 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: fd.c,v 1.22 2002/03/10 08:55:40 jdolecek Exp $ */
+/*     $NetBSD: fd.c,v 1.22.4.1 2002/05/16 12:10:04 gehenna Exp $      */
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -92,7 +92,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.22 2002/03/10 08:55:40 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fd.c,v 1.22.4.1 2002/05/16 12:10:04 gehenna Exp $");
 
 #include "rnd.h"
 #include "opt_ddb.h"
@@ -167,9 +167,6 @@
 
 #endif /* i386 */
 
-bdev_decl(fd);
-cdev_decl(fd);
-
 #define FDUNIT(dev)    (minor(dev) / 8)
 #define FDTYPE(dev)    (minor(dev) % 8)
 
@@ -276,9 +273,24 @@
        sizeof(struct fd_softc), fdprobe, fdattach,
 };
 
+dev_type_open(fdopen);
+dev_type_close(fdclose);
+dev_type_read(fdread);
+dev_type_write(fdwrite);
+dev_type_ioctl(fdioctl);
+dev_type_strategy(fdstrategy);
+
+const struct bdevsw fd_bdevsw = {
+       fdopen, fdclose, fdstrategy, fdioctl, nodump, nosize, D_DISK
+};
+
+const struct cdevsw fd_cdevsw = {
+       fdopen, fdclose, fdread, fdwrite, fdioctl,
+       nostop, notty, nopoll, nommap, D_DISK
+};
+
 void fdgetdisklabel __P((struct fd_softc *));
 int fd_get_parms __P((struct fd_softc *));
-void fdstrategy __P((struct buf *));
 void fdstart __P((struct fd_softc *));
 
 struct dkdriver fddkdriver = { fdstrategy };
@@ -1299,27 +1311,6 @@
 }
 
 int
-fdsize(dev)
-       dev_t dev;
-{
-
-       /* Swapping to floppies would not make sense. */
-       return -1;
-}
-
-int
-fddump(dev, blkno, va, size)
-       dev_t dev;
-       daddr_t blkno;
-       caddr_t va;
-       size_t size;
-{
-
-       /* Not implemented. */
-       return ENXIO;
-}
-
-int
 fdioctl(dev, cmd, addr, flag, p)
        dev_t dev;
        u_long cmd;
diff -r 4a0fc0124773 -r a0e433d80471 sys/dev/isa/mcd.c
--- a/sys/dev/isa/mcd.c Thu May 16 12:07:28 2002 +0000
+++ b/sys/dev/isa/mcd.c Thu May 16 12:08:18 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: mcd.c,v 1.74 2002/01/07 21:47:11 thorpej Exp $ */
+/*     $NetBSD: mcd.c,v 1.74.8.1 2002/05/16 12:10:04 gehenna Exp $     */
 
 /*
  * Copyright (c) 1993, 1994, 1995 Charles M. Hannum.  All rights reserved.
@@ -56,7 +56,7 @@
 /*static char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";*/
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.74 2002/01/07 21:47:11 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mcd.c,v 1.74.8.1 2002/05/16 12:10:04 gehenna Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -156,11 +156,6 @@
        u_char  probe;
 };
 
-/* prototypes */
-/* XXX does not belong here */
-cdev_decl(mcd);
-bdev_decl(mcd);
-
 static int bcd2bin __P((bcd_t));
 static bcd_t bin2bcd __P((int));
 static void hsg2msf __P((int, bcd_t *));
@@ -202,10 +197,27 @@
 
 extern struct cfdriver mcd_cd;
 
+dev_type_open(mcdopen);
+dev_type_close(mcdclose);
+dev_type_read(mcdread);
+dev_type_write(mcdwrite);
+dev_type_ioctl(mcdioctl);
+dev_type_strategy(mcdstrategy);
+dev_type_dump(mcddump);
+dev_type_size(mcdsize);
+
+const struct bdevsw mcd_bdevsw = {
+       mcdopen, mcdclose, mcdstrategy, mcdioctl, mcddump, mcdsize, D_DISK
+};
+
+const struct cdevsw mcd_cdevsw = {
+       mcdopen, mcdclose, mcdread, mcdwrite, mcdioctl,
+       nostop, notty, nopoll, nommap, D_DISK
+};
+
 void   mcdgetdefaultlabel __P((struct mcd_softc *, struct disklabel *));
 void   mcdgetdisklabel __P((struct mcd_softc *));
 int    mcd_get_parms __P((struct mcd_softc *));
-void   mcdstrategy __P((struct buf *));
 void   mcdstart __P((struct mcd_softc *));
 int    mcdlock __P((struct mcd_softc *));
 void   mcdunlock __P((struct mcd_softc *));
diff -r 4a0fc0124773 -r a0e433d80471 sys/dev/isa/wt.c
--- a/sys/dev/isa/wt.c  Thu May 16 12:07:28 2002 +0000
+++ b/sys/dev/isa/wt.c  Thu May 16 12:08:18 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wt.c,v 1.54 2002/01/07 21:47:14 thorpej Exp $  */
+/*     $NetBSD: wt.c,v 1.54.8.1 2002/05/16 12:10:04 gehenna Exp $      */
 
 /*
  * Streamer tape driver.
@@ -51,7 +51,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wt.c,v 1.54 2002/01/07 21:47:14 thorpej Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wt.c,v 1.54.8.1 2002/05/16 12:10:04 gehenna Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -147,9 +147,23 @@
        struct wtregs regs;
 };
 
-/* XXX: These don't belong here really */
-cdev_decl(wt);
-bdev_decl(wt);
+dev_type_open(wtopen);
+dev_type_close(wtclose);
+dev_type_read(wtread);
+dev_type_write(wtwrite);
+dev_type_ioctl(wtioctl);
+dev_type_strategy(wtstrategy);
+dev_type_dump(wtdump);
+dev_type_size(wtsize);
+
+const struct bdevsw wt_bdevsw = {
+       wtopen, wtclose, wtstrategy, wtioctl, wtdump, wtsize, D_TAPE
+};
+
+const struct cdevsw wt_cdevsw = {
+       wtopen, wtclose, wtread, wtwrite, wtioctl,
+       nostop, notty, nopoll, nommap, D_TAPE
+};
 
 int wtwait __P((struct wt_softc *sc, int catch, char *msg));
 int wtcmd __P((struct wt_softc *sc, int cmd));
diff -r 4a0fc0124773 -r a0e433d80471 sys/dev/mca/ed_mca.c
--- a/sys/dev/mca/ed_mca.c      Thu May 16 12:07:28 2002 +0000
+++ b/sys/dev/mca/ed_mca.c      Thu May 16 12:08:18 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ed_mca.c,v 1.11 2002/03/29 20:10:46 jdolecek Exp $     */
+/*     $NetBSD: ed_mca.c,v 1.11.2.1 2002/05/16 12:08:18 gehenna Exp $  */
 
 /*
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -38,7 +38,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.11 2002/03/29 20:10:46 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ed_mca.c,v 1.11.2.1 2002/05/16 12:08:18 gehenna Exp $");
 
 #include "rnd.h"
 #include "locators.h"
@@ -82,10 +82,6 @@
 
 #define        EDLABELDEV(dev) (MAKEDISKDEV(major(dev), DISKUNIT(dev), RAW_PART))
 
-/* XXX: these should go elsewhere */
-cdev_decl(edmca);
-bdev_decl(edmca);
-
 static int     ed_mca_probe   __P((struct device *, struct cfdata *, void *));
 static void    ed_mca_attach  __P((struct device *, struct device *, void *));
 
@@ -101,6 +97,25 @@
 static void    edgetdisklabel  __P((dev_t, struct ed_softc *));
 static void    edgetdefaultlabel __P((struct ed_softc *, struct disklabel *));
 
+dev_type_open(edmcaopen);
+dev_type_close(edmcaclose);
+dev_type_read(edmcaread);
+dev_type_write(edmcawrite);
+dev_type_ioctl(edmcaioctl);
+dev_type_strategy(edmcastrategy);
+dev_type_dump(edmcadump);
+dev_type_size(edmcasize);
+
+const struct bdevsw ed_bdevsw = {
+       edmcaopen, edmcaclose, edmcastrategy, edmcaioctl,
+       edmcadump, edmcasize, D_DISK
+};
+
+const struct cdevsw ed_cdevsw = {
+       edmcaopen, edmcaclose, edmcaread, edmcawrite, edmcaioctl,
+       nostop, notty, nopoll, nommap, D_DISK
+};
+
 static struct dkdriver eddkdriver = { edmcastrategy };
 
 /*



Home | Main Index | Thread Index | Old Index