diff options
author | julian <julian@FreeBSD.org> | 1998-07-04 22:30:26 +0000 |
---|---|---|
committer | julian <julian@FreeBSD.org> | 1998-07-04 22:30:26 +0000 |
commit | 0262543b5f83779b740399f4b8e107618d149997 (patch) | |
tree | 089ad4ebaec66b188dddc6918932d35b7dc8cb70 /sys/i386/isa/wfd.c | |
parent | 29cbc265b1c33cbb4deb6416d04fc45ac6d03869 (diff) | |
download | FreeBSD-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/i386/isa/wfd.c')
-rw-r--r-- | sys/i386/isa/wfd.c | 43 |
1 files changed, 30 insertions, 13 deletions
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; } } |