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/pc98 | |
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/pc98')
-rw-r--r-- | sys/pc98/pc98/wfd.c | 43 | ||||
-rw-r--r-- | sys/pc98/pc98/wst.c | 37 |
2 files changed, 57 insertions, 23 deletions
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; } } |