summaryrefslogtreecommitdiffstats
path: root/sys/scsi/sd.c
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/sd.c
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/sd.c')
-rw-r--r--sys/scsi/sd.c34
1 files changed, 26 insertions, 8 deletions
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;
}
}
OpenPOWER on IntegriCloud