summaryrefslogtreecommitdiffstats
path: root/sys/scsi
diff options
context:
space:
mode:
authorjulian <julian@FreeBSD.org>1998-07-04 22:30:26 +0000
committerjulian <julian@FreeBSD.org>1998-07-04 22:30:26 +0000
commit0262543b5f83779b740399f4b8e107618d149997 (patch)
tree089ad4ebaec66b188dddc6918932d35b7dc8cb70 /sys/scsi
parent29cbc265b1c33cbb4deb6416d04fc45ac6d03869 (diff)
downloadFreeBSD-src-0262543b5f83779b740399f4b8e107618d149997.zip
FreeBSD-src-0262543b5f83779b740399f4b8e107618d149997.tar.gz
There is no such thing any more as "struct bdevsw".
There is only cdevsw (which should be renamed in a later edit to deventry or something). cdevsw contains the union of what were in both bdevsw an cdevsw entries. The bdevsw[] table stiff exists and is a second pointer to the cdevsw entry of the device. it's major is in d_bmaj rather than d_maj. some cleanup still to happen (e.g. dsopen now gets two pointers to the same cdevsw struct instead of one to a bdevsw and one to a cdevsw). rawread()/rawwrite() went away as part of this though it's not strictly the same patch, just that it involves all the same lines in the drivers. cdroms no longer have write() entries (they did have rawwrite (?)). tapes no longer have support for bdev operations. Reviewed by: Eivind Eklund and Mike Smith Changes suggested by eivind.
Diffstat (limited to 'sys/scsi')
-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
8 files changed, 182 insertions, 105 deletions
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;
}
}
OpenPOWER on IntegriCloud