diff options
Diffstat (limited to 'sys/dev')
| -rw-r--r-- | sys/dev/ccd/ccd.c | 30 | ||||
| -rw-r--r-- | sys/dev/fdc/fdc.c | 35 | ||||
| -rw-r--r-- | sys/dev/mcd/mcd.c | 28 | ||||
| -rw-r--r-- | sys/dev/scd/scd.c | 26 | ||||
| -rw-r--r-- | sys/dev/slice/slice_device.c | 40 | ||||
| -rw-r--r-- | sys/dev/vn/vn.c | 32 |
6 files changed, 135 insertions, 56 deletions
diff --git a/sys/dev/ccd/ccd.c b/sys/dev/ccd/ccd.c index 29db7a3b63b4..28f912747c1f 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 47947d1d1264..472fe57a99af 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 1129d94e8c9d..582198fe7030 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 0494a4935cd6..98d2341d4ce0 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 bc9b7c3d4191..c861941328cb 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 b94fa9083186..544782432d4b 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 */ |
