summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sys/amd64/amd64/autoconf.c4
-rw-r--r--sys/dev/ccd/ccd.c30
-rw-r--r--sys/dev/fdc/fdc.c35
-rw-r--r--sys/dev/mcd/mcd.c28
-rw-r--r--sys/dev/scd/scd.c26
-rw-r--r--sys/dev/slice/slice_device.c40
-rw-r--r--sys/dev/vn/vn.c32
-rw-r--r--sys/fs/cd9660/cd9660_vfsops.c4
-rw-r--r--sys/fs/specfs/spec_vnops.c7
-rw-r--r--sys/geom/geom_ccd.c30
-rw-r--r--sys/i386/i386/autoconf.c4
-rw-r--r--sys/i386/isa/fd.c35
-rw-r--r--sys/i386/isa/labpc.c21
-rw-r--r--sys/i386/isa/matcd/matcd.c30
-rw-r--r--sys/i386/isa/mcd.c28
-rw-r--r--sys/i386/isa/scd.c26
-rw-r--r--sys/i386/isa/wcd.c27
-rw-r--r--sys/i386/isa/wd.c40
-rw-r--r--sys/i386/isa/wfd.c43
-rw-r--r--sys/i386/isa/wst.c37
-rw-r--r--sys/i386/isa/wt.c35
-rw-r--r--sys/isa/fd.c35
-rw-r--r--sys/isofs/cd9660/cd9660_vfsops.c4
-rw-r--r--sys/kern/kern_conf.c179
-rw-r--r--sys/kern/kern_physio.c32
-rw-r--r--sys/kern/subr_diskslice.c4
-rw-r--r--sys/kern/vfs_aio.c9
-rw-r--r--sys/miscfs/devfs/devfs_tree.c6
-rw-r--r--sys/miscfs/devfs/devfsdefs.h4
-rw-r--r--sys/miscfs/specfs/spec_vnops.c7
-rw-r--r--sys/pc98/pc98/wfd.c43
-rw-r--r--sys/pc98/pc98/wst.c37
-rw-r--r--sys/scsi/cd.c26
-rw-r--r--sys/scsi/od.c33
-rw-r--r--sys/scsi/pt.c18
-rw-r--r--sys/scsi/sctarg.c18
-rw-r--r--sys/scsi/sd.c34
-rw-r--r--sys/scsi/st.c30
-rw-r--r--sys/scsi/su.c98
-rw-r--r--sys/scsi/worm.c30
-rw-r--r--sys/sys/conf.h32
-rw-r--r--sys/sys/diskslice.h6
-rw-r--r--sys/sys/linedisc.h32
-rw-r--r--sys/sys/lkm.h6
-rw-r--r--sys/vm/vm_swap.c30
45 files changed, 819 insertions, 496 deletions
diff --git a/sys/amd64/amd64/autoconf.c b/sys/amd64/amd64/autoconf.c
index 487d39d..9ade6d1 100644
--- a/sys/amd64/amd64/autoconf.c
+++ b/sys/amd64/amd64/autoconf.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
- * $Id: autoconf.c,v 1.98 1998/06/09 12:52:31 bde Exp $
+ * $Id: autoconf.c,v 1.99 1998/06/30 03:01:33 jmg Exp $
*/
/*
@@ -142,7 +142,7 @@ static int
find_cdrom_root()
{
int i, j, error;
- struct bdevsw *bd;
+ struct cdevsw *bd;
dev_t orootdev;
#if CD9660_ROOTDELAY > 0
diff --git a/sys/dev/ccd/ccd.c b/sys/dev/ccd/ccd.c
index 29db7a3..28f9127 100644
--- a/sys/dev/ccd/ccd.c
+++ b/sys/dev/ccd/ccd.c
@@ -1,4 +1,4 @@
-/* $Id: ccd.c,v 1.33 1998/06/07 17:09:41 dfr Exp $ */
+/* $Id: ccd.c,v 1.34 1998/07/04 20:45:29 julian Exp $ */
/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
@@ -165,6 +165,8 @@ struct ccdbuf {
(makedev(major((dev)), dkmakeminor(ccdunit((dev)), 0, RAW_PART)))
static d_open_t ccdopen;
+static d_read_t ccdread;
+static d_write_t ccdwrite;
static d_close_t ccdclose;
static d_strategy_t ccdstrategy;
static d_ioctl_t ccdioctl;
@@ -174,12 +176,12 @@ static d_psize_t ccdsize;
#define CDEV_MAJOR 74
#define BDEV_MAJOR 21
-static struct cdevsw ccd_cdevsw;
-static struct bdevsw ccd_bdevsw = {
- ccdopen, ccdclose, ccdstrategy, ccdioctl,
- ccddump, ccdsize, 0,
- "ccd", &ccd_cdevsw, -1
-};
+static struct cdevsw ccd_cdevsw = {
+ ccdopen, ccdclose, ccdread, ccdwrite,
+ ccdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, ccdstrategy, "ccd",
+ NULL, -1, ccddump, ccdsize,
+ D_DISK, 0, -1 };
/* Called by main() during pseudo-device attachment */
static void ccdattach __P((void *));
@@ -258,7 +260,7 @@ ccdattach(dummy)
ccddevs[i].ccd_dk = -1;
if( ! ccd_devsw_installed ) {
- bdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &ccd_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &ccd_cdevsw);
ccd_devsw_installed = 1;
}
else {
@@ -697,6 +699,18 @@ ccdclose(dev, flags, fmt, p)
return (0);
}
+static int
+ccdread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(ccdstrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+ccdwrite(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(ccdstrategy, NULL, dev, 0, minphys, uio));
+}
+
static void
ccdstrategy(bp)
register struct buf *bp;
diff --git a/sys/dev/fdc/fdc.c b/sys/dev/fdc/fdc.c
index 47947d1..472fe57 100644
--- a/sys/dev/fdc/fdc.c
+++ b/sys/dev/fdc/fdc.c
@@ -1,3 +1,4 @@
+
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -43,7 +44,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
- * $Id: fd.c,v 1.113 1998/06/07 17:10:20 dfr Exp $
+ * $Id: fd.c,v 1.114 1998/06/07 19:40:39 dfr Exp $
*
*/
@@ -299,6 +300,8 @@ struct isa_driver fdcdriver = {
};
static d_open_t Fdopen; /* NOTE, not fdopen */
+static d_read_t fdread;
+static d_write_t fdwrite;
static d_close_t fdclose;
static d_ioctl_t fdioctl;
static d_strategy_t fdstrategy;
@@ -306,10 +309,14 @@ static d_strategy_t fdstrategy;
/* even if SLICE defined, these are needed for the ft support. */
#define CDEV_MAJOR 9
#define BDEV_MAJOR 2
-static struct cdevsw fd_cdevsw;
-static struct bdevsw fd_bdevsw =
- { Fdopen, fdclose, fdstrategy, fdioctl, /*2*/
- nodump, nopsize, D_DISK, "fd", &fd_cdevsw, -1 };
+
+
+static struct cdevsw fd_cdevsw = {
+ Fdopen, fdclose, fdread, fdwrite,
+ fdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, fdstrategy, "fd",
+ NULL, -1, nodump, nopsize,
+ D_DISK, 0, -1 };
static struct isa_device *fdcdevs[NFDC];
@@ -798,7 +805,7 @@ fdattach(struct isa_device *dev)
config_intrhook_establish(&fd->ich);
#else /* SLICE */
mynor = fdu << 6;
- fd->bdevs[0] = devfs_add_devswf(&fd_bdevsw, mynor, DV_BLK,
+ fd->bdevs[0] = devfs_add_devswf(&fd_cdevsw, mynor, DV_BLK,
UID_ROOT, GID_OPERATOR, 0640,
"fd%d", fdu);
fd->cdevs[0] = devfs_add_devswf(&fd_cdevsw, mynor, DV_CHR,
@@ -863,7 +870,7 @@ fdattach(struct isa_device *dev)
#else /* SLICE */
typemynor = mynor | i;
fd->bdevs[i] =
- devfs_add_devswf(&fd_bdevsw, typemynor, DV_BLK,
+ devfs_add_devswf(&fd_cdevsw, typemynor, DV_BLK,
UID_ROOT, GID_OPERATOR, 0640,
"fd%d.%d", fdu, typesize);
fd->cdevs[i] =
@@ -1210,6 +1217,18 @@ fdclose(dev_t dev, int flags, int mode, struct proc *p)
return(0);
}
+static int
+fdread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(fdstrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+fdwrite(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(fdstrategy, NULL, dev, 0, minphys, uio));
+}
+
/****************************************************************************/
/* fdstrategy */
@@ -2180,7 +2199,7 @@ static void fd_drvinit(void *notused )
{
if( ! fd_devsw_installed ) {
- bdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &fd_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &fd_cdevsw);
fd_devsw_installed = 1;
}
}
diff --git a/sys/dev/mcd/mcd.c b/sys/dev/mcd/mcd.c
index 1129d94..582198f 100644
--- a/sys/dev/mcd/mcd.c
+++ b/sys/dev/mcd/mcd.c
@@ -40,7 +40,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: mcd.c,v 1.97 1998/01/24 02:54:22 eivind Exp $
+ * $Id: mcd.c,v 1.98 1998/06/07 17:10:46 dfr Exp $
*/
static const char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
@@ -209,6 +209,7 @@ static int mcd_attach(struct isa_device *dev);
struct isa_driver mcddriver = { mcd_probe, mcd_attach, "mcd" };
static d_open_t mcdopen;
+static d_read_t mcdread;
static d_close_t mcdclose;
static d_ioctl_t mcdioctl;
static d_psize_t mcdsize;
@@ -216,10 +217,15 @@ static d_strategy_t mcdstrategy;
#define CDEV_MAJOR 29
#define BDEV_MAJOR 7
-static struct cdevsw mcd_cdevsw;
-static struct bdevsw mcd_bdevsw =
- { mcdopen, mcdclose, mcdstrategy, mcdioctl, /*7*/
- nodump, mcdsize, D_DISK, "mcd", &mcd_cdevsw, -1 };
+
+
+
+static struct cdevsw mcd_cdevsw = {
+ mcdopen, mcdclose, mcdread, nowrite,
+ mcdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, mcdstrategy, "mcd",
+ NULL, -1, nodump, nopsize,
+ D_DISK, 0, NODEV };
#define mcd_put(port,byte) outb(port,byte)
@@ -263,11 +269,11 @@ int mcd_attach(struct isa_device *dev)
DV_CHR, UID_ROOT, GID_OPERATOR, 0640,
"rmcd%dc", unit);
cd->a_devfs_token =
- devfs_add_devswf(&mcd_bdevsw, dkmakeminor(unit, 0, 0),
+ devfs_add_devswf(&mcd_cdevsw, dkmakeminor(unit, 0, 0),
DV_BLK, UID_ROOT, GID_OPERATOR, 0640,
"mcd%da", unit);
cd->c_devfs_token =
- devfs_add_devswf(&mcd_bdevsw, dkmakeminor(unit, 0, RAW_PART),
+ devfs_add_devswf(&mcd_cdevsw, dkmakeminor(unit, 0, RAW_PART),
DV_BLK, UID_ROOT, GID_OPERATOR, 0640,
"mcd%dc", unit);
#endif
@@ -388,6 +394,12 @@ int mcdclose(dev_t dev, int flags, int fmt, struct proc *p)
return 0;
}
+static int
+mcdread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(mcdstrategy, NULL, dev, 1, minphys, uio));
+}
+
void
mcdstrategy(struct buf *bp)
{
@@ -1841,7 +1853,7 @@ static void mcd_drvinit(void *unused)
{
if( ! mcd_devsw_installed ) {
- bdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &mcd_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &mcd_cdevsw);
mcd_devsw_installed = 1;
}
}
diff --git a/sys/dev/scd/scd.c b/sys/dev/scd/scd.c
index 0494a49..98d2341 100644
--- a/sys/dev/scd/scd.c
+++ b/sys/dev/scd/scd.c
@@ -41,7 +41,7 @@
*/
-/* $Id: scd.c,v 1.37 1998/06/07 17:10:56 dfr Exp $ */
+/* $Id: scd.c,v 1.38 1998/06/08 09:47:36 bde Exp $ */
/* Please send any comments to micke@dynas.se */
@@ -186,16 +186,20 @@ struct isa_driver scddriver = { scd_probe, scd_attach, "scd" };
static struct callout_handle tohandle = CALLOUT_HANDLE_INITIALIZER(&tohanle);
static d_open_t scdopen;
+static d_read_t scdread;
static d_close_t scdclose;
static d_ioctl_t scdioctl;
static d_strategy_t scdstrategy;
#define CDEV_MAJOR 45
#define BDEV_MAJOR 16
-static struct cdevsw scd_cdevsw;
-static struct bdevsw scd_bdevsw =
- { scdopen, scdclose, scdstrategy, scdioctl, /*16*/
- nodump, nopsize, D_DISK, "scd", &scd_cdevsw, -1 };
+static struct cdevsw scd_cdevsw = {
+ scdopen, scdclose, scdread, nowrite,
+ scdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, scdstrategy, "scd",
+ NULL, -1, nodump, nopsize,
+ D_DISK, 0, -1 };
+
int scd_attach(struct isa_device *dev)
{
@@ -223,11 +227,11 @@ int scd_attach(struct isa_device *dev)
DV_CHR, UID_ROOT, GID_OPERATOR, 0640,
"rscd%dc", unit);
cd->a_devfs_token =
- devfs_add_devswf(&scd_bdevsw, dkmakeminor(unit, 0, 0),
+ devfs_add_devswf(&scd_cdevsw, dkmakeminor(unit, 0, 0),
DV_BLK, UID_ROOT, GID_OPERATOR, 0640,
"scd%da", unit);
cd->c_devfs_token =
- devfs_add_devswf(&scd_bdevsw, dkmakeminor(unit, 0, RAW_PART),
+ devfs_add_devswf(&scd_cdevsw, dkmakeminor(unit, 0, RAW_PART),
DV_BLK, UID_ROOT, GID_OPERATOR, 0640,
"scd%dc", unit);
#endif
@@ -315,6 +319,12 @@ scdclose(dev_t dev, int flags, int fmt, struct proc *p)
return 0;
}
+static int
+scdread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(scdstrategy, NULL, dev, 1, minphys, uio));
+}
+
static void
scdstrategy(struct buf *bp)
{
@@ -1563,7 +1573,7 @@ static void scd_drvinit(void *unused)
{
if( ! scd_devsw_installed ) {
- bdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &scd_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &scd_cdevsw);
scd_devsw_installed = 1;
}
}
diff --git a/sys/dev/slice/slice_device.c b/sys/dev/slice/slice_device.c
index bc9b7c3..c861941 100644
--- a/sys/dev/slice/slice_device.c
+++ b/sys/dev/slice/slice_device.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: slice_device.c,v 1.5 1998/05/06 22:14:34 julian Exp $
+ * $Id: slice_device.c,v 1.6 1998/06/07 18:44:03 sos Exp $
*/
#define DIAGNOSTIC 1
#include "opt_hw_wdog.h"
@@ -46,6 +46,8 @@
/* Function prototypes (these should all be static except for slicenew()) */
static d_open_t slcdevopen;
+static d_read_t slcdevread;
+static d_write_t slcdevwrite;
static d_close_t slcdevclose;
static d_ioctl_t slcdevioctl;
static d_dump_t slcdevdump;
@@ -55,21 +57,13 @@ static d_strategy_t slcdevstrategy;
#define BDEV_MAJOR 14
#define CDEV_MAJOR 20
-static struct cdevsw slice_cdevsw;
-static struct bdevsw slice_bdevsw = {
- slcdevopen,
- slcdevclose,
- slcdevstrategy,
- slcdevioctl,
- slcdevdump,
- slcdevsize,
- D_DISK,
- "slice",
- &slice_cdevsw,
- -1
-};
+static struct cdevsw slice_cdevsw = {
+ slcdevopen, slcdevclose, slcdevread, slcdevwrite,
+ slcdevioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, slcdevstrategy, "slice",
+ NULL, -1, slcdevdump, slcdevsize,
+ D_DISK, 0, -1 };
-static dev_t cdevnum, bdevnum;
#define UNIT_HASH_SIZE 64
LIST_HEAD(slice_bucket, slice) hash_table[UNIT_HASH_SIZE - 1];
@@ -85,7 +79,7 @@ slice_drvinit(void *unused)
/*
* add bdevsw and cdevsw entries
*/
- bdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &slice_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &slice_cdevsw);
/*
* clear out the hash table
@@ -119,7 +113,7 @@ RR;
*/
slice->devfs_ctoken = devfs_add_devswf(&slice_cdevsw, unit, DV_CHR,
UID_ROOT, GID_OPERATOR, 0600, "r%s", name ? name : "-");
- slice->devfs_btoken = devfs_add_devswf(&slice_bdevsw, unit, DV_BLK,
+ slice->devfs_btoken = devfs_add_devswf(&slice_cdevsw, unit, DV_BLK,
UID_ROOT, GID_OPERATOR, 0600, "%s", name ? name : "-");
/* XXX link this node into upper list of caller */
}
@@ -259,6 +253,18 @@ RR;
}
+static int
+slcdevread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(slcdevstrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+slcdevwrite(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(slcdevstrategy, NULL, dev, 0, minphys, uio));
+}
+static dev_t cdevnum, bdevnum;
/*
* Read/write routine for a buffer. Finds the proper unit, range checks
* arguments, and schedules the transfer. Does not wait for the transfer to
diff --git a/sys/dev/vn/vn.c b/sys/dev/vn/vn.c
index b94fa90..5447824 100644
--- a/sys/dev/vn/vn.c
+++ b/sys/dev/vn/vn.c
@@ -38,7 +38,7 @@
* from: Utah Hdr: vn.c 1.13 94/04/02
*
* from: @(#)vn.c 8.6 (Berkeley) 4/1/94
- * $Id: vn.c,v 1.62 1998/07/04 00:27:48 julian Exp $
+ * $Id: vn.c,v 1.63 1998/07/04 20:45:29 julian Exp $
*/
/*
@@ -96,6 +96,8 @@
static d_ioctl_t vnioctl;
#ifndef SLICE
static d_open_t vnopen;
+static d_read_t vnread;
+static d_write_t vnwrite;
static d_close_t vnclose;
static d_dump_t vndump;
static d_psize_t vnsize;
@@ -103,10 +105,14 @@ static d_strategy_t vnstrategy;
#define CDEV_MAJOR 43
#define BDEV_MAJOR 15
-static struct cdevsw vn_cdevsw;
-static struct bdevsw vn_bdevsw =
- { vnopen, vnclose, vnstrategy, vnioctl, /*15*/
- vndump, vnsize, D_DISK | D_NOCLUSTERRW, "vn", &vn_cdevsw, -1 };
+
+
+static struct cdevsw vn_cdevsw = {
+ vnopen, vnclose, vnread, vnwrite,
+ vnioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, vnstrategy, "vn",
+ NULL, -1, vndump, vnsize,
+ D_DISK|D_NOCLUSTERRW, 0, -1 };
#else /* SLICE */
@@ -227,7 +233,7 @@ vnopen(dev_t dev, int flags, int mode, struct proc *p)
return (dsopen("vn", dev, mode, &vn->sc_slices, &label,
vnstrategy, (ds_setgeom_t *)NULL,
- &vn_bdevsw, &vn_cdevsw));
+ &vn_cdevsw, &vn_cdevsw));
}
if (dkslice(dev) != WHOLE_DISK_SLICE ||
dkpart(dev) != RAW_PART ||
@@ -237,6 +243,18 @@ vnopen(dev_t dev, int flags, int mode, struct proc *p)
return(0);
}
+static int
+vnread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(vnstrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+vnwrite(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(vnstrategy, NULL, dev, 0, minphys, uio));
+}
+
/*
* this code does I/O calls through the appropriate VOP entry point...
* unless a swap_pager I/O request is being done. This strategy (-))
@@ -872,7 +890,7 @@ vn_drvinit(void *unused)
printf("vn: could not install shutdown hook\n");
return;
}
- bdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &vn_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &vn_cdevsw);
vn_devsw_installed = 1;
}
#else /* SLICE */
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c
index 84a6f20..b0bfca2 100644
--- a/sys/fs/cd9660/cd9660_vfsops.c
+++ b/sys/fs/cd9660/cd9660_vfsops.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
- * $Id: cd9660_vfsops.c,v 1.39 1998/05/06 05:29:30 msmith Exp $
+ * $Id: cd9660_vfsops.c,v 1.40 1998/06/07 17:11:29 dfr Exp $
*/
#include <sys/param.h>
@@ -114,7 +114,7 @@ iso_get_ssector(dev, p)
struct ioc_toc_header h;
struct ioc_read_toc_single_entry t;
int i;
- struct bdevsw *bd;
+ struct cdevsw *bd;
d_ioctl_t *ioctlp;
bd = bdevsw[major(dev)];
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c
index a49a106..cb457d1 100644
--- a/sys/fs/specfs/spec_vnops.c
+++ b/sys/fs/specfs/spec_vnops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
- * $Id: spec_vnops.c,v 1.63 1998/06/07 17:11:59 dfr Exp $
+ * $Id: spec_vnops.c,v 1.64 1998/07/04 20:45:33 julian Exp $
*/
#include <sys/param.h>
@@ -183,9 +183,8 @@ spec_open(ap)
* opens for writing of any disk character devices.
*/
if (securelevel >= 2
- && cdevsw[maj]->d_bdev
- && (cdevsw[maj]->d_bdev->d_flags & D_TYPEMASK) ==
- D_DISK)
+ && cdevsw[maj]->d_bmaj != -1
+ && (cdevsw[maj]->d_flags & D_TYPEMASK) == D_DISK)
return (EPERM);
/*
* When running in secure mode, do not allow opens
diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c
index 29db7a3..28f9127 100644
--- a/sys/geom/geom_ccd.c
+++ b/sys/geom/geom_ccd.c
@@ -1,4 +1,4 @@
-/* $Id: ccd.c,v 1.33 1998/06/07 17:09:41 dfr Exp $ */
+/* $Id: ccd.c,v 1.34 1998/07/04 20:45:29 julian Exp $ */
/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
@@ -165,6 +165,8 @@ struct ccdbuf {
(makedev(major((dev)), dkmakeminor(ccdunit((dev)), 0, RAW_PART)))
static d_open_t ccdopen;
+static d_read_t ccdread;
+static d_write_t ccdwrite;
static d_close_t ccdclose;
static d_strategy_t ccdstrategy;
static d_ioctl_t ccdioctl;
@@ -174,12 +176,12 @@ static d_psize_t ccdsize;
#define CDEV_MAJOR 74
#define BDEV_MAJOR 21
-static struct cdevsw ccd_cdevsw;
-static struct bdevsw ccd_bdevsw = {
- ccdopen, ccdclose, ccdstrategy, ccdioctl,
- ccddump, ccdsize, 0,
- "ccd", &ccd_cdevsw, -1
-};
+static struct cdevsw ccd_cdevsw = {
+ ccdopen, ccdclose, ccdread, ccdwrite,
+ ccdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, ccdstrategy, "ccd",
+ NULL, -1, ccddump, ccdsize,
+ D_DISK, 0, -1 };
/* Called by main() during pseudo-device attachment */
static void ccdattach __P((void *));
@@ -258,7 +260,7 @@ ccdattach(dummy)
ccddevs[i].ccd_dk = -1;
if( ! ccd_devsw_installed ) {
- bdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &ccd_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &ccd_cdevsw);
ccd_devsw_installed = 1;
}
else {
@@ -697,6 +699,18 @@ ccdclose(dev, flags, fmt, p)
return (0);
}
+static int
+ccdread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(ccdstrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+ccdwrite(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(ccdstrategy, NULL, dev, 0, minphys, uio));
+}
+
static void
ccdstrategy(bp)
register struct buf *bp;
diff --git a/sys/i386/i386/autoconf.c b/sys/i386/i386/autoconf.c
index 487d39d..9ade6d1 100644
--- a/sys/i386/i386/autoconf.c
+++ b/sys/i386/i386/autoconf.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
- * $Id: autoconf.c,v 1.98 1998/06/09 12:52:31 bde Exp $
+ * $Id: autoconf.c,v 1.99 1998/06/30 03:01:33 jmg Exp $
*/
/*
@@ -142,7 +142,7 @@ static int
find_cdrom_root()
{
int i, j, error;
- struct bdevsw *bd;
+ struct cdevsw *bd;
dev_t orootdev;
#if CD9660_ROOTDELAY > 0
diff --git a/sys/i386/isa/fd.c b/sys/i386/isa/fd.c
index 47947d1..472fe57 100644
--- a/sys/i386/isa/fd.c
+++ b/sys/i386/isa/fd.c
@@ -1,3 +1,4 @@
+
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -43,7 +44,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
- * $Id: fd.c,v 1.113 1998/06/07 17:10:20 dfr Exp $
+ * $Id: fd.c,v 1.114 1998/06/07 19:40:39 dfr Exp $
*
*/
@@ -299,6 +300,8 @@ struct isa_driver fdcdriver = {
};
static d_open_t Fdopen; /* NOTE, not fdopen */
+static d_read_t fdread;
+static d_write_t fdwrite;
static d_close_t fdclose;
static d_ioctl_t fdioctl;
static d_strategy_t fdstrategy;
@@ -306,10 +309,14 @@ static d_strategy_t fdstrategy;
/* even if SLICE defined, these are needed for the ft support. */
#define CDEV_MAJOR 9
#define BDEV_MAJOR 2
-static struct cdevsw fd_cdevsw;
-static struct bdevsw fd_bdevsw =
- { Fdopen, fdclose, fdstrategy, fdioctl, /*2*/
- nodump, nopsize, D_DISK, "fd", &fd_cdevsw, -1 };
+
+
+static struct cdevsw fd_cdevsw = {
+ Fdopen, fdclose, fdread, fdwrite,
+ fdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, fdstrategy, "fd",
+ NULL, -1, nodump, nopsize,
+ D_DISK, 0, -1 };
static struct isa_device *fdcdevs[NFDC];
@@ -798,7 +805,7 @@ fdattach(struct isa_device *dev)
config_intrhook_establish(&fd->ich);
#else /* SLICE */
mynor = fdu << 6;
- fd->bdevs[0] = devfs_add_devswf(&fd_bdevsw, mynor, DV_BLK,
+ fd->bdevs[0] = devfs_add_devswf(&fd_cdevsw, mynor, DV_BLK,
UID_ROOT, GID_OPERATOR, 0640,
"fd%d", fdu);
fd->cdevs[0] = devfs_add_devswf(&fd_cdevsw, mynor, DV_CHR,
@@ -863,7 +870,7 @@ fdattach(struct isa_device *dev)
#else /* SLICE */
typemynor = mynor | i;
fd->bdevs[i] =
- devfs_add_devswf(&fd_bdevsw, typemynor, DV_BLK,
+ devfs_add_devswf(&fd_cdevsw, typemynor, DV_BLK,
UID_ROOT, GID_OPERATOR, 0640,
"fd%d.%d", fdu, typesize);
fd->cdevs[i] =
@@ -1210,6 +1217,18 @@ fdclose(dev_t dev, int flags, int mode, struct proc *p)
return(0);
}
+static int
+fdread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(fdstrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+fdwrite(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(fdstrategy, NULL, dev, 0, minphys, uio));
+}
+
/****************************************************************************/
/* fdstrategy */
@@ -2180,7 +2199,7 @@ static void fd_drvinit(void *notused )
{
if( ! fd_devsw_installed ) {
- bdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &fd_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &fd_cdevsw);
fd_devsw_installed = 1;
}
}
diff --git a/sys/i386/isa/labpc.c b/sys/i386/isa/labpc.c
index 3a5b0a6..c77d3fc 100644
--- a/sys/i386/isa/labpc.c
+++ b/sys/i386/isa/labpc.c
@@ -283,6 +283,8 @@ static int labpcprobe(struct isa_device *dev);
struct isa_driver labpcdriver =
{ labpcprobe, labpcattach, "labpc", 0 };
+static d_read_t labpcread;
+static d_write_t labpcwrite;
static d_open_t labpcopen;
static d_close_t labpcclose;
static d_ioctl_t labpcioctl;
@@ -290,8 +292,8 @@ static d_strategy_t labpcstrategy;
#define CDEV_MAJOR 66
static struct cdevsw labpc_cdevsw =
- { labpcopen, labpcclose, rawread, rawwrite, /*66*/
- labpcioctl, nostop, nullreset, nodevtotty,/* labpc */
+ { labpcopen, labpcclose, labpcread, labpcwrite,
+ labpcioctl, nostop, nullreset, nodevtotty,
seltrue, nommap, labpcstrategy, "labpc", NULL, -1 };
static void start(struct ctlr *ctlr);
@@ -756,7 +758,20 @@ labpcclose(dev_t dev, int flags, int fmt, struct proc *p)
return 0;
}
-/* Start: Start a frame going in or out.
+static int
+labpcread( dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(labpcstrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+labpcwrite ( dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(labpcstrategy, NULL, dev, 0, minphys, uio));
+}
+
+/*
+ * Start: Start a frame going in or out.
*/
static void
start(struct ctlr *ctlr)
diff --git a/sys/i386/isa/matcd/matcd.c b/sys/i386/isa/matcd/matcd.c
index af4da2b..bc2beb4 100644
--- a/sys/i386/isa/matcd/matcd.c
+++ b/sys/i386/isa/matcd/matcd.c
@@ -337,7 +337,7 @@ static char MATCDVERSION[]="Version 1(26) 18-Oct-95";
static char MATCDCOPYRIGHT[] = "Matsushita CD-ROM driver, Copr. 1994,1995 Frank Durda IV";
/* The proceeding strings may not be changed*/
-/* $Id: matcd.c,v 1.33 1998/06/07 17:11:16 dfr Exp $ */
+/* $Id: matcd.c,v 1.34 1998/06/17 13:54:58 bde Exp $ */
/*---------------------------------------------------------------------------
Include declarations
@@ -515,6 +515,7 @@ struct isa_driver matcddriver={matcd_probe, matcd_attach,
static d_open_t matcdopen;
+static d_read_t matcdread;
static d_close_t matcdclose;
static d_ioctl_t matcdioctl;
static d_psize_t matcdsize;
@@ -523,11 +524,12 @@ static d_strategy_t matcdstrategy;
#define CDEV_MAJOR 46
#define BDEV_MAJOR 17
-static struct cdevsw matcd_cdevsw;
-static struct bdevsw matcd_bdevsw =
- { matcdopen, matcdclose, matcdstrategy, matcdioctl, /*17*/
- nodump, matcdsize, D_DISK, "matcd",
- &matcd_cdevsw, -1 };
+static struct cdevsw matcd_cdevsw = {
+ matcdopen, matcdclose, matcdread, nowrite,
+ matcdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, matcdstrategy, "matcd",
+ NULL, -1, nodump, nopsize,
+ D_DISK, 0, -1 };
/*---------------------------------------------------------------------------
Internal function declarations
@@ -839,6 +841,12 @@ int matcdclose(dev_t dev, int flags, int fmt,
}
+static int
+matcdread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(matcdstrategy, NULL, dev, 1, minphys, uio));
+}
+
/*---------------------------------------------------------------------------
matcdstrategy - Accepts I/O requests from kernel for processing
@@ -1404,10 +1412,10 @@ matcd_attach(struct isa_device *dev)
cd->rc_devfs_token = devfs_add_devswf(&matcd_cdevsw,
dkmakeminor(i, 0, RAW_PART), DV_CHR,
UID_ROOT, GID_OPERATOR, 0640, "rmatcd%dc", i);
- cd->a_devfs_token = devfs_add_devswf(&matcd_bdevsw,
+ cd->a_devfs_token = devfs_add_devswf(&matcd_cdevsw,
dkmakeminor(i, 0, 0), DV_BLK,
UID_ROOT, GID_OPERATOR, 0640, "matcd%da", i);
- cd->c_devfs_token = devfs_add_devswf(&matcd_bdevsw,
+ cd->c_devfs_token = devfs_add_devswf(&matcd_cdevsw,
dkmakeminor(i, 0, RAW_PART), DV_BLK,
UID_ROOT, GID_OPERATOR, 0640, "matcd%dc", i);
cd->rla_devfs_token = devfs_add_devswf(&matcd_cdevsw,
@@ -1416,10 +1424,10 @@ matcd_attach(struct isa_device *dev)
cd->rlc_devfs_token = devfs_add_devswf(&matcd_cdevsw,
0x80 | dkmakeminor(i, 0, RAW_PART), DV_CHR,
UID_ROOT, GID_OPERATOR, 0640, "rmatcd%dc", i);
- cd->la_devfs_token = devfs_add_devswf(&matcd_bdevsw,
+ cd->la_devfs_token = devfs_add_devswf(&matcd_cdevsw,
0x80 | dkmakeminor(i, 0, 0), DV_BLK,
UID_ROOT, GID_OPERATOR, 0640, "matcd%dla", i);
- cd->lc_devfs_token = devfs_add_devswf(&matcd_bdevsw,
+ cd->lc_devfs_token = devfs_add_devswf(&matcd_cdevsw,
0x80 | dkmakeminor(i, 0, RAW_PART), DV_BLK,
UID_ROOT, GID_OPERATOR, 0640, "matcd%dlc", i);
#endif
@@ -2730,7 +2738,7 @@ matcd_drvinit(void *unused)
{
if( ! matcd_devsw_installed ) {
- bdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &matcd_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &matcd_cdevsw);
matcd_devsw_installed = 1;
}
}
diff --git a/sys/i386/isa/mcd.c b/sys/i386/isa/mcd.c
index 1129d94..582198f 100644
--- a/sys/i386/isa/mcd.c
+++ b/sys/i386/isa/mcd.c
@@ -40,7 +40,7 @@
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: mcd.c,v 1.97 1998/01/24 02:54:22 eivind Exp $
+ * $Id: mcd.c,v 1.98 1998/06/07 17:10:46 dfr Exp $
*/
static const char COPYRIGHT[] = "mcd-driver (C)1993 by H.Veit & B.Moore";
@@ -209,6 +209,7 @@ static int mcd_attach(struct isa_device *dev);
struct isa_driver mcddriver = { mcd_probe, mcd_attach, "mcd" };
static d_open_t mcdopen;
+static d_read_t mcdread;
static d_close_t mcdclose;
static d_ioctl_t mcdioctl;
static d_psize_t mcdsize;
@@ -216,10 +217,15 @@ static d_strategy_t mcdstrategy;
#define CDEV_MAJOR 29
#define BDEV_MAJOR 7
-static struct cdevsw mcd_cdevsw;
-static struct bdevsw mcd_bdevsw =
- { mcdopen, mcdclose, mcdstrategy, mcdioctl, /*7*/
- nodump, mcdsize, D_DISK, "mcd", &mcd_cdevsw, -1 };
+
+
+
+static struct cdevsw mcd_cdevsw = {
+ mcdopen, mcdclose, mcdread, nowrite,
+ mcdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, mcdstrategy, "mcd",
+ NULL, -1, nodump, nopsize,
+ D_DISK, 0, NODEV };
#define mcd_put(port,byte) outb(port,byte)
@@ -263,11 +269,11 @@ int mcd_attach(struct isa_device *dev)
DV_CHR, UID_ROOT, GID_OPERATOR, 0640,
"rmcd%dc", unit);
cd->a_devfs_token =
- devfs_add_devswf(&mcd_bdevsw, dkmakeminor(unit, 0, 0),
+ devfs_add_devswf(&mcd_cdevsw, dkmakeminor(unit, 0, 0),
DV_BLK, UID_ROOT, GID_OPERATOR, 0640,
"mcd%da", unit);
cd->c_devfs_token =
- devfs_add_devswf(&mcd_bdevsw, dkmakeminor(unit, 0, RAW_PART),
+ devfs_add_devswf(&mcd_cdevsw, dkmakeminor(unit, 0, RAW_PART),
DV_BLK, UID_ROOT, GID_OPERATOR, 0640,
"mcd%dc", unit);
#endif
@@ -388,6 +394,12 @@ int mcdclose(dev_t dev, int flags, int fmt, struct proc *p)
return 0;
}
+static int
+mcdread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(mcdstrategy, NULL, dev, 1, minphys, uio));
+}
+
void
mcdstrategy(struct buf *bp)
{
@@ -1841,7 +1853,7 @@ static void mcd_drvinit(void *unused)
{
if( ! mcd_devsw_installed ) {
- bdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &mcd_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &mcd_cdevsw);
mcd_devsw_installed = 1;
}
}
diff --git a/sys/i386/isa/scd.c b/sys/i386/isa/scd.c
index 0494a49..98d2341 100644
--- a/sys/i386/isa/scd.c
+++ b/sys/i386/isa/scd.c
@@ -41,7 +41,7 @@
*/
-/* $Id: scd.c,v 1.37 1998/06/07 17:10:56 dfr Exp $ */
+/* $Id: scd.c,v 1.38 1998/06/08 09:47:36 bde Exp $ */
/* Please send any comments to micke@dynas.se */
@@ -186,16 +186,20 @@ struct isa_driver scddriver = { scd_probe, scd_attach, "scd" };
static struct callout_handle tohandle = CALLOUT_HANDLE_INITIALIZER(&tohanle);
static d_open_t scdopen;
+static d_read_t scdread;
static d_close_t scdclose;
static d_ioctl_t scdioctl;
static d_strategy_t scdstrategy;
#define CDEV_MAJOR 45
#define BDEV_MAJOR 16
-static struct cdevsw scd_cdevsw;
-static struct bdevsw scd_bdevsw =
- { scdopen, scdclose, scdstrategy, scdioctl, /*16*/
- nodump, nopsize, D_DISK, "scd", &scd_cdevsw, -1 };
+static struct cdevsw scd_cdevsw = {
+ scdopen, scdclose, scdread, nowrite,
+ scdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, scdstrategy, "scd",
+ NULL, -1, nodump, nopsize,
+ D_DISK, 0, -1 };
+
int scd_attach(struct isa_device *dev)
{
@@ -223,11 +227,11 @@ int scd_attach(struct isa_device *dev)
DV_CHR, UID_ROOT, GID_OPERATOR, 0640,
"rscd%dc", unit);
cd->a_devfs_token =
- devfs_add_devswf(&scd_bdevsw, dkmakeminor(unit, 0, 0),
+ devfs_add_devswf(&scd_cdevsw, dkmakeminor(unit, 0, 0),
DV_BLK, UID_ROOT, GID_OPERATOR, 0640,
"scd%da", unit);
cd->c_devfs_token =
- devfs_add_devswf(&scd_bdevsw, dkmakeminor(unit, 0, RAW_PART),
+ devfs_add_devswf(&scd_cdevsw, dkmakeminor(unit, 0, RAW_PART),
DV_BLK, UID_ROOT, GID_OPERATOR, 0640,
"scd%dc", unit);
#endif
@@ -315,6 +319,12 @@ scdclose(dev_t dev, int flags, int fmt, struct proc *p)
return 0;
}
+static int
+scdread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(scdstrategy, NULL, dev, 1, minphys, uio));
+}
+
static void
scdstrategy(struct buf *bp)
{
@@ -1563,7 +1573,7 @@ static void scd_drvinit(void *unused)
{
if( ! scd_devsw_installed ) {
- bdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &scd_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &scd_cdevsw);
scd_devsw_installed = 1;
}
}
diff --git a/sys/i386/isa/wcd.c b/sys/i386/isa/wcd.c
index c900742..d58640b 100644
--- a/sys/i386/isa/wcd.c
+++ b/sys/i386/isa/wcd.c
@@ -13,7 +13,7 @@
* all derivative works or modified versions.
*
* From: Version 1.9, Mon Oct 9 20:27:42 MSK 1995
- * $Id: wcd.c,v 1.55 1998/06/25 11:27:20 phk Exp $
+ * $Id: wcd.c,v 1.56 1998/06/26 18:13:57 phk Exp $
*/
#include "wdc.h"
@@ -40,16 +40,19 @@
#include <i386/isa/atapi.h>
static d_open_t wcdopen;
+static d_read_t wcdread;
static d_close_t wcdclose;
static d_ioctl_t wcdioctl;
static d_strategy_t wcdstrategy;
#define CDEV_MAJOR 69
#define BDEV_MAJOR 19
-static struct cdevsw wcd_cdevsw;
-static struct bdevsw wcd_bdevsw =
- { wcdopen, wcdclose, wcdstrategy, wcdioctl, /*19*/
- nodump, nopsize, D_DISK, "wcd", &wcd_cdevsw, -1 };
+static struct cdevsw wcd_cdevsw =
+ { wcdopen, wcdclose, wcdread, nowrite, /*69*/
+ wcdioctl, nostop, nullreset, nodevtotty,/* atapi */
+ seltrue, nommap, wcdstrategy, "wcd",
+ NULL, -1, nodump, nopsize,
+ D_DISK, 0, -1 };
#ifndef ATAPI_STATIC
static
@@ -317,11 +320,11 @@ wcd_init_lun(struct atapi *ata, int unit, struct atapi_params *ap, int lun)
DV_CHR, UID_ROOT, GID_OPERATOR, 0640,
"rwcd%dc", lun);
ptr->a_devfs_token =
- devfs_add_devswf(&wcd_bdevsw, dkmakeminor(lun, 0, 0),
+ devfs_add_devswf(&wcd_cdevsw, dkmakeminor(lun, 0, 0),
DV_BLK, UID_ROOT, GID_OPERATOR, 0640,
"wcd%da", lun);
ptr->c_devfs_token =
- devfs_add_devswf(&wcd_bdevsw, dkmakeminor(lun, 0, RAW_PART),
+ devfs_add_devswf(&wcd_cdevsw, dkmakeminor(lun, 0, RAW_PART),
DV_BLK, UID_ROOT, GID_OPERATOR, 0640,
"wcd%dc", lun);
#endif
@@ -560,6 +563,12 @@ wcdclose (dev_t dev, int flags, int fmt, struct proc *p)
return (0);
}
+static int
+wcdread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(wcdstrategy, NULL, dev, 1, minphys, uio));
+}
+
/*
* Actually translate the requested transfer into one the physical driver can
* understand. The transfer is described by a buf and will include only one
@@ -1271,7 +1280,7 @@ wcd_select_slot(struct wcd *cdp)
*/
-MOD_DEV(wcd, LM_DT_BLOCK, BDEV_MAJOR, &wcd_bdevsw);
+MOD_DEV(wcd, LM_DT_BLOCK, BDEV_MAJOR, &wcd_cdevsw);
MOD_DEV(rwcd, LM_DT_CHAR, CDEV_MAJOR, &wcd_cdevsw);
/*
@@ -1361,7 +1370,7 @@ static void wcd_drvinit(void *unused)
{
if( ! wcd_devsw_installed ) {
- bdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &wcd_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &wcd_cdevsw);
wcd_devsw_installed = 1;
}
}
diff --git a/sys/i386/isa/wd.c b/sys/i386/isa/wd.c
index 2460f13..6172ffa1 100644
--- a/sys/i386/isa/wd.c
+++ b/sys/i386/isa/wd.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)wd.c 7.2 (Berkeley) 5/9/91
- * $Id: wd.c,v 1.168 1998/06/07 17:11:05 dfr Exp $
+ * $Id: wd.c,v 1.169 1998/06/07 19:40:41 dfr Exp $
*/
/* TODO:
@@ -289,6 +289,8 @@ static struct slice_handler slicetype = {
#ifndef SLICE
static d_open_t wdopen;
+static d_read_t wdread;
+static d_write_t wdwrite;
static d_close_t wdclose;
static d_strategy_t wdstrategy;
static d_ioctl_t wdioctl;
@@ -297,10 +299,15 @@ static d_psize_t wdsize;
#define CDEV_MAJOR 3
#define BDEV_MAJOR 0
-static struct cdevsw wd_cdevsw;
-static struct bdevsw wd_bdevsw =
- { wdopen, wdclose, wdstrategy, wdioctl, /*0*/
- wddump, wdsize, D_DISK, "wd", &wd_cdevsw, -1 };
+
+
+static struct cdevsw wd_cdevsw = {
+ wdopen, wdclose, wdread, wdwrite,
+ wdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, wdstrategy, "wd",
+ NULL, -1, wddump, wdsize,
+ D_DISK, 0, -1 };
+
#endif /* !SLICE */
#ifdef CMD640
@@ -602,7 +609,7 @@ wdattach(struct isa_device *dvp)
config_intrhook_establish(&du->ich);
#else
mynor = dkmakeminor(lunit, WHOLE_DISK_SLICE, RAW_PART);
- du->dk_bdev = devfs_add_devswf(&wd_bdevsw, mynor,
+ du->dk_bdev = devfs_add_devswf(&wd_cdevsw, mynor,
DV_BLK, UID_ROOT,
GID_OPERATOR, 0640,
"wd%d", lunit);
@@ -712,6 +719,19 @@ wds_init(void *arg)
#endif
#ifndef SLICE
+
+static int
+wdread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(wdstrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+wdwrite(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(wdstrategy, NULL, dev, 0, minphys, uio));
+}
+
/* Read/write routine for a buffer. Finds the proper unit, range checks
* arguments, and schedules the transfer. Does not wait for the transfer
* to complete. Multi-page transfers are supported. All I/O requests must
@@ -1483,7 +1503,7 @@ wdopen(dev_t dev, int flags, int fmt, struct proc *p)
label.d_secpercyl = du->dk_dd.d_secpercyl;
label.d_secperunit = du->dk_dd.d_secperunit;
error = dsopen("wd", dev, fmt, &du->dk_slices, &label, wdstrategy1,
- (ds_setgeom_t *)NULL, &wd_bdevsw, &wd_cdevsw);
+ (ds_setgeom_t *)NULL, &wd_cdevsw, &wd_cdevsw);
}
du->dk_flags &= ~DKFL_LABELLING;
wdsleep(du->dk_ctrlr, "wdopn2");
@@ -2679,9 +2699,9 @@ static void wd_drvinit(void *unused)
{
if( ! wd_devsw_installed ) {
- if (wd_bdevsw.d_maxio == 0)
- wd_bdevsw.d_maxio = 248 * 512;
- bdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &wd_bdevsw);
+ if (wd_cdevsw.d_maxio == 0)
+ wd_cdevsw.d_maxio = 248 * 512;
+ cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &wd_cdevsw);
wd_devsw_installed = 1;
}
}
diff --git a/sys/i386/isa/wfd.c b/sys/i386/isa/wfd.c
index e827627..712525f 100644
--- a/sys/i386/isa/wfd.c
+++ b/sys/i386/isa/wfd.c
@@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: wfd.c,v 1.10 1998/06/07 17:11:06 dfr Exp $
+ * $Id: wfd.c,v 1.11 1998/06/26 18:13:57 phk Exp $
*/
/*
@@ -52,17 +52,22 @@
#include <i386/isa/atapi.h>
-static d_open_t wfdbopen;
-static d_close_t wfdbclose;
+static d_open_t wfdopen;
+static d_read_t wfdread;
+static d_write_t wfdwrite;
+static d_close_t wfdclose;
static d_ioctl_t wfdioctl;
static d_strategy_t wfdstrategy;
#define CDEV_MAJOR 87
#define BDEV_MAJOR 1
-static struct cdevsw wfd_cdevsw;
-static struct bdevsw wfd_bdevsw =
- { wfdbopen, wfdbclose, wfdstrategy, wfdioctl,
- nodump, nopsize, D_DISK, "wfd", &wfd_cdevsw, -1 };
+
+static struct cdevsw wfd_cdevsw = {
+ wfdopen, wfdclose, wfdread, wfdwrite,
+ wfdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, wfdstrategy, "wfd",
+ NULL, -1, nodump, nopsize,
+ D_DISK, 0, -1 };
#ifndef ATAPI_STATIC
static
@@ -251,7 +256,7 @@ wfdattach (struct atapi *ata, int unit, struct atapi_params *ap, int debug)
#ifdef DEVFS
mynor = dkmakeminor(t->lun, WHOLE_DISK_SLICE, RAW_PART);
- t->bdevs = devfs_add_devswf(&wfd_bdevsw, mynor,
+ t->bdevs = devfs_add_devswf(&wfd_cdevsw, mynor,
DV_BLK, UID_ROOT, GID_OPERATOR, 0640,
"wfd%d", t->lun);
t->cdevs = devfs_add_devswf(&wfd_cdevsw, mynor,
@@ -326,7 +331,7 @@ void wfd_describe (struct wfd *t)
}
}
-int wfdbopen (dev_t dev, int flags, int fmt, struct proc *p)
+int wfdopen (dev_t dev, int flags, int fmt, struct proc *p)
{
int lun = UNIT(dev);
struct wfd *t;
@@ -370,7 +375,7 @@ int wfdbopen (dev_t dev, int flags, int fmt, struct proc *p)
/* Initialize slice tables. */
errcode = dsopen("wfd", dev, fmt, &t->dk_slices, &label, wfdstrategy1,
- (ds_setgeom_t *)NULL, &wfd_bdevsw, &wfd_cdevsw);
+ (ds_setgeom_t *)NULL, &wfd_cdevsw, &wfd_cdevsw);
if (errcode != 0)
return errcode;
@@ -382,7 +387,7 @@ int wfdbopen (dev_t dev, int flags, int fmt, struct proc *p)
* Close the device. Only called if we are the LAST
* occurence of an open device.
*/
-int wfdbclose (dev_t dev, int flags, int fmt, struct proc *p)
+int wfdclose (dev_t dev, int flags, int fmt, struct proc *p)
{
int lun = UNIT(dev);
struct wfd *t = wfdtab[lun];
@@ -398,6 +403,18 @@ int wfdbclose (dev_t dev, int flags, int fmt, struct proc *p)
return (0);
}
+static int
+wfdread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(wfdstrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+wfdwrite(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(wfdstrategy, NULL, dev, 0, minphys, uio));
+}
+
static void
wfdstrategy1(struct buf *bp)
{
@@ -746,7 +763,7 @@ static int wfd_eject (struct wfd *t, int closeit)
*/
-MOD_DEV(wfd, LM_DT_BLOCK, BDEV_MAJOR, &wfd_bdevsw);
+MOD_DEV(wfd, LM_DT_BLOCK, BDEV_MAJOR, &wfd_cdevsw);
MOD_DEV(rwfd, LM_DT_CHAR, CDEV_MAJOR, &wfd_cdevsw);
/*
@@ -835,7 +852,7 @@ static wfd_devsw_installed = 0;
static void wfd_drvinit(void *unused)
{
if( ! wfd_devsw_installed ) {
- bdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &wfd_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &wfd_cdevsw);
wfd_devsw_installed = 1;
}
}
diff --git a/sys/i386/isa/wst.c b/sys/i386/isa/wst.c
index 8cf5c6d..da12c0b 100644
--- a/sys/i386/isa/wst.c
+++ b/sys/i386/isa/wst.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: wst.c,v 1.6 1998/06/08 09:47:37 bde Exp $
+ * $Id: wst.c,v 1.7 1998/06/21 18:02:41 bde Exp $
*/
#include "wdc.h"
@@ -49,17 +49,22 @@
#include <i386/isa/atapi.h>
static d_open_t wstopen;
+static d_read_t wstread;
+static d_write_t wstwrite;
static d_close_t wstclose;
static d_ioctl_t wstioctl;
static d_strategy_t wststrategy;
#define CDEV_MAJOR 90
#define BDEV_MAJOR 24
-static struct cdevsw wst_cdevsw;
-static struct bdevsw wst_bdevsw = {
- wstopen, wstclose, wststrategy, wstioctl,
- nodump, nopsize, D_TAPE, "wst", &wst_cdevsw, -1
-};
+
+
+
+static struct cdevsw wst_cdevsw = {
+ wstopen, wstclose, wstread, wstwrite,
+ wstioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, wststrategy, "wst",
+ NULL, -1 };
static int wst_total = 0;
@@ -260,8 +265,6 @@ wstattach(struct atapi *ata, int unit, struct atapi_params *ap, int debug)
wstnlun++;
#ifdef DEVFS
- t->bdevs = devfs_add_devswf(&wst_bdevsw, 0, DV_BLK, UID_ROOT, GID_OPERATOR,
- 0640, "wst%d", t->lun);
t->cdevs = devfs_add_devswf(&wst_cdevsw, 0, DV_CHR, UID_ROOT, GID_OPERATOR,
0640, "rwst%d", t->lun);
#endif /* DEVFS */
@@ -389,6 +392,18 @@ wstclose(dev_t dev, int flags, int fmt, struct proc *p)
return(0);
}
+static int
+wstread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(wststrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+wstwrite(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(wststrategy, NULL, dev, 0, minphys, uio));
+}
+
void
wststrategy(struct buf *bp)
{
@@ -777,7 +792,6 @@ wst_reset(struct wst *t)
#include <sys/sysent.h>
#include <sys/lkm.h>
-MOD_DEV(wst, LM_DT_BLOCK, BDEV_MAJOR, &wst_bdevsw);
MOD_DEV(rwst, LM_DT_CHAR, CDEV_MAJOR, &wst_cdevsw);
int
@@ -853,7 +867,10 @@ static void
wst_drvinit(void *unused)
{
if (!wst_devsw_installed) {
- bdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &wst_bdevsw);
+ dev_t dev;
+
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev, &wst_cdevsw, NULL);
wst_devsw_installed = 1;
}
}
diff --git a/sys/i386/isa/wt.c b/sys/i386/isa/wt.c
index 9c317a6..481397e 100644
--- a/sys/i386/isa/wt.c
+++ b/sys/i386/isa/wt.c
@@ -20,7 +20,7 @@
* the original CMU copyright notice.
*
* Version 1.3, Thu Nov 11 12:09:13 MSK 1993
- * $Id: wt.c,v 1.43 1998/01/24 02:54:28 eivind Exp $
+ * $Id: wt.c,v 1.44 1998/06/07 17:11:07 dfr Exp $
*
*/
@@ -163,7 +163,6 @@ typedef struct {
unsigned char BUSY, NOEXCEP, RESETMASK, RESETVAL;
unsigned char ONLINE, RESET, REQUEST, IEN;
#ifdef DEVFS
- void *devfs_token;
void *devfs_token_r;
#endif
} wtinfo_t;
@@ -185,6 +184,8 @@ static int wtwritefm (wtinfo_t *t);
static int wtpoll (wtinfo_t *t, int mask, int bits);
static d_open_t wtopen;
+static d_read_t wtread;
+static d_write_t wtwrite;
static d_close_t wtclose;
static d_ioctl_t wtioctl;
static d_dump_t wtdump;
@@ -194,10 +195,12 @@ static d_strategy_t wtstrategy;
#define CDEV_MAJOR 10
#define BDEV_MAJOR 3
-static struct cdevsw wt_cdevsw;
-static struct bdevsw wt_bdevsw =
- { wtopen, wtclose, wtstrategy, wtioctl, /*3*/
- wtdump, wtsize, B_TAPE, "wt", &wt_cdevsw, -1 };
+
+static struct cdevsw wt_cdevsw = {
+ wtopen, wtclose, wtread, wtwrite,
+ wtioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, wtstrategy, "wt",
+ NULL, -1 };
/*
@@ -266,9 +269,6 @@ wtattach (struct isa_device *id)
t->devfs_token_r =
devfs_add_devswf(&wt_cdevsw, id->id_unit, DV_CHR, 0, 0,
0600, "rwt%d", id->id_unit);
- t->devfs_token =
- devfs_add_devswf(&wt_bdevsw, id->id_unit, DV_BLK, 0, 0,
- 0600, "wt%d", id->id_unit);
#endif
return (1);
}
@@ -510,6 +510,18 @@ wtioctl (dev_t dev, u_long cmd, caddr_t arg, int flags, struct proc *p)
return (EINVAL);
}
+static int
+wtread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(wtstrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+wtwrite(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(wtstrategy, NULL, dev, 0, minphys, uio));
+}
+
/*
* Strategy routine.
*/
@@ -991,7 +1003,10 @@ wt_drvinit(void *unused)
{
if( ! wt_devsw_installed ) {
- bdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &wt_bdevsw);
+ dev_t dev;
+
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev, &wt_cdevsw, NULL);
wt_devsw_installed = 1;
}
}
diff --git a/sys/isa/fd.c b/sys/isa/fd.c
index 47947d1..472fe57 100644
--- a/sys/isa/fd.c
+++ b/sys/isa/fd.c
@@ -1,3 +1,4 @@
+
/*
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@@ -43,7 +44,7 @@
* SUCH DAMAGE.
*
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
- * $Id: fd.c,v 1.113 1998/06/07 17:10:20 dfr Exp $
+ * $Id: fd.c,v 1.114 1998/06/07 19:40:39 dfr Exp $
*
*/
@@ -299,6 +300,8 @@ struct isa_driver fdcdriver = {
};
static d_open_t Fdopen; /* NOTE, not fdopen */
+static d_read_t fdread;
+static d_write_t fdwrite;
static d_close_t fdclose;
static d_ioctl_t fdioctl;
static d_strategy_t fdstrategy;
@@ -306,10 +309,14 @@ static d_strategy_t fdstrategy;
/* even if SLICE defined, these are needed for the ft support. */
#define CDEV_MAJOR 9
#define BDEV_MAJOR 2
-static struct cdevsw fd_cdevsw;
-static struct bdevsw fd_bdevsw =
- { Fdopen, fdclose, fdstrategy, fdioctl, /*2*/
- nodump, nopsize, D_DISK, "fd", &fd_cdevsw, -1 };
+
+
+static struct cdevsw fd_cdevsw = {
+ Fdopen, fdclose, fdread, fdwrite,
+ fdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, fdstrategy, "fd",
+ NULL, -1, nodump, nopsize,
+ D_DISK, 0, -1 };
static struct isa_device *fdcdevs[NFDC];
@@ -798,7 +805,7 @@ fdattach(struct isa_device *dev)
config_intrhook_establish(&fd->ich);
#else /* SLICE */
mynor = fdu << 6;
- fd->bdevs[0] = devfs_add_devswf(&fd_bdevsw, mynor, DV_BLK,
+ fd->bdevs[0] = devfs_add_devswf(&fd_cdevsw, mynor, DV_BLK,
UID_ROOT, GID_OPERATOR, 0640,
"fd%d", fdu);
fd->cdevs[0] = devfs_add_devswf(&fd_cdevsw, mynor, DV_CHR,
@@ -863,7 +870,7 @@ fdattach(struct isa_device *dev)
#else /* SLICE */
typemynor = mynor | i;
fd->bdevs[i] =
- devfs_add_devswf(&fd_bdevsw, typemynor, DV_BLK,
+ devfs_add_devswf(&fd_cdevsw, typemynor, DV_BLK,
UID_ROOT, GID_OPERATOR, 0640,
"fd%d.%d", fdu, typesize);
fd->cdevs[i] =
@@ -1210,6 +1217,18 @@ fdclose(dev_t dev, int flags, int mode, struct proc *p)
return(0);
}
+static int
+fdread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(fdstrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+fdwrite(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(fdstrategy, NULL, dev, 0, minphys, uio));
+}
+
/****************************************************************************/
/* fdstrategy */
@@ -2180,7 +2199,7 @@ static void fd_drvinit(void *notused )
{
if( ! fd_devsw_installed ) {
- bdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &fd_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR,CDEV_MAJOR, &fd_cdevsw);
fd_devsw_installed = 1;
}
}
diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c
index 84a6f20..b0bfca2 100644
--- a/sys/isofs/cd9660/cd9660_vfsops.c
+++ b/sys/isofs/cd9660/cd9660_vfsops.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
- * $Id: cd9660_vfsops.c,v 1.39 1998/05/06 05:29:30 msmith Exp $
+ * $Id: cd9660_vfsops.c,v 1.40 1998/06/07 17:11:29 dfr Exp $
*/
#include <sys/param.h>
@@ -114,7 +114,7 @@ iso_get_ssector(dev, p)
struct ioc_toc_header h;
struct ioc_read_toc_single_entry t;
int i;
- struct bdevsw *bd;
+ struct cdevsw *bd;
d_ioctl_t *ioctlp;
bd = bdevsw[major(dev)];
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index e8df756..684b365 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: kern_conf.c,v 1.25 1998/06/25 11:27:34 phk Exp $
+ * $Id: kern_conf.c,v 1.26 1998/06/26 18:14:25 phk Exp $
*/
#include <sys/param.h>
@@ -44,13 +44,11 @@
#define bdevsw_ALLOCSTART (NUMBDEV/2)
#define cdevsw_ALLOCSTART (NUMCDEV/2)
-struct bdevsw *bdevsw[NUMBDEV];
+struct cdevsw *bdevsw[NUMBDEV];
int nblkdev = NUMBDEV;
struct cdevsw *cdevsw[NUMCDEV];
int nchrdev = NUMCDEV;
-static void cdevsw_make __P((struct bdevsw *from));
-
/*
* Routine to convert from character to block device number.
*
@@ -63,8 +61,8 @@ chrtoblk(dev_t dev)
struct cdevsw *cd;
if(cd = cdevsw[major(dev)]) {
- if ( (bd = cd->d_bdev) )
- return(makedev(bd->d_maj,minor(dev)));
+ if (cd->d_bmaj != -1)
+ return(makedev(cd->d_bmaj,minor(dev)));
}
return(NODEV);
}
@@ -73,91 +71,99 @@ chrtoblk(dev_t dev)
* (re)place an entry in the bdevsw or cdevsw table
* return the slot used in major(*descrip)
*/
-#define ADDENTRY(TTYPE,NXXXDEV,ALLOCSTART) \
-int TTYPE##_add(dev_t *descrip, \
- struct TTYPE *newentry, \
- struct TTYPE **oldentry) \
-{ \
- int i ; \
- if ( (int)*descrip == NODEV) { /* auto (0 is valid) */ \
- /* \
- * Search the table looking for a slot... \
- */ \
- for (i = ALLOCSTART; i < NXXXDEV; i++) \
- if (TTYPE[i] == NULL) \
- break; /* found one! */ \
- /* out of allocable slots? */ \
- if (i >= NXXXDEV) { \
- return ENFILE; \
- } \
- } else { /* assign */ \
- i = major(*descrip); \
- if (i < 0 || i >= NXXXDEV) { \
- return EINVAL; \
- } \
- } \
- \
- /* maybe save old */ \
- if (oldentry) { \
- *oldentry = TTYPE[i]; \
- } \
- if (newentry) \
- newentry->d_maj = i; \
- /* replace with new */ \
- TTYPE[i] = newentry; \
- \
- /* done! let them know where we put it */ \
- *descrip = makedev(i,0); \
- return 0; \
-} \
-
-static ADDENTRY(bdevsw, nblkdev,bdevsw_ALLOCSTART)
-ADDENTRY(cdevsw, nchrdev,cdevsw_ALLOCSTART)
+static int
+bdevsw_add(dev_t *descrip,
+ struct cdevsw *newentry,
+ struct cdevsw **oldentry)
+{
+ int i ;
+
+ if ( (int)*descrip == NODEV) { /* auto (0 is valid) */
+ /*
+ * Search the table looking for a slot...
+ */
+ for (i = bdevsw_ALLOCSTART; i < nblkdev; i++)
+ if (bdevsw[i] == NULL)
+ break; /* found one! */
+ /* out of allocable slots? */
+ if (i >= nblkdev) {
+ return ENFILE;
+ }
+ } else { /* assign */
+ i = major(*descrip);
+ if (i < 0 || i >= nblkdev) {
+ return EINVAL;
+ }
+ }
-/*
- * Since the bdevsw struct for a disk contains all the information
- * needed to create a cdevsw entry, these two routines do that, rather
- * than specifying it by hand.
- */
+ /* maybe save old */
+ if (oldentry) {
+ *oldentry = bdevsw[i];
+ }
+ if (newentry) {
+ newentry->d_bmaj = i;
+ }
+ /* replace with new */
+ bdevsw[i] = newentry;
+
+ /* done! let them know where we put it */
+ *descrip = makedev(i,0);
+ return 0;
+}
-static void
-cdevsw_make(struct bdevsw *from)
+int
+cdevsw_add(dev_t *descrip,
+ struct cdevsw *newentry,
+ struct cdevsw **oldentry)
{
- struct cdevsw *to = from->d_cdev;
-
- if (!to)
- panic("No target cdevsw in bdevsw");
- to->d_open = from->d_open;
- to->d_close = from->d_close;
- to->d_read = rawread;
- to->d_write = rawwrite;
- to->d_ioctl = from->d_ioctl;
- to->d_stop = nostop;
- to->d_reset = nullreset;
- to->d_devtotty = nodevtotty;
- to->d_poll = seltrue;
- to->d_mmap = nommap;
- to->d_strategy = from->d_strategy;
- to->d_name = from->d_name;
- to->d_bdev = from;
- to->d_maj = -1;
- to->d_bmaj = from->d_maj;
- to->d_maxio = from->d_maxio;
- to->d_dump = from->d_dump;
- to->d_psize = from->d_psize;
- to->d_flags = from->d_flags;
-}
+ int i ;
+
+ if ( (int)*descrip == NODEV) { /* auto (0 is valid) */
+ /*
+ * Search the table looking for a slot...
+ */
+ for (i = cdevsw_ALLOCSTART; i < nchrdev; i++)
+ if (cdevsw[i] == NULL)
+ break; /* found one! */
+ /* out of allocable slots? */
+ if (i >= nchrdev) {
+ return ENFILE;
+ }
+ } else { /* assign */
+ i = major(*descrip);
+ if (i < 0 || i >= nchrdev) {
+ return EINVAL;
+ }
+ }
+ /* maybe save old */
+ if (oldentry) {
+ *oldentry = cdevsw[i];
+ }
+ if (newentry) {
+ newentry->d_bmaj = -1;
+ newentry->d_maj = i;
+ }
+ /* replace with new */
+ cdevsw[i] = newentry;
+
+ /* done! let them know where we put it */
+ *descrip = makedev(i,0);
+ return 0;
+}
+
+/*
+ * note must call cdevsw_add before bdevsw_add due to d_bmaj hack.
+ */
void
-bdevsw_add_generic(int bdev, int cdev, struct bdevsw *bdevsw)
+cdevsw_add_generic(int bdev, int cdev, struct cdevsw *cdevsw)
{
dev_t dev;
- cdevsw_make(bdevsw);
dev = makedev(cdev, 0);
- cdevsw_add(&dev, bdevsw->d_cdev, NULL);
+ cdevsw_add(&dev, cdevsw, NULL);
dev = makedev(bdev, 0);
- bdevsw_add(&dev, bdevsw , NULL);
+ bdevsw_add(&dev, cdevsw, NULL);
}
int
@@ -192,18 +198,19 @@ bdevsw_module_handler(module_t mod, modeventtype_t what, void* arg)
switch (what) {
case MOD_LOAD:
- cdevsw_make(data->bdevsw);
- if (error = cdevsw_add(&data->cdev, data->bdevsw->d_cdev, NULL))
+ if (error = cdevsw_add(&data->cdev, data->cdevsw, NULL))
return error;
- if (error = bdevsw_add(&data->bdev, data->bdevsw, NULL))
+ if (error = bdevsw_add(&data->bdev, data->cdevsw, NULL)) {
+ cdevsw_add(&data->bdev, NULL, NULL);
return error;
+ }
break;
case MOD_UNLOAD:
- if (error = cdevsw_add(&data->cdev, NULL, NULL))
- return error;
if (error = bdevsw_add(&data->bdev, NULL, NULL))
return error;
+ if (error = cdevsw_add(&data->cdev, NULL, NULL))
+ return error;
break;
}
diff --git a/sys/kern/kern_physio.c b/sys/kern/kern_physio.c
index 8261bbf..cb29335 100644
--- a/sys/kern/kern_physio.c
+++ b/sys/kern/kern_physio.c
@@ -16,7 +16,7 @@
* 4. Modifications may be freely made to this file if the above conditions
* are met.
*
- * $Id: kern_physio.c,v 1.25 1998/03/28 10:33:05 bde Exp $
+ * $Id: kern_physio.c,v 1.26 1998/04/04 05:55:05 dyson Exp $
*/
#include <sys/param.h>
@@ -168,10 +168,10 @@ minphys(bp)
struct buf *bp;
{
u_int maxphys = DFLTPHYS;
- struct bdevsw *bdsw;
+ struct cdevsw *bdsw;
int offset;
- bdsw = cdevsw[major(bp->b_dev)]->d_bdev;
+ bdsw = cdevsw[major(bp->b_dev)];
if (bdsw && bdsw->d_maxio) {
maxphys = bdsw->d_maxio;
@@ -193,11 +193,11 @@ minphys(bp)
struct buf *
phygetvpbuf(dev_t dev, int resid)
{
- struct bdevsw *bdsw;
+ struct cdevsw *bdsw;
int maxio;
- bdsw = cdevsw[major(dev)]->d_bdev;
- if (bdsw == NULL)
+ bdsw = cdevsw[major(dev)];
+ if ((bdsw == NULL) || (bdsw->d_bmaj == -1))
return getpbuf();
maxio = bdsw->d_maxio;
@@ -207,26 +207,6 @@ phygetvpbuf(dev_t dev, int resid)
return getpbuf();
}
-int
-rawread(dev, uio, ioflag)
- dev_t dev;
- struct uio *uio;
- int ioflag;
-{
- return (physio(cdevsw[major(dev)]->d_strategy, (struct buf *)NULL,
- dev, 1, minphys, uio));
-}
-
-int
-rawwrite(dev, uio, ioflag)
- dev_t dev;
- struct uio *uio;
- int ioflag;
-{
- return (physio(cdevsw[major(dev)]->d_strategy, (struct buf *)NULL,
- dev, 0, minphys, uio));
-}
-
static void
physwakeup(bp)
struct buf *bp;
diff --git a/sys/kern/subr_diskslice.c b/sys/kern/subr_diskslice.c
index c8bca74..9cb7ee2 100644
--- a/sys/kern/subr_diskslice.c
+++ b/sys/kern/subr_diskslice.c
@@ -46,7 +46,7 @@
* from: wd.c,v 1.55 1994/10/22 01:57:12 phk Exp $
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
- * $Id: subr_diskslice.c,v 1.45 1998/04/24 11:50:30 obrien Exp $
+ * $Id: subr_diskslice.c,v 1.46 1998/06/06 03:06:55 bde Exp $
*/
#include "opt_devfs.h"
@@ -596,7 +596,7 @@ dsopen(dname, dev, mode, sspp, lp, strat, setgeom, bdevsw, cdevsw)
struct disklabel *lp;
d_strategy_t *strat;
ds_setgeom_t *setgeom;
- struct bdevsw *bdevsw;
+ struct cdevsw *bdevsw;
struct cdevsw *cdevsw;
{
struct dkbad *btp;
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index 9c33164..1c98823 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -13,7 +13,7 @@
* bad that happens because of using this software isn't the responsibility
* of the author. This software is distributed AS-IS.
*
- * $Id: vfs_aio.c,v 1.28 1998/04/17 22:36:50 des Exp $
+ * $Id: vfs_aio.c,v 1.29 1998/06/10 10:31:08 dfr Exp $
*/
/*
@@ -973,7 +973,7 @@ aio_qphysio(p, aiocbe)
int rw;
d_strategy_t *fstrategy;
struct cdevsw *cdev;
- struct bdevsw *bdev;
+ struct cdevsw *bdev;
cb = &aiocbe->uaiocb;
fdp = p->p_fd;
@@ -1006,10 +1006,11 @@ aio_qphysio(p, aiocbe)
if (cdev == NULL) {
return -1;
}
- bdev = cdev->d_bdev;
- if (bdev == NULL) {
+
+ if (cdev->d_bmaj == -1) {
return -1;
}
+ bdev = cdev;
ki = p->p_aioinfo;
if (ki->kaio_buffer_count >= ki->kaio_ballowed_count) {
diff --git a/sys/miscfs/devfs/devfs_tree.c b/sys/miscfs/devfs/devfs_tree.c
index 0fe76be..ffcb243 100644
--- a/sys/miscfs/devfs/devfs_tree.c
+++ b/sys/miscfs/devfs/devfs_tree.c
@@ -24,7 +24,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: devfs_tree.c,v 1.53 1998/04/20 03:57:35 julian Exp $
+ * $Id: devfs_tree.c,v 1.54 1998/06/21 14:53:20 bde Exp $
*/
@@ -1061,7 +1061,7 @@ devfs_add_devswf(void *devsw, int minor, int chrblk, uid_t uid,
devnm_p new_dev;
dn_p dnp; /* devnode for parent directory */
struct cdevsw *cd;
- struct bdevsw *bd;
+ struct cdevsw *bd;
int retval;
union typeinfo by;
@@ -1106,7 +1106,7 @@ devfs_add_devswf(void *devsw, int minor, int chrblk, uid_t uid,
break;
case DV_BLK:
bd = devsw;
- major = bd->d_maj;
+ major = bd->d_bmaj;
if ( major == -1 ) return NULL;
by.Bdev.bdevsw = bd;
by.Bdev.dev = makedev(major, minor);
diff --git a/sys/miscfs/devfs/devfsdefs.h b/sys/miscfs/devfs/devfsdefs.h
index ef31dd9..cbde81d 100644
--- a/sys/miscfs/devfs/devfsdefs.h
+++ b/sys/miscfs/devfs/devfsdefs.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: devfsdefs.h,v 1.13 1998/01/02 07:31:07 julian Exp $
+ * $Id: devfsdefs.h,v 1.14 1998/04/19 23:32:20 julian Exp $
*/
#ifdef DEVFS_DEBUG
#define DBPRINT(A) printf(A)
@@ -120,7 +120,7 @@ struct devnode /* the equivalent of an INODE */
dev_t dev;
}Cdev;
struct {
- struct bdevsw *bdevsw;
+ struct cdevsw *bdevsw;
dev_t dev;
}Bdev;
struct {
diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c
index a49a106..cb457d1 100644
--- a/sys/miscfs/specfs/spec_vnops.c
+++ b/sys/miscfs/specfs/spec_vnops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
- * $Id: spec_vnops.c,v 1.63 1998/06/07 17:11:59 dfr Exp $
+ * $Id: spec_vnops.c,v 1.64 1998/07/04 20:45:33 julian Exp $
*/
#include <sys/param.h>
@@ -183,9 +183,8 @@ spec_open(ap)
* opens for writing of any disk character devices.
*/
if (securelevel >= 2
- && cdevsw[maj]->d_bdev
- && (cdevsw[maj]->d_bdev->d_flags & D_TYPEMASK) ==
- D_DISK)
+ && cdevsw[maj]->d_bmaj != -1
+ && (cdevsw[maj]->d_flags & D_TYPEMASK) == D_DISK)
return (EPERM);
/*
* When running in secure mode, do not allow opens
diff --git a/sys/pc98/pc98/wfd.c b/sys/pc98/pc98/wfd.c
index e827627..712525f 100644
--- a/sys/pc98/pc98/wfd.c
+++ b/sys/pc98/pc98/wfd.c
@@ -23,7 +23,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: wfd.c,v 1.10 1998/06/07 17:11:06 dfr Exp $
+ * $Id: wfd.c,v 1.11 1998/06/26 18:13:57 phk Exp $
*/
/*
@@ -52,17 +52,22 @@
#include <i386/isa/atapi.h>
-static d_open_t wfdbopen;
-static d_close_t wfdbclose;
+static d_open_t wfdopen;
+static d_read_t wfdread;
+static d_write_t wfdwrite;
+static d_close_t wfdclose;
static d_ioctl_t wfdioctl;
static d_strategy_t wfdstrategy;
#define CDEV_MAJOR 87
#define BDEV_MAJOR 1
-static struct cdevsw wfd_cdevsw;
-static struct bdevsw wfd_bdevsw =
- { wfdbopen, wfdbclose, wfdstrategy, wfdioctl,
- nodump, nopsize, D_DISK, "wfd", &wfd_cdevsw, -1 };
+
+static struct cdevsw wfd_cdevsw = {
+ wfdopen, wfdclose, wfdread, wfdwrite,
+ wfdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, wfdstrategy, "wfd",
+ NULL, -1, nodump, nopsize,
+ D_DISK, 0, -1 };
#ifndef ATAPI_STATIC
static
@@ -251,7 +256,7 @@ wfdattach (struct atapi *ata, int unit, struct atapi_params *ap, int debug)
#ifdef DEVFS
mynor = dkmakeminor(t->lun, WHOLE_DISK_SLICE, RAW_PART);
- t->bdevs = devfs_add_devswf(&wfd_bdevsw, mynor,
+ t->bdevs = devfs_add_devswf(&wfd_cdevsw, mynor,
DV_BLK, UID_ROOT, GID_OPERATOR, 0640,
"wfd%d", t->lun);
t->cdevs = devfs_add_devswf(&wfd_cdevsw, mynor,
@@ -326,7 +331,7 @@ void wfd_describe (struct wfd *t)
}
}
-int wfdbopen (dev_t dev, int flags, int fmt, struct proc *p)
+int wfdopen (dev_t dev, int flags, int fmt, struct proc *p)
{
int lun = UNIT(dev);
struct wfd *t;
@@ -370,7 +375,7 @@ int wfdbopen (dev_t dev, int flags, int fmt, struct proc *p)
/* Initialize slice tables. */
errcode = dsopen("wfd", dev, fmt, &t->dk_slices, &label, wfdstrategy1,
- (ds_setgeom_t *)NULL, &wfd_bdevsw, &wfd_cdevsw);
+ (ds_setgeom_t *)NULL, &wfd_cdevsw, &wfd_cdevsw);
if (errcode != 0)
return errcode;
@@ -382,7 +387,7 @@ int wfdbopen (dev_t dev, int flags, int fmt, struct proc *p)
* Close the device. Only called if we are the LAST
* occurence of an open device.
*/
-int wfdbclose (dev_t dev, int flags, int fmt, struct proc *p)
+int wfdclose (dev_t dev, int flags, int fmt, struct proc *p)
{
int lun = UNIT(dev);
struct wfd *t = wfdtab[lun];
@@ -398,6 +403,18 @@ int wfdbclose (dev_t dev, int flags, int fmt, struct proc *p)
return (0);
}
+static int
+wfdread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(wfdstrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+wfdwrite(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(wfdstrategy, NULL, dev, 0, minphys, uio));
+}
+
static void
wfdstrategy1(struct buf *bp)
{
@@ -746,7 +763,7 @@ static int wfd_eject (struct wfd *t, int closeit)
*/
-MOD_DEV(wfd, LM_DT_BLOCK, BDEV_MAJOR, &wfd_bdevsw);
+MOD_DEV(wfd, LM_DT_BLOCK, BDEV_MAJOR, &wfd_cdevsw);
MOD_DEV(rwfd, LM_DT_CHAR, CDEV_MAJOR, &wfd_cdevsw);
/*
@@ -835,7 +852,7 @@ static wfd_devsw_installed = 0;
static void wfd_drvinit(void *unused)
{
if( ! wfd_devsw_installed ) {
- bdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &wfd_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &wfd_cdevsw);
wfd_devsw_installed = 1;
}
}
diff --git a/sys/pc98/pc98/wst.c b/sys/pc98/pc98/wst.c
index 8cf5c6d..da12c0b 100644
--- a/sys/pc98/pc98/wst.c
+++ b/sys/pc98/pc98/wst.c
@@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: wst.c,v 1.6 1998/06/08 09:47:37 bde Exp $
+ * $Id: wst.c,v 1.7 1998/06/21 18:02:41 bde Exp $
*/
#include "wdc.h"
@@ -49,17 +49,22 @@
#include <i386/isa/atapi.h>
static d_open_t wstopen;
+static d_read_t wstread;
+static d_write_t wstwrite;
static d_close_t wstclose;
static d_ioctl_t wstioctl;
static d_strategy_t wststrategy;
#define CDEV_MAJOR 90
#define BDEV_MAJOR 24
-static struct cdevsw wst_cdevsw;
-static struct bdevsw wst_bdevsw = {
- wstopen, wstclose, wststrategy, wstioctl,
- nodump, nopsize, D_TAPE, "wst", &wst_cdevsw, -1
-};
+
+
+
+static struct cdevsw wst_cdevsw = {
+ wstopen, wstclose, wstread, wstwrite,
+ wstioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, wststrategy, "wst",
+ NULL, -1 };
static int wst_total = 0;
@@ -260,8 +265,6 @@ wstattach(struct atapi *ata, int unit, struct atapi_params *ap, int debug)
wstnlun++;
#ifdef DEVFS
- t->bdevs = devfs_add_devswf(&wst_bdevsw, 0, DV_BLK, UID_ROOT, GID_OPERATOR,
- 0640, "wst%d", t->lun);
t->cdevs = devfs_add_devswf(&wst_cdevsw, 0, DV_CHR, UID_ROOT, GID_OPERATOR,
0640, "rwst%d", t->lun);
#endif /* DEVFS */
@@ -389,6 +392,18 @@ wstclose(dev_t dev, int flags, int fmt, struct proc *p)
return(0);
}
+static int
+wstread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(wststrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+wstwrite(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(wststrategy, NULL, dev, 0, minphys, uio));
+}
+
void
wststrategy(struct buf *bp)
{
@@ -777,7 +792,6 @@ wst_reset(struct wst *t)
#include <sys/sysent.h>
#include <sys/lkm.h>
-MOD_DEV(wst, LM_DT_BLOCK, BDEV_MAJOR, &wst_bdevsw);
MOD_DEV(rwst, LM_DT_CHAR, CDEV_MAJOR, &wst_cdevsw);
int
@@ -853,7 +867,10 @@ static void
wst_drvinit(void *unused)
{
if (!wst_devsw_installed) {
- bdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &wst_bdevsw);
+ dev_t dev;
+
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev, &wst_cdevsw, NULL);
wst_devsw_installed = 1;
}
}
diff --git a/sys/scsi/cd.c b/sys/scsi/cd.c
index b2b5f3f..e21ff11 100644
--- a/sys/scsi/cd.c
+++ b/sys/scsi/cd.c
@@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@tfs.com) Sept 1992
*
- * $Id: cd.c,v 1.93 1998/06/07 17:12:45 dfr Exp $
+ * $Id: cd.c,v 1.94 1998/06/17 14:13:13 bde Exp $
*/
#include "opt_bounce.h"
@@ -65,17 +65,19 @@ static errval cd_read_subchannel __P((u_int32_t, u_int32_t, u_int32_t, int, stru
static errval cd_getdisklabel __P((u_int8_t));
static d_open_t cdopen;
+static d_read_t cdread;
static d_close_t cdclose;
static d_ioctl_t cdioctl;
static d_strategy_t cdstrategy;
#define CDEV_MAJOR 15
#define BDEV_MAJOR 6
-static struct cdevsw cd_cdevsw;
-static struct bdevsw cd_bdevsw =
- { cdopen, cdclose, cdstrategy, cdioctl, /*6*/
- nodump, nopsize, D_DISK, "cd", &cd_cdevsw, -1 };
-
+static struct cdevsw cd_cdevsw = {
+ cdopen, cdclose, cdread, nowrite,
+ cdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, cdstrategy, "cd",
+ NULL, -1, nodump, nopsize,
+ D_DISK, 0, -1 };
static int32_t cdstrats, cdqueues;
@@ -221,10 +223,10 @@ cdattach(struct scsi_link *sc_link)
devfs_add_devswf(&cd_cdevsw, (unit * 8 ) + RAW_PART, DV_CHR,
CD_UID, CD_GID, 0640, "rcd%dc", unit);
cd->a_devfs_token =
- devfs_add_devswf(&cd_bdevsw, unit * 8, DV_BLK, CD_UID,
+ devfs_add_devswf(&cd_cdevsw, unit * 8, DV_BLK, CD_UID,
CD_GID, 0640, "cd%da", unit);
cd->c_devfs_token =
- devfs_add_devswf(&cd_bdevsw, (unit * 8 ) + RAW_PART, DV_BLK,
+ devfs_add_devswf(&cd_cdevsw, (unit * 8 ) + RAW_PART, DV_BLK,
CD_UID, CD_GID, 0640, "cd%dc", unit);
cd->ctl_devfs_token =
devfs_add_devswf(&cd_cdevsw, (unit * 8) | SCSI_CONTROL_MASK,
@@ -391,6 +393,12 @@ cd_close(dev_t dev, int flag, int fmt, struct proc *p,
}
+static int
+cdread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(cdstrategy, NULL, dev, 1, minphys, uio));
+}
+
/*
* Actually translate the requested transfer into one the physical driver can
* understand. The transfer is described by a buf and will include only one
@@ -1491,7 +1499,7 @@ static void cd_drvinit(void *unused)
{
if( ! cd_devsw_installed ) {
- bdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &cd_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &cd_cdevsw);
cd_devsw_installed = 1;
}
}
diff --git a/sys/scsi/od.c b/sys/scsi/od.c
index 082ae07..bd4b834 100644
--- a/sys/scsi/od.c
+++ b/sys/scsi/od.c
@@ -28,7 +28,7 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
- * $Id: od.c,v 1.39 1998/06/07 17:12:48 dfr Exp $
+ * $Id: od.c,v 1.40 1998/06/17 14:13:14 bde Exp $
*/
/*
@@ -137,17 +137,20 @@ static errval od_close __P((dev_t dev, int fflag, int fmt, struct proc *p,
static void od_strategy(struct buf *bp, struct scsi_link *sc_link);
static d_open_t odopen;
+static d_read_t odread;
+static d_write_t odwrite;
static d_close_t odclose;
static d_ioctl_t odioctl;
static d_strategy_t odstrategy;
#define CDEV_MAJOR 70
#define BDEV_MAJOR 20
-static struct cdevsw od_cdevsw;
-static struct bdevsw od_bdevsw =
- { odopen, odclose, odstrategy, odioctl, /*20*/
- nodump, nopsize, D_DISK, "od", &od_cdevsw, -1 };
-
+static struct cdevsw od_cdevsw = {
+ odopen, odclose, odread, odwrite,
+ odioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, odstrategy, "od",
+ NULL, -1, nodump, nopsize,
+ D_DISK, 0, -1 };
/*
* Actually include the interface routines
@@ -253,7 +256,7 @@ odattach(struct scsi_link *sc_link)
#ifdef DEVFS
mynor = dkmakeminor(unit, WHOLE_DISK_SLICE, RAW_PART);
- od->b_devfs_token = devfs_add_devswf(&od_bdevsw, mynor, DV_BLK,
+ od->b_devfs_token = devfs_add_devswf(&od_cdevsw, mynor, DV_BLK,
UID_ROOT, GID_OPERATOR, 0640,
"od%d", unit);
od->c_devfs_token = devfs_add_devswf(&od_cdevsw, mynor, DV_CHR,
@@ -383,7 +386,7 @@ od_open(dev, mode, fmt, p, sc_link)
/* Initialize slice tables. */
errcode = dsopen("od", dev, fmt, &od->dk_slices, &label, odstrategy1,
- (ds_setgeom_t *)NULL, &od_bdevsw, &od_cdevsw);
+ (ds_setgeom_t *)NULL, &od_cdevsw, &od_cdevsw);
if (errcode != 0)
goto bad;
SC_DEBUG(sc_link, SDEV_DB3, ("Slice tables initialized "));
@@ -429,6 +432,18 @@ od_close(dev, fflag, fmt, p, sc_link)
return 0;
}
+static int
+odread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(odstrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+odwrite(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(odstrategy, NULL, dev, 0, minphys, uio));
+}
+
/*
* Actually translate the requested transfer into one the physical driver
* can understand. The transfer is described by a buf and will include
@@ -992,7 +1007,7 @@ static void od_drvinit(void *unused)
{
if( ! od_devsw_installed ) {
- bdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &od_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &od_cdevsw);
od_devsw_installed = 1;
}
}
diff --git a/sys/scsi/pt.c b/sys/scsi/pt.c
index 94cb036..dfa8829 100644
--- a/sys/scsi/pt.c
+++ b/sys/scsi/pt.c
@@ -37,7 +37,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: pt.c,v 1.27 1998/01/24 02:54:49 eivind Exp $
+ * $Id: pt.c,v 1.28 1998/06/17 14:13:14 bde Exp $
*/
#include "opt_bounce.h"
@@ -67,13 +67,15 @@ struct scsi_data {
};
static d_open_t ptopen;
+static d_read_t ptread;
+static d_write_t ptwrite;
static d_close_t ptclose;
static d_ioctl_t ptioctl;
static d_strategy_t ptstrategy;
#define CDEV_MAJOR 61
static struct cdevsw pt_cdevsw =
- { ptopen, ptclose, rawread, rawwrite, /*61*/
+ { ptopen, ptclose, ptread, ptwrite, /*61*/
ptioctl, nostop, nullreset, nodevtotty,/* pt */
seltrue, nommap, ptstrategy, "pt", NULL, -1 };
@@ -215,6 +217,18 @@ ptstart(unit, flags)
} /* go back and see if we can cram more work in.. */
}
+static int
+ptread( dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(ptstrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+ptwrite ( dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(ptstrategy, NULL, dev, 0, minphys, uio));
+}
+
static void
pt_strategy(struct buf *bp, struct scsi_link *sc_link)
{
diff --git a/sys/scsi/sctarg.c b/sys/scsi/sctarg.c
index 6e4d42c..f48792f 100644
--- a/sys/scsi/sctarg.c
+++ b/sys/scsi/sctarg.c
@@ -37,7 +37,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: sctarg.c,v 1.25 1998/06/01 03:44:56 gibbs Exp $
+ * $Id: sctarg.c,v 1.26 1998/06/17 14:13:14 bde Exp $
*/
#include "opt_bounce.h"
@@ -66,13 +66,15 @@ struct scsi_data {
};
static d_open_t sctargopen;
+static d_read_t sctargread;
+static d_write_t sctargwrite;
static d_close_t sctargclose;
static d_ioctl_t sctargioctl;
static d_strategy_t sctargstrategy;
#define CDEV_MAJOR 65
static struct cdevsw sctarg_cdevsw =
- { sctargopen, sctargclose, rawread, rawwrite, /*65*/
+ { sctargopen, sctargclose, sctargread, sctargwrite, /*65*/
sctargioctl, nostop, nullreset, nodevtotty,/* sctarg */
seltrue, nommap, sctargstrategy, "sctarg", NULL, -1 };
@@ -154,6 +156,18 @@ sctarg_open(dev_t dev, int flags, int fmt, struct proc *p,
return ret;
}
+static int
+sctargread( dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(sctargstrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+sctargwrite ( dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(sctargstrategy, NULL, dev, 0, minphys, uio));
+}
+
/*
* sctargstart looks to see if there is a buf waiting for the device
* and that the device is not already busy. If both are true,
diff --git a/sys/scsi/sd.c b/sys/scsi/sd.c
index c872385..32bdcaa 100644
--- a/sys/scsi/sd.c
+++ b/sys/scsi/sd.c
@@ -14,7 +14,7 @@
*
* Ported to run under 386BSD by Julian Elischer (julian@dialix.oz.au) Sept 1992
*
- * $Id: sd.c,v 1.130 1998/06/07 17:12:51 dfr Exp $
+ * $Id: sd.c,v 1.131 1998/06/17 14:13:14 bde Exp $
*/
#include "opt_bounce.h"
@@ -127,6 +127,8 @@ static errval sd_close __P((dev_t dev, int flag, int fmt, struct proc *p,
static void sd_strategy(struct buf *bp, struct scsi_link *sc_link);
static d_open_t sdopen;
+static d_read_t sdread;
+static d_write_t sdwrite;
static d_close_t sdclose;
static d_ioctl_t sdioctl;
static d_dump_t sddump;
@@ -135,10 +137,14 @@ static d_strategy_t sdstrategy;
#define CDEV_MAJOR 13
#define BDEV_MAJOR 4
-static struct cdevsw sd_cdevsw;
-static struct bdevsw sd_bdevsw =
- { sdopen, sdclose, sdstrategy, sdioctl, /*4*/
- sddump, sdsize, D_DISK, "sd", &sd_cdevsw, -1 };
+
+static struct cdevsw sd_cdevsw = {
+ sdopen, sdclose, sdread, sdwrite,
+ sdioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, sdstrategy, "sd",
+ NULL, -1, sddump, sdsize,
+ D_DISK, 0, -1 };
+
#else /* ! SLICE */
static errval sdattach(struct scsi_link *sc_link);
@@ -329,7 +335,7 @@ sdattach(struct scsi_link *sc_link)
config_intrhook_establish(&sd->ich);
#else /* SLICE */
mynor = dkmakeminor(unit, WHOLE_DISK_SLICE, RAW_PART);
- sd->b_devfs_token = devfs_add_devswf(&sd_bdevsw, mynor, DV_BLK,
+ sd->b_devfs_token = devfs_add_devswf(&sd_cdevsw, mynor, DV_BLK,
UID_ROOT, GID_OPERATOR, 0640,
"sd%d", unit);
sd->c_devfs_token = devfs_add_devswf(&sd_cdevsw, mynor, DV_CHR,
@@ -483,7 +489,7 @@ sd_open(dev_t dev, int mode, int fmt, struct proc *p, struct scsi_link *sc_link)
/* Initialize slice tables. */
errcode = dsopen("sd", dev, fmt, &sd->dk_slices, &label, sdstrategy1,
- (ds_setgeom_t *)NULL, &sd_bdevsw, &sd_cdevsw);
+ (ds_setgeom_t *)NULL, &sd_cdevsw, &sd_cdevsw);
if (errcode != 0)
goto close;
#endif /* !SLICE */
@@ -532,6 +538,18 @@ sd_close(dev_t dev,int mode, int fmt, struct proc *p, struct scsi_link *sc_link)
return (0);
}
+static int
+sdread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(sdstrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+sdwrite(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(sdstrategy, NULL, dev, 0, minphys, uio));
+}
+
/*
* Actually translate the requested transfer into one the physical driver
* can understand. The transfer is described by a buf and will include
@@ -1272,7 +1290,7 @@ static void sd_drvinit(void *unused)
{
if( ! sd_devsw_installed ) {
- bdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &sd_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &sd_cdevsw);
sd_devsw_installed = 1;
}
}
diff --git a/sys/scsi/st.c b/sys/scsi/st.c
index 26d7171..20bf63f 100644
--- a/sys/scsi/st.c
+++ b/sys/scsi/st.c
@@ -12,7 +12,7 @@
* on the understanding that TFS is not responsible for the correct
* functioning of this software in any circumstances.
*
- * $Id: st.c,v 1.88 1998/06/07 17:12:52 dfr Exp $
+ * $Id: st.c,v 1.89 1998/06/17 14:13:14 bde Exp $
*/
/*
@@ -153,16 +153,19 @@ static errval st_close(dev_t dev, int flag, int fmt, struct proc *p,
static void st_strategy(struct buf *bp, struct scsi_link *sc_link);
static d_open_t stopen;
+static d_read_t stread;
+static d_write_t stwrite;
static d_close_t stclose;
static d_ioctl_t stioctl;
static d_strategy_t ststrategy;
#define CDEV_MAJOR 14
#define BDEV_MAJOR 5
-static struct cdevsw st_cdevsw;
-static struct bdevsw st_bdevsw =
- { stopen, stclose, ststrategy, stioctl, /*5*/
- nodump, nopsize, D_TAPE, "st", &st_cdevsw, -1 };
+static struct cdevsw st_cdevsw = {
+ stopen, stclose, stread, stwrite,
+ stioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, ststrategy, "st",
+ NULL, -1 };
SCSI_DEVICE_ENTRIES(st)
@@ -749,6 +752,18 @@ done:
return 0;
}
+static int
+stread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(ststrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+stwrite(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(ststrategy, NULL, dev, 0, minphys, uio));
+}
+
/*
* Actually translate the requested transfer into
* one the physical driver can understand
@@ -1959,7 +1974,10 @@ st_drvinit(void *unused)
{
if( ! st_devsw_installed ) {
- bdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &st_bdevsw);
+ dev_t dev;
+
+ dev = makedev(CDEV_MAJOR, 0);
+ cdevsw_add(&dev, &st_cdevsw, NULL);
st_devsw_installed = 1;
}
}
diff --git a/sys/scsi/su.c b/sys/scsi/su.c
index 29ab345..587305a 100644
--- a/sys/scsi/su.c
+++ b/sys/scsi/su.c
@@ -44,7 +44,7 @@
* SUCH DAMAGE.
*End copyright
*
- * $Id: su.c,v 1.18 1997/09/14 03:19:40 peter Exp $
+ * $Id: su.c,v 1.19 1998/06/07 17:12:54 dfr Exp $
*
* Tabstops 4
* XXX devfs entries for this device should be handled by generic scsiconfig
@@ -91,18 +91,6 @@ static struct cdevsw su_cdevsw =
/* bnxio, cnxio: non existent device entries
*/
-static struct bdevsw bnxio = {
- nxopen,
- nxclose,
- nxstrategy,
- nxioctl,
- nxdump,
- nxpsize,
- 0,
- "NON",
- NULL,
- -1
-};
static struct cdevsw cnxio = {
nxopen,
@@ -118,6 +106,11 @@ static struct cdevsw cnxio = {
nxstrategy,
"NON",
NULL,
+ -1,
+ nxdump,
+ nxpsize,
+ 0,
+ 0,
-1
};
@@ -125,15 +118,13 @@ static struct cdevsw cnxio = {
* device.
*/
static int
-getsws(dev_t dev, int type,
- struct bdevsw **bdevp, struct cdevsw **cdevp, dev_t *base)
+getsws(dev_t dev, int type, struct cdevsw **devswpp, dev_t *base)
{
int ret = 0;
struct scsi_link *scsi_link;
int chr_dev, blk_dev;
- struct cdevsw *cdev;
- struct bdevsw *bdev;
+ struct cdevsw *devswp;
int bus = SCSI_BUS(dev),
lun = SCSI_LUN(dev),
@@ -146,13 +137,8 @@ getsws(dev_t dev, int type,
scsi_link->dev == NODEV)
{
ret = ENXIO;
-
- /* XXX This assumes that you always have a character device if you
- * have a block device. That seems reasonable.
- */
- cdev = &cnxio;
+ devswp = &cnxio;
chr_dev = NODEV;
- bdev = &bnxio;
blk_dev = NODEV;
}
else
@@ -160,18 +146,14 @@ getsws(dev_t dev, int type,
int bmaj, cmaj;
cmaj = major(scsi_link->dev);
- cdev = cdevsw[cmaj];
+ devswp = cdevsw[cmaj];
chr_dev = OLD_DEV(dev, scsi_link->dev);
-
- bmaj = chrtoblk(cmaj);
- bdev = (bmaj == NODEV) ? &bnxio : bdevsw[bmaj];
+ bmaj = devswp->d_bmaj;
blk_dev = OLD_DEV(dev, makedev(bmaj, minor(scsi_link->dev)));
}
- if (cdevp)
- *cdevp = cdev;
- if (bdevp)
- *bdevp = bdev;
+ if (devswp)
+ *devswpp = devswp;
if (type == S_IFCHR)
*base = chr_dev;
@@ -184,17 +166,16 @@ getsws(dev_t dev, int type,
int
suopen(dev_t dev, int flag, int type, struct proc *p)
{
- struct cdevsw *cdev;
- struct bdevsw *bdev;
+ struct cdevsw *devswp;
dev_t base;
- if (getsws(dev, type, &bdev, &cdev, &base))
+ if (getsws(dev, type, &devswp, &base))
{
/* Device not configured? Reprobe then try again.
*/
int bus = SCSI_BUS(dev), lun = SCSI_LUN(dev), id = SCSI_ID(dev);
- if (scsi_probe_bus(bus, id, lun) || getsws(dev, type, &bdev, &cdev,
+ if (scsi_probe_bus(bus, id, lun) || getsws(dev, type, &devswp,
&base))
return ENXIO;
}
@@ -202,91 +183,84 @@ suopen(dev_t dev, int flag, int type, struct proc *p)
/* There is a properly configured underlying device.
* Synthesize an appropriate device number:
*/
- if (type == S_IFCHR)
- return (*cdev->d_open)(base, flag, S_IFCHR, p);
- else
- return (*bdev->d_open)(base, flag, S_IFBLK, p);
+ return (*devswp->d_open)(base, flag, type, p);
}
int
suclose(dev_t dev, int fflag, int type, struct proc *p)
{
- struct cdevsw *cdev;
- struct bdevsw *bdev;
+ struct cdevsw *devswp;
dev_t base;
- (void)getsws(dev, type, &bdev, &cdev, &base);
+ (void)getsws(dev, type, &devswp, &base);
- if (type == S_IFCHR)
- return (*cdev->d_close)(base, fflag, S_IFCHR, p);
- else
- return (*bdev->d_open)(base, fflag, S_IFBLK, p);
+ return (*devswp->d_close)(base, fflag, type, p);
}
static void
sustrategy(struct buf *bp)
{
dev_t base;
- struct bdevsw *bdev;
+ struct cdevsw *devswp;
dev_t dev = bp->b_dev;
/* XXX: I have no way of knowing if this was through the
* block or the character entry point.
*/
- (void)getsws(dev, S_IFBLK, &bdev, 0, &base);
+ (void)getsws(dev, S_IFBLK, &devswp, &base);
bp->b_dev = base;
- (*bdev->d_strategy)(bp);
+ (*devswp->d_strategy)(bp);
- bp->b_dev = dev;
+ bp->b_dev = dev; /* strat needs a dev_t */
}
int
suioctl(dev_t dev, u_long cmd, caddr_t data, int fflag, struct proc *p)
{
- struct cdevsw *cdev;
+ struct cdevsw *devswp;
dev_t base;
/* XXX: I have no way of knowing if this was through the
* block or the character entry point.
*/
- (void)getsws(dev, S_IFCHR, 0, &cdev, &base);
+ (void)getsws(dev, S_IFCHR, &devswp, &base);
- return (*cdev->d_ioctl)(base, cmd, data, fflag, p);
+ return (*devswp->d_ioctl)(base, cmd, data, fflag, p);
}
static int
suread(dev_t dev, struct uio *uio, int ioflag)
{
dev_t base;
- struct cdevsw *cdev;
+ struct cdevsw *devswp;
- (void)getsws(dev, S_IFCHR, 0, &cdev, &base);
+ (void)getsws(dev, S_IFCHR, &devswp, &base);
- return (*cdev->d_read)(base, uio, ioflag);
+ return (*devswp->d_read)(base, uio, ioflag);
}
static int
suwrite(dev_t dev, struct uio *uio, int ioflag)
{
dev_t base;
- struct cdevsw *cdev;
+ struct cdevsw *devswp;
- (void)getsws(dev, S_IFCHR, 0, &cdev, &base);
+ (void)getsws(dev, S_IFCHR, &devswp, &base);
- return (*cdev->d_write)(base, uio, ioflag);
+ return (*devswp->d_write)(base, uio, ioflag);
}
static int
supoll(dev_t dev, int events, struct proc *p)
{
dev_t base;
- struct cdevsw *cdev;
+ struct cdevsw *devswp;
- (void)getsws(dev, S_IFCHR, 0, &cdev, &base);
+ (void)getsws(dev, S_IFCHR, &devswp, &base);
- return (*cdev->d_poll)(base, events, p);
+ return (*devswp->d_poll)(base, events, p);
}
static su_devsw_installed = 0;
diff --git a/sys/scsi/worm.c b/sys/scsi/worm.c
index b3046e9..9310a8e 100644
--- a/sys/scsi/worm.c
+++ b/sys/scsi/worm.c
@@ -43,7 +43,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: worm.c,v 1.56 1998/06/07 17:12:54 dfr Exp $
+ * $Id: worm.c,v 1.57 1998/06/17 14:13:15 bde Exp $
*/
#include "opt_bounce.h"
@@ -166,17 +166,21 @@ static errval hp4020i_read_first_writable_address (struct scsi_link *sc_link,
static worm_devsw_installed = 0;
static d_open_t wormopen;
+static d_read_t wormread;
+static d_write_t wormwrite;
static d_close_t wormclose;
static d_ioctl_t wormioctl;
static d_strategy_t wormstrategy;
#define CDEV_MAJOR 62
#define BDEV_MAJOR 23
-static struct cdevsw worm_cdevsw;
-static struct bdevsw worm_bdevsw =
- { wormopen, wormclose, wormstrategy, wormioctl, /*23*/
- nodump, nopsize, D_DISK, "worm", &worm_cdevsw, -1 };
+static struct cdevsw worm_cdevsw = {
+ wormopen, wormclose, wormread, wormwrite,
+ wormioctl, nostop, nullreset, nodevtotty,
+ seltrue, nommap, wormstrategy, "worm",
+ NULL, -1, nodump, nopsize,
+ D_DISK, 0, -1 };
static int
wormunit(dev_t dev)
@@ -279,7 +283,7 @@ wormattach(struct scsi_link *sc_link)
#ifdef DEVFS
mynor = wormunit(sc_link->dev);
worm->b_devfs_token =
- devfs_add_devswf(&worm_bdevsw, mynor,
+ devfs_add_devswf(&worm_cdevsw, mynor,
DV_BLK, 0, 0, 0444, "worm%d", mynor);
worm->c_devfs_token =
devfs_add_devswf(&worm_cdevsw, mynor,
@@ -292,6 +296,18 @@ wormattach(struct scsi_link *sc_link)
return 0;
}
+static int
+wormread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(wormstrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+wormwrite(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(wormstrategy, NULL, dev, 0, minphys, uio));
+}
+
/*
* wormstart looks to see if there is a buf waiting for the device
* and that the device is not already busy. If both are true,
@@ -1075,7 +1091,7 @@ worm_drvinit(void *unused)
{
if (!worm_devsw_installed) {
- bdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &worm_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &worm_cdevsw);
worm_devsw_installed = 1;
}
}
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index 960cd22..0c65dc0 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)conf.h 8.5 (Berkeley) 1/9/95
- * $Id: conf.h,v 1.41 1998/06/17 14:58:04 bde Exp $
+ * $Id: conf.h,v 1.42 1998/06/25 11:27:56 phk Exp $
*/
#ifndef _SYS_CONF_H_
@@ -94,26 +94,6 @@ typedef int l_modem_t __P((struct tty *tp, int flag));
#define D_NOCLUSTERW 0x20000 /* disables cluster write */
#define D_NOCLUSTERRW (D_NOCLUSTERR | D_NOCLUSTERW)
-/*
- * Block device switch table
- */
-struct bdevsw {
- d_open_t *d_open;
- d_close_t *d_close;
- d_strategy_t *d_strategy;
- d_ioctl_t *d_ioctl;
- d_dump_t *d_dump;
- d_psize_t *d_psize;
- u_int d_flags;
- char *d_name; /* name of the driver e.g. audio */
- struct cdevsw *d_cdev; /* cross pointer to the cdev */
- int d_maj; /* the major number we were assigned */
- int d_maxio;
-};
-
-#ifdef KERNEL
-extern struct bdevsw *bdevsw[];
-#endif
/*
* Character device switch table
@@ -131,7 +111,7 @@ struct cdevsw {
d_mmap_t *d_mmap;
d_strategy_t *d_strategy;
char *d_name; /* see above */
- struct bdevsw *d_bdev;
+ void *d_spare;
int d_maj;
d_dump_t *d_dump;
d_psize_t *d_psize;
@@ -141,6 +121,7 @@ struct cdevsw {
};
#ifdef KERNEL
+extern struct cdevsw *bdevsw[];
extern struct cdevsw *cdevsw[];
#endif
@@ -227,9 +208,6 @@ d_ioctl_t nxioctl;
d_dump_t nxdump;
#define nxpsize nopsize /* one NULL value is as good as another */
-d_read_t rawread;
-d_write_t rawwrite;
-
l_read_t l_noread;
l_write_t l_nowrite;
@@ -250,7 +228,7 @@ struct bdevsw_module_data {
void* chainarg; /* arg for next event handler */
int bdev; /* device major to use */
int cdev; /* device major to use */
- struct bdevsw* bdevsw; /* device functions */
+ struct cdevsw* cdevsw; /* device functions */
};
#define CDEV_MODULE(name, major, devsw, evh, arg) \
@@ -283,7 +261,7 @@ int bdevsw_module_handler __P((module_t mod, modeventtype_t what, void* arg));
#endif /* _SYS_MODULE_H_ */
int cdevsw_add __P((dev_t *descrip,struct cdevsw *new,struct cdevsw **old));
-void bdevsw_add_generic __P((int bdev, int cdev, struct bdevsw *bdevsw));
+void cdevsw_add_generic __P((int bdev, int cdev, struct cdevsw *cdevsw));
dev_t chrtoblk __P((dev_t dev));
int iskmemdev __P((dev_t dev));
int iszerodev __P((dev_t dev));
diff --git a/sys/sys/diskslice.h b/sys/sys/diskslice.h
index bf25029..a7cac6c 100644
--- a/sys/sys/diskslice.h
+++ b/sys/sys/diskslice.h
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: diskslice.h,v 1.21 1997/09/16 14:31:44 bde Exp $
+ * $Id: diskslice.h,v 1.22 1998/06/06 02:32:51 bde Exp $
*/
#ifndef _SYS_DISKSLICE_H_
@@ -69,7 +69,7 @@ struct diskslice {
};
struct diskslices {
- struct bdevsw *dss_bdevsw; /* for containing device */
+ struct cdevsw *dss_bdevsw; /* for containing device */
struct cdevsw *dss_cdevsw; /* for containing device */
int dss_first_bsd_slice; /* COMPATIBILITY_SLICE is mapped here */
u_int dss_nslices; /* actual dimension of dss_slices[] */
@@ -100,7 +100,7 @@ char *dsname __P((char *dname, int unit, int slice, int part,
char *partname));
int dsopen __P((char *dname, dev_t dev, int mode, struct diskslices **sspp,
struct disklabel *lp, void (*strat)(struct buf *bp),
- ds_setgeom_t *setgeom, struct bdevsw *bdevsw,
+ ds_setgeom_t *setgeom, struct cdevsw *bdevsw,
struct cdevsw *cdevsw));
int dssize __P((dev_t dev, struct diskslices **sspp,
int (*dopen)(dev_t dev, int oflags, int devtype,
diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h
index 960cd22..0c65dc0 100644
--- a/sys/sys/linedisc.h
+++ b/sys/sys/linedisc.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)conf.h 8.5 (Berkeley) 1/9/95
- * $Id: conf.h,v 1.41 1998/06/17 14:58:04 bde Exp $
+ * $Id: conf.h,v 1.42 1998/06/25 11:27:56 phk Exp $
*/
#ifndef _SYS_CONF_H_
@@ -94,26 +94,6 @@ typedef int l_modem_t __P((struct tty *tp, int flag));
#define D_NOCLUSTERW 0x20000 /* disables cluster write */
#define D_NOCLUSTERRW (D_NOCLUSTERR | D_NOCLUSTERW)
-/*
- * Block device switch table
- */
-struct bdevsw {
- d_open_t *d_open;
- d_close_t *d_close;
- d_strategy_t *d_strategy;
- d_ioctl_t *d_ioctl;
- d_dump_t *d_dump;
- d_psize_t *d_psize;
- u_int d_flags;
- char *d_name; /* name of the driver e.g. audio */
- struct cdevsw *d_cdev; /* cross pointer to the cdev */
- int d_maj; /* the major number we were assigned */
- int d_maxio;
-};
-
-#ifdef KERNEL
-extern struct bdevsw *bdevsw[];
-#endif
/*
* Character device switch table
@@ -131,7 +111,7 @@ struct cdevsw {
d_mmap_t *d_mmap;
d_strategy_t *d_strategy;
char *d_name; /* see above */
- struct bdevsw *d_bdev;
+ void *d_spare;
int d_maj;
d_dump_t *d_dump;
d_psize_t *d_psize;
@@ -141,6 +121,7 @@ struct cdevsw {
};
#ifdef KERNEL
+extern struct cdevsw *bdevsw[];
extern struct cdevsw *cdevsw[];
#endif
@@ -227,9 +208,6 @@ d_ioctl_t nxioctl;
d_dump_t nxdump;
#define nxpsize nopsize /* one NULL value is as good as another */
-d_read_t rawread;
-d_write_t rawwrite;
-
l_read_t l_noread;
l_write_t l_nowrite;
@@ -250,7 +228,7 @@ struct bdevsw_module_data {
void* chainarg; /* arg for next event handler */
int bdev; /* device major to use */
int cdev; /* device major to use */
- struct bdevsw* bdevsw; /* device functions */
+ struct cdevsw* cdevsw; /* device functions */
};
#define CDEV_MODULE(name, major, devsw, evh, arg) \
@@ -283,7 +261,7 @@ int bdevsw_module_handler __P((module_t mod, modeventtype_t what, void* arg));
#endif /* _SYS_MODULE_H_ */
int cdevsw_add __P((dev_t *descrip,struct cdevsw *new,struct cdevsw **old));
-void bdevsw_add_generic __P((int bdev, int cdev, struct bdevsw *bdevsw));
+void cdevsw_add_generic __P((int bdev, int cdev, struct cdevsw *cdevsw));
dev_t chrtoblk __P((dev_t dev));
int iskmemdev __P((dev_t dev));
int iszerodev __P((dev_t dev));
diff --git a/sys/sys/lkm.h b/sys/sys/lkm.h
index bd2675e..8ee6fcc 100644
--- a/sys/sys/lkm.h
+++ b/sys/sys/lkm.h
@@ -34,7 +34,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: lkm.h,v 1.16 1997/04/06 11:14:12 dufault Exp $
+ * $Id: lkm.h,v 1.17 1997/09/16 14:37:55 bde Exp $
*/
#ifndef _SYS_LKM_H_
@@ -104,11 +104,11 @@ struct lkm_dev {
DEVTYPE lkm_devtype;
union {
void *anon;
- struct bdevsw *bdev;
+ struct cdevsw *bdev;
struct cdevsw *cdev;
} lkm_dev;
union {
- struct bdevsw *bdev;
+ struct cdevsw *bdev;
struct cdevsw *cdev;
} lkm_olddev;
};
diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c
index 7e9c6e2..10488d9 100644
--- a/sys/vm/vm_swap.c
+++ b/sys/vm/vm_swap.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)vm_swap.c 8.5 (Berkeley) 2/17/94
- * $Id: vm_swap.c,v 1.54 1998/06/25 11:28:07 phk Exp $
+ * $Id: vm_swap.c,v 1.55 1998/07/04 20:45:42 julian Exp $
*/
#include "opt_devfs.h"
@@ -68,15 +68,19 @@
* provided as a character (raw) device.
*/
-static void swstrategy __P((struct buf *));
+static d_strategy_t swstrategy;
+static d_read_t swread;
+static d_write_t swwrite;
#define CDEV_MAJOR 4
#define BDEV_MAJOR 26
-static struct cdevsw sw_cdevsw;
-static struct bdevsw sw_bdevsw =
- { noopen, noclose, swstrategy, noioc, /*1*/
- nodump, nopsize, 0, "sw", &sw_cdevsw, -1 };
+static struct cdevsw sw_cdevsw =
+ { nullopen, nullclose, swread, swwrite, /*4*/
+ noioc, nostop, noreset, nodevtotty,/* swap */
+ seltrue, nommap, swstrategy, "sw",
+ NULL, -1, nodump, nopsize,
+ 0, 0, -1};
static dev_t swapdev = makedev(BDEV_MAJOR, 0);
@@ -95,6 +99,18 @@ int nswap; /* first block after the interleaved devs */
static int nswdev = NSWAPDEV;
int vm_swap_size;
+static int
+swread(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(swstrategy, NULL, dev, 1, minphys, uio));
+}
+
+static int
+swwrite(dev_t dev, struct uio *uio, int ioflag)
+{
+ return (physio(swstrategy, NULL, dev, 0, minphys, uio));
+}
+
static void
swstrategy(bp)
register struct buf *bp;
@@ -308,7 +324,7 @@ static void sw_drvinit(void *unused)
{
if( ! sw_devsw_installed ) {
- bdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &sw_bdevsw);
+ cdevsw_add_generic(BDEV_MAJOR, CDEV_MAJOR, &sw_cdevsw);
/*
* XXX: This is pretty gross, but it will disappear with
* the blockdevices RSN.
OpenPOWER on IntegriCloud