Continue where Julian left off in July 1998:
Virtualize bdevsw[] from cdevsw. bdevsw() is now an (inline) function. Join CDEV_MODULE and BDEV_MODULE to DEV_MODULE (please pay attention to the order of the cmaj/bmaj arguments!) Join CDEV_DRIVER_MODULE and BDEV_DRIVER_MODULE to DEV_DRIVER_MODULE (ditto!) (Next step will be to convert all bdev dev_t's to cdev dev_t's before they get to do any damage^H^H^H^H^H^Hwork in the kernel.)
This commit is contained in:
parent
e994c55884
commit
46eede0058
@ -1,4 +1,4 @@
|
||||
/* $Id: promcons.c,v 1.4 1999/01/30 12:17:22 phk Exp $ */
|
||||
/* $Id: promcons.c,v 1.5 1999/04/27 11:13:22 phk Exp $ */
|
||||
/* $NetBSD: promcons.c,v 1.13 1998/03/21 22:52:59 mycroft Exp $ */
|
||||
|
||||
/*
|
||||
@ -266,6 +266,6 @@ promdevtotty(dev)
|
||||
return &prom_tty[0];
|
||||
}
|
||||
|
||||
CDEV_MODULE(prom, CDEV_MAJOR, prom_cdevsw, 0, 0);
|
||||
DEV_MODULE(prom, CDEV_MAJOR, NODEV, prom_cdevsw, 0, 0);
|
||||
|
||||
#endif /* _PMAP_MAY_USE_PROM_CONSOLE */
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: zs_tlsb.c,v 1.7 1999/01/30 12:17:29 phk Exp $
|
||||
* $Id: zs_tlsb.c,v 1.8 1999/04/27 11:13:45 phk Exp $
|
||||
*/
|
||||
/*
|
||||
* This driver is a hopeless hack to get the SimOS console working. A real
|
||||
@ -375,8 +375,8 @@ zsdevtotty(dev_t dev)
|
||||
return (&sc->tty);
|
||||
}
|
||||
|
||||
CDEV_DRIVER_MODULE(zs, zsc, zs_driver, zs_devclass,
|
||||
CDEV_MAJOR, zs_cdevsw, 0, 0);
|
||||
DEV_DRIVER_MODULE(zs, zsc, zs_driver, zs_devclass,
|
||||
CDEV_MAJOR, NODEV, zs_cdevsw, 0, 0);
|
||||
|
||||
/*
|
||||
* The zsc bus holds two zs devices, one for channel A, one for channel B.
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
|
||||
* $Id: autoconf.c,v 1.114 1999/04/18 15:50:34 peter Exp $
|
||||
* $Id: autoconf.c,v 1.115 1999/05/06 22:16:19 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -153,7 +153,7 @@ find_cdrom_root()
|
||||
if (try_cdrom[j].major >= nblkdev)
|
||||
continue;
|
||||
rootdev = makedev(try_cdrom[j].major, i * 8);
|
||||
bd = bdevsw[major(rootdev)];
|
||||
bd = bdevsw(major(rootdev));
|
||||
if (bd == NULL || bd->d_open == NULL)
|
||||
continue;
|
||||
if (bootverbose)
|
||||
@ -391,11 +391,11 @@ setdumpdev(dev)
|
||||
return (0);
|
||||
}
|
||||
maj = major(dev);
|
||||
if (maj >= nblkdev || bdevsw[maj] == NULL)
|
||||
if (maj >= nblkdev || bdevsw(maj) == NULL)
|
||||
return (ENXIO); /* XXX is this right? */
|
||||
if (bdevsw[maj]->d_psize == NULL)
|
||||
if (bdevsw(maj)->d_psize == NULL)
|
||||
return (ENXIO); /* XXX should be ENODEV ? */
|
||||
psize = bdevsw[maj]->d_psize(dev);
|
||||
psize = bdevsw(maj)->d_psize(dev);
|
||||
if (psize == -1)
|
||||
return (ENXIO); /* XXX should be ENODEV ? */
|
||||
/*
|
||||
@ -434,7 +434,7 @@ setroot()
|
||||
if (boothowto & RB_DFLTROOT || (bootdev & B_MAGICMASK) != B_DEVMAGIC)
|
||||
return;
|
||||
majdev = B_TYPE(bootdev);
|
||||
if (majdev >= nblkdev || bdevsw[majdev] == NULL)
|
||||
if (majdev >= nblkdev || bdevsw(majdev) == NULL)
|
||||
return;
|
||||
unit = B_UNIT(bootdev);
|
||||
slice = B_SLICE(bootdev);
|
||||
@ -458,7 +458,7 @@ setroot()
|
||||
|
||||
newrootdev = makedev(majdev, mindev);
|
||||
rootdevs[0] = newrootdev;
|
||||
sname = dsname(bdevsw[majdev]->d_name, unit, slice, part, partname);
|
||||
sname = dsname(bdevsw(majdev)->d_name, unit, slice, part, partname);
|
||||
rootdevnames[0] = malloc(strlen(sname) + 2, M_DEVBUF, M_NOWAIT);
|
||||
sprintf(rootdevnames[0], "%s%s", sname, partname);
|
||||
|
||||
@ -475,7 +475,7 @@ setroot()
|
||||
return;
|
||||
slice = COMPATIBILITY_SLICE;
|
||||
rootdevs[1] = dkmodslice(newrootdev, slice);
|
||||
sname = dsname(bdevsw[majdev]->d_name, unit, slice, part, partname);
|
||||
sname = dsname(bdevsw(majdev)->d_name, unit, slice, part, partname);
|
||||
rootdevnames[1] = malloc(strlen(sname) + 2, M_DEVBUF, M_NOWAIT);
|
||||
sprintf(rootdevnames[1], "%s%s", sname, partname);
|
||||
}
|
||||
|
@ -20,7 +20,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: psm.c,v 1.4 1999/04/16 21:22:34 peter Exp $
|
||||
* $Id: psm.c,v 1.5 1999/04/18 15:12:11 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -2272,7 +2272,7 @@ psmresume(void *dummy)
|
||||
}
|
||||
#endif /* PSM_HOOKAPM */
|
||||
|
||||
CDEV_DRIVER_MODULE(psm, atkbdc, psm_driver, psm_devclass,
|
||||
CDEV_MAJOR, psm_cdevsw, 0, 0);
|
||||
DEV_DRIVER_MODULE(psm, atkbdc, psm_driver, psm_devclass,
|
||||
CDEV_MAJOR, NODEV, psm_cdevsw, 0, 0);
|
||||
|
||||
#endif /* NPSM > 0 */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: ccd.c,v 1.44 1999/05/06 19:19:30 phk Exp $ */
|
||||
/* $Id: ccd.c,v 1.45 1999/05/07 07:03:17 phk Exp $ */
|
||||
|
||||
/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
|
||||
|
||||
@ -278,7 +278,7 @@ ccd_modevent(mod, type, data)
|
||||
return (error);
|
||||
}
|
||||
|
||||
BDEV_MODULE(ccd, BDEV_MAJOR, CDEV_MAJOR, ccd_cdevsw, ccd_modevent, NULL);
|
||||
DEV_MODULE(ccd, CDEV_MAJOR, BDEV_MAJOR, ccd_cdevsw, ccd_modevent, NULL);
|
||||
|
||||
static int
|
||||
ccdinit(ccd, cpaths, p)
|
||||
|
@ -47,7 +47,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
|
||||
* $Id: fd.c,v 1.138 1999/05/06 20:00:23 phk Exp $
|
||||
* $Id: fd.c,v 1.139 1999/05/07 07:03:24 phk Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -2364,7 +2364,7 @@ static driver_t fd_driver = {
|
||||
sizeof(struct fd_data)
|
||||
};
|
||||
|
||||
BDEV_DRIVER_MODULE(fd, fdc, fd_driver, fd_devclass, BDEV_MAJOR, CDEV_MAJOR,
|
||||
DEV_DRIVER_MODULE(fd, fdc, fd_driver, fd_devclass, CDEV_MAJOR, BDEV_MAJOR,
|
||||
fd_cdevsw, 0, 0);
|
||||
|
||||
#endif /* NFDC > 0 */
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: iic.c,v 1.6 1999/01/09 18:08:24 nsouch Exp $
|
||||
* $Id: iic.c,v 1.7 1999/02/13 18:01:55 nsouch Exp $
|
||||
*
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
@ -277,7 +277,7 @@ iic_drvinit(void *unused)
|
||||
}
|
||||
}
|
||||
|
||||
CDEV_DRIVER_MODULE(iic, iicbus, iic_driver, iic_devclass, CDEV_MAJOR,
|
||||
iic_cdevsw, 0, 0);
|
||||
DEV_DRIVER_MODULE(iic, iicbus, iic_driver, iic_devclass, CDEV_MAJOR,
|
||||
NODEV, iic_cdevsw, 0, 0);
|
||||
|
||||
SYSINIT(iicdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,iic_drvinit,NULL)
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: sio.c,v 1.229 1999/05/06 18:44:35 peter Exp $
|
||||
* $Id: sio.c,v 1.230 1999/05/07 06:50:27 mckusick Exp $
|
||||
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
|
||||
* from: i386/isa sio.c,v 1.234
|
||||
*/
|
||||
@ -3171,5 +3171,5 @@ siopnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev)
|
||||
}
|
||||
#endif
|
||||
|
||||
CDEV_DRIVER_MODULE(sio, isa, sio_driver, sio_devclass,
|
||||
CDEV_MAJOR, sio_cdevsw, 0, 0);
|
||||
DEV_DRIVER_MODULE(sio, isa, sio_driver, sio_devclass,
|
||||
CDEV_MAJOR, NODEV, sio_cdevsw, 0, 0);
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: smb.c,v 1.7 1999/02/13 17:57:19 nsouch Exp $
|
||||
* $Id: smb.c,v 1.8 1999/02/14 14:36:45 nsouch Exp $
|
||||
*
|
||||
*/
|
||||
#include <sys/param.h>
|
||||
@ -270,7 +270,7 @@ smb_drvinit(void *unused)
|
||||
}
|
||||
}
|
||||
|
||||
CDEV_DRIVER_MODULE(smb, smbus, smb_driver, smb_devclass, CDEV_MAJOR,
|
||||
DEV_DRIVER_MODULE(smb, smbus, smb_driver, smb_devclass, CDEV_MAJOR, NODEV,
|
||||
smb_cdevsw, 0, 0);
|
||||
|
||||
SYSINIT(smbdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,smb_drvinit,NULL)
|
||||
|
@ -997,6 +997,6 @@ ugen_detach(device_t self)
|
||||
return 0;
|
||||
}
|
||||
|
||||
CDEV_DRIVER_MODULE(ugen, uhub, ugen_driver, ugen_devclass,
|
||||
UGEN_CDEV_MAJOR, ugen_cdevsw, usbd_driver_load, 0);
|
||||
DEV_DRIVER_MODULE(ugen, uhub, ugen_driver, ugen_devclass,
|
||||
UGEN_CDEV_MAJOR, NODEV, ugen_cdevsw, usbd_driver_load, 0);
|
||||
#endif
|
||||
|
@ -442,6 +442,6 @@ ulpt_detach(device_t self)
|
||||
return 0;
|
||||
}
|
||||
|
||||
CDEV_DRIVER_MODULE(ulpt, uhub, ulpt_driver, ulpt_devclass,
|
||||
ULPT_CDEV_MAJOR, ulpt_cdevsw, usbd_driver_load, 0);
|
||||
DEV_DRIVER_MODULE(ulpt, uhub, ulpt_driver, ulpt_devclass,
|
||||
ULPT_CDEV_MAJOR, NODEV, ulpt_cdevsw, usbd_driver_load, 0);
|
||||
#endif
|
||||
|
@ -795,6 +795,6 @@ ums_ioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct proc *p)
|
||||
#endif
|
||||
|
||||
#if defined(__FreeBSD__)
|
||||
CDEV_DRIVER_MODULE(ums, uhub, ums_driver, ums_devclass,
|
||||
UMS_CDEV_MAJOR, ums_cdevsw, usbd_driver_load, 0);
|
||||
DEV_DRIVER_MODULE(ums, uhub, ums_driver, ums_devclass,
|
||||
UMS_CDEV_MAJOR, NODEV, ums_cdevsw, usbd_driver_load, 0);
|
||||
#endif
|
||||
|
@ -33,7 +33,7 @@
|
||||
* otherwise) arising in any way out of the use of this software, even if
|
||||
* advised of the possibility of such damage.
|
||||
*
|
||||
* $Id: vinum.c,v 1.24 1999/03/19 05:35:25 grog Exp grog $
|
||||
* $Id: vinum.c,v 1.21 1999/05/07 08:07:08 grog Exp $
|
||||
*/
|
||||
|
||||
#define STATIC static /* nothing while we're testing XXX */
|
||||
@ -237,7 +237,6 @@ vinum_modevent(module_t mod, modeventtype_t type, void *unused)
|
||||
}
|
||||
#endif
|
||||
cdevsw[CDEV_MAJOR] = NULL; /* no cdevsw any more */
|
||||
bdevsw[BDEV_MAJOR] = NULL; /* nor bdevsw */
|
||||
log(LOG_INFO, "vinum: unloaded\n"); /* tell the world */
|
||||
return 0;
|
||||
default:
|
||||
|
@ -33,7 +33,7 @@
|
||||
* otherwise) arising in any way out of the use of this software, even if
|
||||
* advised of the possibility of such damage.
|
||||
*
|
||||
* $Id: vinumext.h,v 1.19 1999/03/23 02:57:04 grog Exp grog $
|
||||
* $Id: vinumext.h,v 1.15 1999/05/07 08:07:09 grog Exp $
|
||||
*/
|
||||
|
||||
/* vinumext.h: external definitions */
|
||||
@ -132,8 +132,6 @@ d_strategy_t vinumstrategy;
|
||||
d_ioctl_t vinumioctl;
|
||||
d_dump_t vinumdump;
|
||||
d_psize_t vinumsize;
|
||||
d_read_t physread;
|
||||
d_write_t physwrite;
|
||||
|
||||
int vinumstart(struct buf *bp, int reviveok);
|
||||
int launch_requests(struct request *rq, int reviveok);
|
||||
|
@ -33,7 +33,7 @@
|
||||
* otherwise) arising in any way out of the use of this software, even if
|
||||
* advised of the possibility of such damage.
|
||||
*
|
||||
* $Id: vinumio.c,v 1.24 1999/03/23 02:00:52 grog Exp grog $
|
||||
* $Id: vinumio.c,v 1.23 1999/05/07 01:32:09 grog Exp $
|
||||
*/
|
||||
|
||||
#include <dev/vinum/vinumhdr.h>
|
||||
@ -285,7 +285,7 @@ driveio(struct drive *drive, char *buf, size_t length, off_t offset, int flag)
|
||||
bp->b_bcount = len;
|
||||
bp->b_bufsize = len;
|
||||
|
||||
(*bdevsw[major(bp->b_dev)]->d_strategy) (bp); /* initiate the transfer */
|
||||
(*bdevsw(major(bp->b_dev))->d_strategy) (bp); /* initiate the transfer */
|
||||
|
||||
error = biowait(bp);
|
||||
printf("driveio: %s dev 0x%x, block 0x%x, len 0x%lx, error %d\n", /* XXX */
|
||||
|
@ -33,7 +33,7 @@
|
||||
* otherwise) arising in any way out of the use of this software, even if
|
||||
* advised of the possibility of such damage.
|
||||
*
|
||||
* $Id: vinumrequest.c,v 1.23 1999/03/20 21:58:38 grog Exp grog $
|
||||
* $Id: vinumrequest.c,v 1.21 1999/05/07 08:07:09 grog Exp $
|
||||
*/
|
||||
|
||||
#include <dev/vinum/vinumhdr.h>
|
||||
@ -390,7 +390,7 @@ launch_requests(struct request *rq, int reviveok)
|
||||
logrq(loginfo_rqe, (union rqinfou) rqe, rq->bp);
|
||||
#endif
|
||||
/* fire off the request */
|
||||
(*bdevsw[major(rqe->b.b_dev)]->d_strategy) (&rqe->b);
|
||||
(*bdevsw(major(rqe->b.b_dev))->d_strategy) (&rqe->b);
|
||||
}
|
||||
/* XXX Do we need caching? Think about this more */
|
||||
}
|
||||
@ -865,7 +865,7 @@ sdio(struct buf *bp)
|
||||
sbp->b.b_vp->v_numoutput);
|
||||
#endif
|
||||
s = splbio();
|
||||
(*bdevsw[major(sbp->b.b_dev)]->d_strategy) (&sbp->b);
|
||||
(*bdevsw(major(sbp->b.b_dev))->d_strategy) (&sbp->b);
|
||||
splx(s);
|
||||
}
|
||||
|
||||
|
@ -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.76 1999/04/27 11:14:13 phk Exp $
|
||||
* $Id: vn.c,v 1.77 1999/05/07 07:03:20 phk Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -772,6 +772,6 @@ vn_modevent(module_t mod, int type, void *data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
BDEV_MODULE(vn, BDEV_MAJOR, CDEV_MAJOR, vn_cdevsw, vn_modevent, 0);
|
||||
DEV_MODULE(vn, CDEV_MAJOR, BDEV_MAJOR, vn_cdevsw, vn_modevent, 0);
|
||||
|
||||
#endif
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
|
||||
* $Id: cd9660_vfsops.c,v 1.52 1999/04/18 10:58:02 dcs Exp $
|
||||
* $Id: cd9660_vfsops.c,v 1.53 1999/04/27 11:15:47 phk Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -118,7 +118,7 @@ iso_get_ssector(dev, p)
|
||||
struct cdevsw *bd;
|
||||
d_ioctl_t *ioctlp;
|
||||
|
||||
bd = bdevsw[major(dev)];
|
||||
bd = bdevsw(major(dev));
|
||||
ioctlp = bd->d_ioctl;
|
||||
if (ioctlp == NULL)
|
||||
return 0;
|
||||
@ -189,7 +189,7 @@ cd9660_mount(mp, path, data, ndp, p)
|
||||
struct iso_mnt *imp = 0;
|
||||
|
||||
if ((mp->mnt_flag & MNT_ROOTFS) != 0) {
|
||||
if (bdevsw[major(rootdev)]->d_flags & D_NOCLUSTERR)
|
||||
if (bdevsw(major(rootdev))->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
return (iso_mountroot(mp, p));
|
||||
}
|
||||
@ -206,7 +206,7 @@ cd9660_mount(mp, path, data, ndp, p)
|
||||
*/
|
||||
if (mp->mnt_flag & MNT_UPDATE) {
|
||||
imp = VFSTOISOFS(mp);
|
||||
if (bdevsw[major(imp->im_devvp->v_rdev)]->d_flags &
|
||||
if (bdevsw(major(imp->im_devvp->v_rdev))->d_flags &
|
||||
D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (args.fspec == 0)
|
||||
@ -226,7 +226,7 @@ cd9660_mount(mp, path, data, ndp, p)
|
||||
return ENOTBLK;
|
||||
}
|
||||
if (major(devvp->v_rdev) >= nblkdev ||
|
||||
bdevsw[major(devvp->v_rdev)] == NULL) {
|
||||
bdevsw(major(devvp->v_rdev)) == NULL) {
|
||||
vrele(devvp);
|
||||
return ENXIO;
|
||||
}
|
||||
@ -247,7 +247,7 @@ cd9660_mount(mp, path, data, ndp, p)
|
||||
VOP_UNLOCK(devvp, 0, p);
|
||||
|
||||
if ((mp->mnt_flag & MNT_UPDATE) == 0) {
|
||||
if (bdevsw[major(devvp->v_rdev)]->d_flags & D_NOCLUSTERR)
|
||||
if (bdevsw(major(devvp->v_rdev))->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
error = iso_mountfs(devvp, mp, p, &args);
|
||||
} else {
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: msdosfs_vfsops.c,v 1.41 1999/03/28 23:00:33 dt Exp $ */
|
||||
/* $Id: msdosfs_vfsops.c,v 1.42 1999/05/06 18:12:50 peter Exp $ */
|
||||
/* $NetBSD: msdosfs_vfsops.c,v 1.51 1997/11/17 15:36:58 ws Exp $ */
|
||||
|
||||
/*-
|
||||
@ -299,7 +299,7 @@ msdosfs_mount(mp, path, data, ndp, p)
|
||||
return (ENOTBLK);
|
||||
}
|
||||
if (major(devvp->v_rdev) >= nblkdev ||
|
||||
bdevsw[major(devvp->v_rdev)] == NULL) {
|
||||
bdevsw(major(devvp->v_rdev)) == NULL) {
|
||||
vrele(devvp);
|
||||
return (ENXIO);
|
||||
}
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
|
||||
* $Id: spec_vnops.c,v 1.82 1999/04/05 19:38:30 julian Exp $
|
||||
* $Id: spec_vnops.c,v 1.83 1999/05/06 20:00:27 phk Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -214,7 +214,7 @@ spec_open(ap)
|
||||
case VBLK:
|
||||
if ((u_int)maj >= nblkdev)
|
||||
return (ENXIO);
|
||||
if ( (bdevsw[maj] == NULL) || (bdevsw[maj]->d_open == NULL))
|
||||
if ( (bdevsw(maj) == NULL) || (bdevsw(maj)->d_open == NULL))
|
||||
return ENXIO;
|
||||
/*
|
||||
* When running in very secure mode, do not allow
|
||||
@ -222,7 +222,7 @@ spec_open(ap)
|
||||
*/
|
||||
if (securelevel >= 2 && ap->a_cred != FSCRED &&
|
||||
(ap->a_mode & FWRITE) &&
|
||||
(bdevsw[maj]->d_flags & D_TYPEMASK) == D_DISK)
|
||||
(bdevsw(maj)->d_flags & D_TYPEMASK) == D_DISK)
|
||||
return (EPERM);
|
||||
|
||||
/*
|
||||
@ -232,7 +232,7 @@ spec_open(ap)
|
||||
error = vfs_mountedon(vp);
|
||||
if (error)
|
||||
return (error);
|
||||
return ((*bdevsw[maj]->d_open)(dev, ap->a_mode, S_IFBLK, p));
|
||||
return ((*bdevsw(maj)->d_open)(dev, ap->a_mode, S_IFBLK, p));
|
||||
/* NOT REACHED */
|
||||
default:
|
||||
break;
|
||||
@ -295,7 +295,7 @@ spec_read(ap)
|
||||
|
||||
bsize = vp->v_specinfo->si_bsize_best;
|
||||
|
||||
if ((ioctl = bdevsw[major(dev)]->d_ioctl) != NULL &&
|
||||
if ((ioctl = bdevsw(major(dev))->d_ioctl) != NULL &&
|
||||
(*ioctl)(dev, DIOCGPART, (caddr_t)&dpart, FREAD, p) == 0 &&
|
||||
dpart.part->p_fstype == FS_BSDFFS &&
|
||||
dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
|
||||
@ -379,7 +379,7 @@ spec_write(ap)
|
||||
*/
|
||||
bsize = vp->v_specinfo->si_bsize_best;
|
||||
|
||||
if ((*bdevsw[major(vp->v_rdev)]->d_ioctl)(vp->v_rdev, DIOCGPART,
|
||||
if ((*bdevsw(major(vp->v_rdev))->d_ioctl)(vp->v_rdev, DIOCGPART,
|
||||
(caddr_t)&dpart, FREAD, p) == 0) {
|
||||
if (dpart.part->p_fstype == FS_BSDFFS &&
|
||||
dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
|
||||
@ -437,7 +437,7 @@ spec_ioctl(ap)
|
||||
return ((*cdevsw[major(dev)]->d_ioctl)(dev, ap->a_command,
|
||||
ap->a_data, ap->a_fflag, ap->a_p));
|
||||
case VBLK:
|
||||
return ((*bdevsw[major(dev)]->d_ioctl)(dev, ap->a_command,
|
||||
return ((*bdevsw(major(dev))->d_ioctl)(dev, ap->a_command,
|
||||
ap->a_data, ap->a_fflag, ap->a_p));
|
||||
default:
|
||||
panic("spec_ioctl");
|
||||
@ -553,7 +553,7 @@ spec_strategy(ap)
|
||||
if (((bp->b_flags & B_READ) == 0) &&
|
||||
(LIST_FIRST(&bp->b_dep)) != NULL && bioops.io_start)
|
||||
(*bioops.io_start)(bp);
|
||||
(*bdevsw[major(bp->b_dev)]->d_strategy)(bp);
|
||||
(*bdevsw(major(bp->b_dev))->d_strategy)(bp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -568,7 +568,7 @@ spec_freeblks(ap)
|
||||
struct cdevsw *bsw;
|
||||
struct buf *bp;
|
||||
|
||||
bsw = bdevsw[major(ap->a_vp->v_rdev)];
|
||||
bsw = bdevsw(major(ap->a_vp->v_rdev));
|
||||
if ((bsw->d_flags & D_CANFREE) == 0)
|
||||
return (0);
|
||||
bp = geteblk(ap->a_length);
|
||||
@ -678,7 +678,7 @@ spec_close(ap)
|
||||
if ((vcount(vp) > 1) && (vp->v_flag & VXLOCK) == 0)
|
||||
return (0);
|
||||
|
||||
devclose = bdevsw[major(dev)]->d_close;
|
||||
devclose = bdevsw(major(dev))->d_close;
|
||||
mode = S_IFBLK;
|
||||
break;
|
||||
|
||||
@ -956,7 +956,7 @@ spec_getattr(ap)
|
||||
vap->va_blocksize = MAXBSIZE;
|
||||
}
|
||||
|
||||
if ((*bdevsw[major(vp->v_rdev)]->d_ioctl)(vp->v_rdev, DIOCGPART,
|
||||
if ((*bdevsw(major(vp->v_rdev))->d_ioctl)(vp->v_rdev, DIOCGPART,
|
||||
(caddr_t)&dpart, FREAD, ap->a_p) == 0) {
|
||||
vap->va_bytes = dbtob(dpart.disklab->d_partitions
|
||||
[minor(vp->v_rdev)].p_size);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: ccd.c,v 1.44 1999/05/06 19:19:30 phk Exp $ */
|
||||
/* $Id: ccd.c,v 1.45 1999/05/07 07:03:17 phk Exp $ */
|
||||
|
||||
/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
|
||||
|
||||
@ -278,7 +278,7 @@ ccd_modevent(mod, type, data)
|
||||
return (error);
|
||||
}
|
||||
|
||||
BDEV_MODULE(ccd, BDEV_MAJOR, CDEV_MAJOR, ccd_cdevsw, ccd_modevent, NULL);
|
||||
DEV_MODULE(ccd, CDEV_MAJOR, BDEV_MAJOR, ccd_cdevsw, ccd_modevent, NULL);
|
||||
|
||||
static int
|
||||
ccdinit(ccd, cpaths, p)
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_bmap.c 8.7 (Berkeley) 3/21/95
|
||||
* $Id: ufs_bmap.c,v 1.25 1999/01/28 00:57:55 dillon Exp $
|
||||
* $Id: ufs_bmap.c,v 1.26 1999/05/02 23:57:04 alc Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -151,12 +151,12 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp, runb)
|
||||
|
||||
if (devvp != NULL && devvp->v_tag != VT_MFS &&
|
||||
devvp->v_type == VBLK) {
|
||||
if (bdevsw[major(devvp->v_rdev)]->d_maxio > MAXPHYS) {
|
||||
if (bdevsw(major(devvp->v_rdev))->d_maxio > MAXPHYS) {
|
||||
maxrun = MAXPHYS;
|
||||
vp->v_maxio = MAXPHYS;
|
||||
} else {
|
||||
maxrun = bdevsw[major(devvp->v_rdev)]->d_maxio;
|
||||
vp->v_maxio = bdevsw[major(devvp->v_rdev)]->d_maxio;
|
||||
maxrun = bdevsw(major(devvp->v_rdev))->d_maxio;
|
||||
vp->v_maxio = bdevsw(major(devvp->v_rdev))->d_maxio;
|
||||
}
|
||||
maxrun = maxrun / blksize;
|
||||
maxrun -= 1;
|
||||
|
@ -136,9 +136,9 @@ ext2_mountroot()
|
||||
bzero((char *)mp, (u_long)sizeof(struct mount));
|
||||
mp->mnt_op = &ext2fs_vfsops;
|
||||
mp->mnt_flag = MNT_RDONLY;
|
||||
if (bdevsw[major(rootdev)]->d_flags & D_NOCLUSTERR)
|
||||
if (bdevsw(major(rootdev))->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (bdevsw[major(rootdev)]->d_flags & D_NOCLUSTERW)
|
||||
if (bdevsw(major(rootdev))->d_flags & D_NOCLUSTERW)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
if (error = ext2_mountfs(rootvp, mp, p)) {
|
||||
bsd_free(mp, M_MOUNT);
|
||||
@ -201,9 +201,9 @@ ext2_mount(mp, path, data, ndp, p)
|
||||
ump = VFSTOUFS(mp);
|
||||
fs = ump->um_e2fs;
|
||||
error = 0;
|
||||
if (bdevsw[major(ump->um_dev)]->d_flags & D_NOCLUSTERR)
|
||||
if (bdevsw(major(ump->um_dev))->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (bdevsw[major(ump->um_dev)]->d_flags & D_NOCLUSTERW)
|
||||
if (bdevsw(major(ump->um_dev))->d_flags & D_NOCLUSTERW)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
if (fs->s_rd_only == 0 && (mp->mnt_flag & MNT_RDONLY)) {
|
||||
flags = WRITECLOSE;
|
||||
@ -277,7 +277,7 @@ ext2_mount(mp, path, data, ndp, p)
|
||||
return (ENOTBLK);
|
||||
}
|
||||
if (major(devvp->v_rdev) >= nblkdev ||
|
||||
bdevsw[major(devvp->v_rdev)] == NULL) {
|
||||
bdevsw(major(devvp->v_rdev)) == NULL) {
|
||||
vrele(devvp);
|
||||
return (ENXIO);
|
||||
}
|
||||
@ -299,9 +299,9 @@ ext2_mount(mp, path, data, ndp, p)
|
||||
}
|
||||
|
||||
if ((mp->mnt_flag & MNT_UPDATE) == 0) {
|
||||
if (bdevsw[major(devvp->v_rdev)]->d_flags & D_NOCLUSTERR)
|
||||
if (bdevsw(major(devvp->v_rdev))->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (bdevsw[major(devvp->v_rdev)]->d_flags & D_NOCLUSTERW)
|
||||
if (bdevsw(major(devvp->v_rdev))->d_flags & D_NOCLUSTERW)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
error = ext2_mountfs(devvp, mp, p);
|
||||
} else {
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_bmap.c 8.7 (Berkeley) 3/21/95
|
||||
* $Id: ufs_bmap.c,v 1.25 1999/01/28 00:57:55 dillon Exp $
|
||||
* $Id: ufs_bmap.c,v 1.26 1999/05/02 23:57:04 alc Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -151,12 +151,12 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp, runb)
|
||||
|
||||
if (devvp != NULL && devvp->v_tag != VT_MFS &&
|
||||
devvp->v_type == VBLK) {
|
||||
if (bdevsw[major(devvp->v_rdev)]->d_maxio > MAXPHYS) {
|
||||
if (bdevsw(major(devvp->v_rdev))->d_maxio > MAXPHYS) {
|
||||
maxrun = MAXPHYS;
|
||||
vp->v_maxio = MAXPHYS;
|
||||
} else {
|
||||
maxrun = bdevsw[major(devvp->v_rdev)]->d_maxio;
|
||||
vp->v_maxio = bdevsw[major(devvp->v_rdev)]->d_maxio;
|
||||
maxrun = bdevsw(major(devvp->v_rdev))->d_maxio;
|
||||
vp->v_maxio = bdevsw(major(devvp->v_rdev))->d_maxio;
|
||||
}
|
||||
maxrun = maxrun / blksize;
|
||||
maxrun -= 1;
|
||||
|
@ -136,9 +136,9 @@ ext2_mountroot()
|
||||
bzero((char *)mp, (u_long)sizeof(struct mount));
|
||||
mp->mnt_op = &ext2fs_vfsops;
|
||||
mp->mnt_flag = MNT_RDONLY;
|
||||
if (bdevsw[major(rootdev)]->d_flags & D_NOCLUSTERR)
|
||||
if (bdevsw(major(rootdev))->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (bdevsw[major(rootdev)]->d_flags & D_NOCLUSTERW)
|
||||
if (bdevsw(major(rootdev))->d_flags & D_NOCLUSTERW)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
if (error = ext2_mountfs(rootvp, mp, p)) {
|
||||
bsd_free(mp, M_MOUNT);
|
||||
@ -201,9 +201,9 @@ ext2_mount(mp, path, data, ndp, p)
|
||||
ump = VFSTOUFS(mp);
|
||||
fs = ump->um_e2fs;
|
||||
error = 0;
|
||||
if (bdevsw[major(ump->um_dev)]->d_flags & D_NOCLUSTERR)
|
||||
if (bdevsw(major(ump->um_dev))->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (bdevsw[major(ump->um_dev)]->d_flags & D_NOCLUSTERW)
|
||||
if (bdevsw(major(ump->um_dev))->d_flags & D_NOCLUSTERW)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
if (fs->s_rd_only == 0 && (mp->mnt_flag & MNT_RDONLY)) {
|
||||
flags = WRITECLOSE;
|
||||
@ -277,7 +277,7 @@ ext2_mount(mp, path, data, ndp, p)
|
||||
return (ENOTBLK);
|
||||
}
|
||||
if (major(devvp->v_rdev) >= nblkdev ||
|
||||
bdevsw[major(devvp->v_rdev)] == NULL) {
|
||||
bdevsw(major(devvp->v_rdev)) == NULL) {
|
||||
vrele(devvp);
|
||||
return (ENXIO);
|
||||
}
|
||||
@ -299,9 +299,9 @@ ext2_mount(mp, path, data, ndp, p)
|
||||
}
|
||||
|
||||
if ((mp->mnt_flag & MNT_UPDATE) == 0) {
|
||||
if (bdevsw[major(devvp->v_rdev)]->d_flags & D_NOCLUSTERR)
|
||||
if (bdevsw(major(devvp->v_rdev))->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (bdevsw[major(devvp->v_rdev)]->d_flags & D_NOCLUSTERW)
|
||||
if (bdevsw(major(devvp->v_rdev))->d_flags & D_NOCLUSTERW)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
error = ext2_mountfs(devvp, mp, p);
|
||||
} else {
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
|
||||
*
|
||||
* $Id: apm.c,v 1.80 1999/04/21 07:57:55 imp Exp $
|
||||
* $Id: apm.c,v 1.81 1999/05/06 01:07:03 luoqi Exp $
|
||||
*/
|
||||
|
||||
#include "opt_devfs.h"
|
||||
@ -1065,5 +1065,5 @@ static driver_t apm_driver = {
|
||||
|
||||
static devclass_t apm_devclass;
|
||||
|
||||
CDEV_DRIVER_MODULE(apm, nexus, apm_driver, apm_devclass,
|
||||
CDEV_MAJOR, apm_cdevsw, 0, 0);
|
||||
DEV_DRIVER_MODULE(apm, nexus, apm_driver, apm_devclass,
|
||||
CDEV_MAJOR, NODEV, apm_cdevsw, 0, 0);
|
||||
|
@ -15,7 +15,7 @@
|
||||
*
|
||||
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
|
||||
*
|
||||
* $Id: apm.c,v 1.80 1999/04/21 07:57:55 imp Exp $
|
||||
* $Id: apm.c,v 1.81 1999/05/06 01:07:03 luoqi Exp $
|
||||
*/
|
||||
|
||||
#include "opt_devfs.h"
|
||||
@ -1065,5 +1065,5 @@ static driver_t apm_driver = {
|
||||
|
||||
static devclass_t apm_devclass;
|
||||
|
||||
CDEV_DRIVER_MODULE(apm, nexus, apm_driver, apm_devclass,
|
||||
CDEV_MAJOR, apm_cdevsw, 0, 0);
|
||||
DEV_DRIVER_MODULE(apm, nexus, apm_driver, apm_devclass,
|
||||
CDEV_MAJOR, NODEV, apm_cdevsw, 0, 0);
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
|
||||
* $Id: autoconf.c,v 1.114 1999/04/18 15:50:34 peter Exp $
|
||||
* $Id: autoconf.c,v 1.115 1999/05/06 22:16:19 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -153,7 +153,7 @@ find_cdrom_root()
|
||||
if (try_cdrom[j].major >= nblkdev)
|
||||
continue;
|
||||
rootdev = makedev(try_cdrom[j].major, i * 8);
|
||||
bd = bdevsw[major(rootdev)];
|
||||
bd = bdevsw(major(rootdev));
|
||||
if (bd == NULL || bd->d_open == NULL)
|
||||
continue;
|
||||
if (bootverbose)
|
||||
@ -391,11 +391,11 @@ setdumpdev(dev)
|
||||
return (0);
|
||||
}
|
||||
maj = major(dev);
|
||||
if (maj >= nblkdev || bdevsw[maj] == NULL)
|
||||
if (maj >= nblkdev || bdevsw(maj) == NULL)
|
||||
return (ENXIO); /* XXX is this right? */
|
||||
if (bdevsw[maj]->d_psize == NULL)
|
||||
if (bdevsw(maj)->d_psize == NULL)
|
||||
return (ENXIO); /* XXX should be ENODEV ? */
|
||||
psize = bdevsw[maj]->d_psize(dev);
|
||||
psize = bdevsw(maj)->d_psize(dev);
|
||||
if (psize == -1)
|
||||
return (ENXIO); /* XXX should be ENODEV ? */
|
||||
/*
|
||||
@ -434,7 +434,7 @@ setroot()
|
||||
if (boothowto & RB_DFLTROOT || (bootdev & B_MAGICMASK) != B_DEVMAGIC)
|
||||
return;
|
||||
majdev = B_TYPE(bootdev);
|
||||
if (majdev >= nblkdev || bdevsw[majdev] == NULL)
|
||||
if (majdev >= nblkdev || bdevsw(majdev) == NULL)
|
||||
return;
|
||||
unit = B_UNIT(bootdev);
|
||||
slice = B_SLICE(bootdev);
|
||||
@ -458,7 +458,7 @@ setroot()
|
||||
|
||||
newrootdev = makedev(majdev, mindev);
|
||||
rootdevs[0] = newrootdev;
|
||||
sname = dsname(bdevsw[majdev]->d_name, unit, slice, part, partname);
|
||||
sname = dsname(bdevsw(majdev)->d_name, unit, slice, part, partname);
|
||||
rootdevnames[0] = malloc(strlen(sname) + 2, M_DEVBUF, M_NOWAIT);
|
||||
sprintf(rootdevnames[0], "%s%s", sname, partname);
|
||||
|
||||
@ -475,7 +475,7 @@ setroot()
|
||||
return;
|
||||
slice = COMPATIBILITY_SLICE;
|
||||
rootdevs[1] = dkmodslice(newrootdev, slice);
|
||||
sname = dsname(bdevsw[majdev]->d_name, unit, slice, part, partname);
|
||||
sname = dsname(bdevsw(majdev)->d_name, unit, slice, part, partname);
|
||||
rootdevnames[1] = malloc(strlen(sname) + 2, M_DEVBUF, M_NOWAIT);
|
||||
sprintf(rootdevnames[1], "%s%s", sname, partname);
|
||||
}
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)swapgeneric.c 5.5 (Berkeley) 5/9/91
|
||||
* $Id: swapgeneric.c,v 1.27 1999/04/15 14:52:24 bde Exp $
|
||||
* $Id: swapgeneric.c,v 1.28 1999/04/15 15:35:32 bde Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -73,8 +73,8 @@ retry:
|
||||
unit = *cp - '0';
|
||||
*cp++ = '\0';
|
||||
for (bd = 0; bd < nblkdev; bd++)
|
||||
if (bdevsw[bd] != NULL &&
|
||||
strcmp(bdevsw[bd]->d_name, name) == 0)
|
||||
if (bdevsw(bd) != NULL &&
|
||||
strcmp(bdevsw(bd)->d_name, name) == 0)
|
||||
goto gotit;
|
||||
goto bad;
|
||||
gotit:
|
||||
|
@ -47,7 +47,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
|
||||
* $Id: fd.c,v 1.138 1999/05/06 20:00:23 phk Exp $
|
||||
* $Id: fd.c,v 1.139 1999/05/07 07:03:24 phk Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -2364,7 +2364,7 @@ static driver_t fd_driver = {
|
||||
sizeof(struct fd_data)
|
||||
};
|
||||
|
||||
BDEV_DRIVER_MODULE(fd, fdc, fd_driver, fd_devclass, BDEV_MAJOR, CDEV_MAJOR,
|
||||
DEV_DRIVER_MODULE(fd, fdc, fd_driver, fd_devclass, CDEV_MAJOR, BDEV_MAJOR,
|
||||
fd_cdevsw, 0, 0);
|
||||
|
||||
#endif /* NFDC > 0 */
|
||||
|
@ -47,7 +47,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
|
||||
* $Id: fd.c,v 1.138 1999/05/06 20:00:23 phk Exp $
|
||||
* $Id: fd.c,v 1.139 1999/05/07 07:03:24 phk Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -2364,7 +2364,7 @@ static driver_t fd_driver = {
|
||||
sizeof(struct fd_data)
|
||||
};
|
||||
|
||||
BDEV_DRIVER_MODULE(fd, fdc, fd_driver, fd_devclass, BDEV_MAJOR, CDEV_MAJOR,
|
||||
DEV_DRIVER_MODULE(fd, fdc, fd_driver, fd_devclass, CDEV_MAJOR, BDEV_MAJOR,
|
||||
fd_cdevsw, 0, 0);
|
||||
|
||||
#endif /* NFDC > 0 */
|
||||
|
@ -20,7 +20,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: psm.c,v 1.4 1999/04/16 21:22:34 peter Exp $
|
||||
* $Id: psm.c,v 1.5 1999/04/18 15:12:11 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -2272,7 +2272,7 @@ psmresume(void *dummy)
|
||||
}
|
||||
#endif /* PSM_HOOKAPM */
|
||||
|
||||
CDEV_DRIVER_MODULE(psm, atkbdc, psm_driver, psm_devclass,
|
||||
CDEV_MAJOR, psm_cdevsw, 0, 0);
|
||||
DEV_DRIVER_MODULE(psm, atkbdc, psm_driver, psm_devclass,
|
||||
CDEV_MAJOR, NODEV, psm_cdevsw, 0, 0);
|
||||
|
||||
#endif /* NPSM > 0 */
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: sio.c,v 1.229 1999/05/06 18:44:35 peter Exp $
|
||||
* $Id: sio.c,v 1.230 1999/05/07 06:50:27 mckusick Exp $
|
||||
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
|
||||
* from: i386/isa sio.c,v 1.234
|
||||
*/
|
||||
@ -3171,5 +3171,5 @@ siopnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev)
|
||||
}
|
||||
#endif
|
||||
|
||||
CDEV_DRIVER_MODULE(sio, isa, sio_driver, sio_devclass,
|
||||
CDEV_MAJOR, sio_cdevsw, 0, 0);
|
||||
DEV_DRIVER_MODULE(sio, isa, sio_driver, sio_devclass,
|
||||
CDEV_MAJOR, NODEV, sio_cdevsw, 0, 0);
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
|
||||
* $Id: cd9660_vfsops.c,v 1.52 1999/04/18 10:58:02 dcs Exp $
|
||||
* $Id: cd9660_vfsops.c,v 1.53 1999/04/27 11:15:47 phk Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -118,7 +118,7 @@ iso_get_ssector(dev, p)
|
||||
struct cdevsw *bd;
|
||||
d_ioctl_t *ioctlp;
|
||||
|
||||
bd = bdevsw[major(dev)];
|
||||
bd = bdevsw(major(dev));
|
||||
ioctlp = bd->d_ioctl;
|
||||
if (ioctlp == NULL)
|
||||
return 0;
|
||||
@ -189,7 +189,7 @@ cd9660_mount(mp, path, data, ndp, p)
|
||||
struct iso_mnt *imp = 0;
|
||||
|
||||
if ((mp->mnt_flag & MNT_ROOTFS) != 0) {
|
||||
if (bdevsw[major(rootdev)]->d_flags & D_NOCLUSTERR)
|
||||
if (bdevsw(major(rootdev))->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
return (iso_mountroot(mp, p));
|
||||
}
|
||||
@ -206,7 +206,7 @@ cd9660_mount(mp, path, data, ndp, p)
|
||||
*/
|
||||
if (mp->mnt_flag & MNT_UPDATE) {
|
||||
imp = VFSTOISOFS(mp);
|
||||
if (bdevsw[major(imp->im_devvp->v_rdev)]->d_flags &
|
||||
if (bdevsw(major(imp->im_devvp->v_rdev))->d_flags &
|
||||
D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (args.fspec == 0)
|
||||
@ -226,7 +226,7 @@ cd9660_mount(mp, path, data, ndp, p)
|
||||
return ENOTBLK;
|
||||
}
|
||||
if (major(devvp->v_rdev) >= nblkdev ||
|
||||
bdevsw[major(devvp->v_rdev)] == NULL) {
|
||||
bdevsw(major(devvp->v_rdev)) == NULL) {
|
||||
vrele(devvp);
|
||||
return ENXIO;
|
||||
}
|
||||
@ -247,7 +247,7 @@ cd9660_mount(mp, path, data, ndp, p)
|
||||
VOP_UNLOCK(devvp, 0, p);
|
||||
|
||||
if ((mp->mnt_flag & MNT_UPDATE) == 0) {
|
||||
if (bdevsw[major(devvp->v_rdev)]->d_flags & D_NOCLUSTERR)
|
||||
if (bdevsw(major(devvp->v_rdev))->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
error = iso_mountfs(devvp, mp, p, &args);
|
||||
} else {
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: kern_conf.c,v 1.30 1999/01/27 21:49:55 dillon Exp $
|
||||
* $Id: kern_conf.c,v 1.31 1999/03/23 21:11:47 dfr Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -39,16 +39,15 @@
|
||||
#include <sys/conf.h>
|
||||
#include <sys/vnode.h>
|
||||
|
||||
#define NUMBDEV 128
|
||||
#define NUMCDEV 256
|
||||
#define bdevsw_ALLOCSTART (NUMBDEV/2)
|
||||
#define cdevsw_ALLOCSTART (NUMCDEV/2)
|
||||
|
||||
struct cdevsw *bdevsw[NUMBDEV];
|
||||
int nblkdev = NUMBDEV;
|
||||
struct cdevsw *cdevsw[NUMCDEV];
|
||||
int nchrdev = NUMCDEV;
|
||||
|
||||
int bmaj2cmaj[NUMCDEV];
|
||||
int nblkdev = NUMCDEV;
|
||||
|
||||
/*
|
||||
* Routine to convert from character to block device number.
|
||||
*
|
||||
@ -66,50 +65,6 @@ chrtoblk(dev_t dev)
|
||||
return(NODEV);
|
||||
}
|
||||
|
||||
/*
|
||||
* (re)place an entry in the bdevsw or cdevsw table
|
||||
* return the slot used in major(*descrip)
|
||||
*/
|
||||
static int
|
||||
bdevsw_add(dev_t *descrip,
|
||||
struct cdevsw *newentry,
|
||||
struct cdevsw **oldentry)
|
||||
{
|
||||
int i ;
|
||||
|
||||
if ( (int)*descrip == NODEV) { /* auto (0 is valid) */
|
||||
/*
|
||||
* Search the table looking for a slot...
|
||||
*/
|
||||
for (i = bdevsw_ALLOCSTART; i < nblkdev; i++)
|
||||
if (bdevsw[i] == NULL)
|
||||
break; /* found one! */
|
||||
/* out of allocable slots? */
|
||||
if (i >= nblkdev) {
|
||||
return ENFILE;
|
||||
}
|
||||
} else { /* assign */
|
||||
i = major(*descrip);
|
||||
if (i < 0 || i >= nblkdev) {
|
||||
return EINVAL;
|
||||
}
|
||||
}
|
||||
|
||||
/* maybe save old */
|
||||
if (oldentry) {
|
||||
*oldentry = bdevsw[i];
|
||||
}
|
||||
if (newentry) {
|
||||
newentry->d_bmaj = i;
|
||||
}
|
||||
/* replace with new */
|
||||
bdevsw[i] = newentry;
|
||||
|
||||
/* done! let them know where we put it */
|
||||
*descrip = makedev(i,0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
cdevsw_add(dev_t *descrip,
|
||||
struct cdevsw *newentry,
|
||||
@ -155,55 +110,29 @@ cdevsw_add(dev_t *descrip,
|
||||
* note must call cdevsw_add before bdevsw_add due to d_bmaj hack.
|
||||
*/
|
||||
void
|
||||
cdevsw_add_generic(int bdev, int cdev, struct cdevsw *cdevsw)
|
||||
cdevsw_add_generic(int bmaj, int cmaj, struct cdevsw *cdevsw)
|
||||
{
|
||||
dev_t dev;
|
||||
|
||||
dev = makedev(cdev, 0);
|
||||
dev = makedev(cmaj, 0);
|
||||
cdevsw_add(&dev, cdevsw, NULL);
|
||||
dev = makedev(bdev, 0);
|
||||
bdevsw_add(&dev, cdevsw, NULL);
|
||||
bmaj2cmaj[bmaj] = cmaj;
|
||||
}
|
||||
|
||||
int
|
||||
cdevsw_module_handler(module_t mod, int what, void *arg)
|
||||
devsw_module_handler(module_t mod, int what, void* arg)
|
||||
{
|
||||
struct cdevsw_module_data* data = (struct cdevsw_module_data*) arg;
|
||||
int error;
|
||||
|
||||
switch (what) {
|
||||
case MOD_LOAD:
|
||||
error = cdevsw_add(&data->dev, data->cdevsw, NULL);
|
||||
if (!error && data->chainevh)
|
||||
error = data->chainevh(mod, what, data->chainarg);
|
||||
return error;
|
||||
|
||||
case MOD_UNLOAD:
|
||||
if (data->chainevh) {
|
||||
error = data->chainevh(mod, what, data->chainarg);
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
return cdevsw_add(&data->dev, NULL, NULL);
|
||||
}
|
||||
|
||||
if (data->chainevh)
|
||||
return data->chainevh(mod, what, data->chainarg);
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
bdevsw_module_handler(module_t mod, int what, void* arg)
|
||||
{
|
||||
struct bdevsw_module_data* data = (struct bdevsw_module_data*) arg;
|
||||
struct devsw_module_data* data = (struct devsw_module_data*) arg;
|
||||
int error;
|
||||
|
||||
switch (what) {
|
||||
case MOD_LOAD:
|
||||
error = cdevsw_add(&data->cdev, data->cdevsw, NULL);
|
||||
if (!error)
|
||||
error = bdevsw_add(&data->bdev, data->cdevsw, NULL);
|
||||
if (!error && data->cdevsw->d_strategy != nostrategy) {
|
||||
if (data->bdev == NODEV)
|
||||
data->bdev = data->cdev;
|
||||
bmaj2cmaj[major(data->bdev)] = major(data->cdev);
|
||||
}
|
||||
if (!error && data->chainevh)
|
||||
error = data->chainevh(mod, what, data->chainarg);
|
||||
return error;
|
||||
@ -214,9 +143,9 @@ bdevsw_module_handler(module_t mod, int what, void* arg)
|
||||
if (error)
|
||||
return error;
|
||||
}
|
||||
error = bdevsw_add(&data->bdev, NULL, NULL);
|
||||
if (!error)
|
||||
error = cdevsw_add(&data->cdev, NULL, NULL);
|
||||
if (data->cdevsw->d_strategy != nostrategy)
|
||||
bmaj2cmaj[major(data->bdev)] = 0;
|
||||
error = cdevsw_add(&data->cdev, NULL, NULL);
|
||||
return error;
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94
|
||||
* $Id: kern_shutdown.c,v 1.48 1999/05/03 23:57:22 billf Exp $
|
||||
* $Id: kern_shutdown.c,v 1.49 1999/05/06 18:12:44 peter Exp $
|
||||
*/
|
||||
|
||||
#include "opt_ddb.h"
|
||||
@ -377,14 +377,14 @@ dumpsys(void)
|
||||
return;
|
||||
if (dumpdev == NODEV)
|
||||
return;
|
||||
if (!(bdevsw[major(dumpdev)]))
|
||||
if (!(bdevsw(major(dumpdev))))
|
||||
return;
|
||||
if (!(bdevsw[major(dumpdev)]->d_dump))
|
||||
if (!(bdevsw(major(dumpdev))->d_dump))
|
||||
return;
|
||||
dumpsize = Maxmem;
|
||||
printf("\ndumping to dev %lx, offset %ld\n", (u_long)dumpdev, dumplo);
|
||||
printf("dump ");
|
||||
switch ((*bdevsw[major(dumpdev)]->d_dump)(dumpdev)) {
|
||||
switch ((*bdevsw(major(dumpdev))->d_dump)(dumpdev)) {
|
||||
|
||||
case ENXIO:
|
||||
printf("device bad\n");
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
|
||||
* $Id: vfs_subr.c,v 1.189 1999/03/12 02:24:56 julian Exp $
|
||||
* $Id: vfs_subr.c,v 1.190 1999/05/03 23:57:24 billf Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1177,7 +1177,7 @@ bdevvp(dev, vpp)
|
||||
|
||||
/* XXX 255 is for mfs. */
|
||||
if (dev == NODEV || (major(dev) != 255 && (major(dev) >= nblkdev ||
|
||||
bdevsw[major(dev)] == NULL))) {
|
||||
bdevsw(major(dev)) == NULL))) {
|
||||
*vpp = NULLVP;
|
||||
return (ENXIO);
|
||||
}
|
||||
@ -1275,9 +1275,9 @@ loop:
|
||||
*/
|
||||
|
||||
if (nvp->v_type == VBLK && rmaj < nblkdev) {
|
||||
if (bdevsw[rmaj] && bdevsw[rmaj]->d_parms)
|
||||
if (bdevsw(rmaj) && bdevsw(rmaj)->d_parms)
|
||||
|
||||
(*bdevsw[rmaj]->d_parms)(nvp_rdev, sinfo, DPARM_GET);
|
||||
(*bdevsw(rmaj)->d_parms)(nvp_rdev, sinfo, DPARM_GET);
|
||||
} else if (nvp->v_type == VCHR && rmaj < nchrdev) {
|
||||
if (cdevsw[rmaj] && cdevsw[rmaj]->d_parms)
|
||||
(*cdevsw[rmaj]->d_parms)(nvp_rdev, sinfo, DPARM_GET);
|
||||
@ -2585,7 +2585,7 @@ retry:
|
||||
goto retn;
|
||||
object = vnode_pager_alloc(vp, vat.va_size, 0, 0);
|
||||
} else if (major(vp->v_rdev) < nblkdev &&
|
||||
bdevsw[major(vp->v_rdev)] != NULL) {
|
||||
bdevsw(major(vp->v_rdev)) != NULL) {
|
||||
/*
|
||||
* This simply allocates the biggest object possible
|
||||
* for a VBLK vnode. This should be fixed, but doesn't
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
|
||||
* $Id: vfs_subr.c,v 1.189 1999/03/12 02:24:56 julian Exp $
|
||||
* $Id: vfs_subr.c,v 1.190 1999/05/03 23:57:24 billf Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -1177,7 +1177,7 @@ bdevvp(dev, vpp)
|
||||
|
||||
/* XXX 255 is for mfs. */
|
||||
if (dev == NODEV || (major(dev) != 255 && (major(dev) >= nblkdev ||
|
||||
bdevsw[major(dev)] == NULL))) {
|
||||
bdevsw(major(dev)) == NULL))) {
|
||||
*vpp = NULLVP;
|
||||
return (ENXIO);
|
||||
}
|
||||
@ -1275,9 +1275,9 @@ loop:
|
||||
*/
|
||||
|
||||
if (nvp->v_type == VBLK && rmaj < nblkdev) {
|
||||
if (bdevsw[rmaj] && bdevsw[rmaj]->d_parms)
|
||||
if (bdevsw(rmaj) && bdevsw(rmaj)->d_parms)
|
||||
|
||||
(*bdevsw[rmaj]->d_parms)(nvp_rdev, sinfo, DPARM_GET);
|
||||
(*bdevsw(rmaj)->d_parms)(nvp_rdev, sinfo, DPARM_GET);
|
||||
} else if (nvp->v_type == VCHR && rmaj < nchrdev) {
|
||||
if (cdevsw[rmaj] && cdevsw[rmaj]->d_parms)
|
||||
(*cdevsw[rmaj]->d_parms)(nvp_rdev, sinfo, DPARM_GET);
|
||||
@ -2585,7 +2585,7 @@ retry:
|
||||
goto retn;
|
||||
object = vnode_pager_alloc(vp, vat.va_size, 0, 0);
|
||||
} else if (major(vp->v_rdev) < nblkdev &&
|
||||
bdevsw[major(vp->v_rdev)] != NULL) {
|
||||
bdevsw(major(vp->v_rdev)) != NULL) {
|
||||
/*
|
||||
* This simply allocates the biggest object possible
|
||||
* for a VBLK vnode. This should be fixed, but doesn't
|
||||
|
@ -34,7 +34,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)kernfs_vfsops.c 8.10 (Berkeley) 5/14/95
|
||||
* $Id: kernfs_vfsops.c,v 1.23 1998/09/07 13:17:01 bde Exp $
|
||||
* $Id: kernfs_vfsops.c,v 1.24 1998/12/07 21:58:31 archie Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -88,7 +88,7 @@ kernfs_get_rrootdev()
|
||||
}
|
||||
tried = 1;
|
||||
|
||||
if (!bdevsw[bmaj]) {
|
||||
if (!bdevsw(bmaj)) {
|
||||
panic("root dev has no bdevsw");
|
||||
}
|
||||
if (rootdev == NODEV)
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
|
||||
* $Id: spec_vnops.c,v 1.82 1999/04/05 19:38:30 julian Exp $
|
||||
* $Id: spec_vnops.c,v 1.83 1999/05/06 20:00:27 phk Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -214,7 +214,7 @@ spec_open(ap)
|
||||
case VBLK:
|
||||
if ((u_int)maj >= nblkdev)
|
||||
return (ENXIO);
|
||||
if ( (bdevsw[maj] == NULL) || (bdevsw[maj]->d_open == NULL))
|
||||
if ( (bdevsw(maj) == NULL) || (bdevsw(maj)->d_open == NULL))
|
||||
return ENXIO;
|
||||
/*
|
||||
* When running in very secure mode, do not allow
|
||||
@ -222,7 +222,7 @@ spec_open(ap)
|
||||
*/
|
||||
if (securelevel >= 2 && ap->a_cred != FSCRED &&
|
||||
(ap->a_mode & FWRITE) &&
|
||||
(bdevsw[maj]->d_flags & D_TYPEMASK) == D_DISK)
|
||||
(bdevsw(maj)->d_flags & D_TYPEMASK) == D_DISK)
|
||||
return (EPERM);
|
||||
|
||||
/*
|
||||
@ -232,7 +232,7 @@ spec_open(ap)
|
||||
error = vfs_mountedon(vp);
|
||||
if (error)
|
||||
return (error);
|
||||
return ((*bdevsw[maj]->d_open)(dev, ap->a_mode, S_IFBLK, p));
|
||||
return ((*bdevsw(maj)->d_open)(dev, ap->a_mode, S_IFBLK, p));
|
||||
/* NOT REACHED */
|
||||
default:
|
||||
break;
|
||||
@ -295,7 +295,7 @@ spec_read(ap)
|
||||
|
||||
bsize = vp->v_specinfo->si_bsize_best;
|
||||
|
||||
if ((ioctl = bdevsw[major(dev)]->d_ioctl) != NULL &&
|
||||
if ((ioctl = bdevsw(major(dev))->d_ioctl) != NULL &&
|
||||
(*ioctl)(dev, DIOCGPART, (caddr_t)&dpart, FREAD, p) == 0 &&
|
||||
dpart.part->p_fstype == FS_BSDFFS &&
|
||||
dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
|
||||
@ -379,7 +379,7 @@ spec_write(ap)
|
||||
*/
|
||||
bsize = vp->v_specinfo->si_bsize_best;
|
||||
|
||||
if ((*bdevsw[major(vp->v_rdev)]->d_ioctl)(vp->v_rdev, DIOCGPART,
|
||||
if ((*bdevsw(major(vp->v_rdev))->d_ioctl)(vp->v_rdev, DIOCGPART,
|
||||
(caddr_t)&dpart, FREAD, p) == 0) {
|
||||
if (dpart.part->p_fstype == FS_BSDFFS &&
|
||||
dpart.part->p_frag != 0 && dpart.part->p_fsize != 0)
|
||||
@ -437,7 +437,7 @@ spec_ioctl(ap)
|
||||
return ((*cdevsw[major(dev)]->d_ioctl)(dev, ap->a_command,
|
||||
ap->a_data, ap->a_fflag, ap->a_p));
|
||||
case VBLK:
|
||||
return ((*bdevsw[major(dev)]->d_ioctl)(dev, ap->a_command,
|
||||
return ((*bdevsw(major(dev))->d_ioctl)(dev, ap->a_command,
|
||||
ap->a_data, ap->a_fflag, ap->a_p));
|
||||
default:
|
||||
panic("spec_ioctl");
|
||||
@ -553,7 +553,7 @@ spec_strategy(ap)
|
||||
if (((bp->b_flags & B_READ) == 0) &&
|
||||
(LIST_FIRST(&bp->b_dep)) != NULL && bioops.io_start)
|
||||
(*bioops.io_start)(bp);
|
||||
(*bdevsw[major(bp->b_dev)]->d_strategy)(bp);
|
||||
(*bdevsw(major(bp->b_dev))->d_strategy)(bp);
|
||||
return (0);
|
||||
}
|
||||
|
||||
@ -568,7 +568,7 @@ spec_freeblks(ap)
|
||||
struct cdevsw *bsw;
|
||||
struct buf *bp;
|
||||
|
||||
bsw = bdevsw[major(ap->a_vp->v_rdev)];
|
||||
bsw = bdevsw(major(ap->a_vp->v_rdev));
|
||||
if ((bsw->d_flags & D_CANFREE) == 0)
|
||||
return (0);
|
||||
bp = geteblk(ap->a_length);
|
||||
@ -678,7 +678,7 @@ spec_close(ap)
|
||||
if ((vcount(vp) > 1) && (vp->v_flag & VXLOCK) == 0)
|
||||
return (0);
|
||||
|
||||
devclose = bdevsw[major(dev)]->d_close;
|
||||
devclose = bdevsw(major(dev))->d_close;
|
||||
mode = S_IFBLK;
|
||||
break;
|
||||
|
||||
@ -956,7 +956,7 @@ spec_getattr(ap)
|
||||
vap->va_blocksize = MAXBSIZE;
|
||||
}
|
||||
|
||||
if ((*bdevsw[major(vp->v_rdev)]->d_ioctl)(vp->v_rdev, DIOCGPART,
|
||||
if ((*bdevsw(major(vp->v_rdev))->d_ioctl)(vp->v_rdev, DIOCGPART,
|
||||
(caddr_t)&dpart, FREAD, ap->a_p) == 0) {
|
||||
vap->va_bytes = dbtob(dpart.disklab->d_partitions
|
||||
[minor(vp->v_rdev)].p_size);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $Id: msdosfs_vfsops.c,v 1.41 1999/03/28 23:00:33 dt Exp $ */
|
||||
/* $Id: msdosfs_vfsops.c,v 1.42 1999/05/06 18:12:50 peter Exp $ */
|
||||
/* $NetBSD: msdosfs_vfsops.c,v 1.51 1997/11/17 15:36:58 ws Exp $ */
|
||||
|
||||
/*-
|
||||
@ -299,7 +299,7 @@ msdosfs_mount(mp, path, data, ndp, p)
|
||||
return (ENOTBLK);
|
||||
}
|
||||
if (major(devvp->v_rdev) >= nblkdev ||
|
||||
bdevsw[major(devvp->v_rdev)] == NULL) {
|
||||
bdevsw(major(devvp->v_rdev)) == NULL) {
|
||||
vrele(devvp);
|
||||
return (ENXIO);
|
||||
}
|
||||
|
@ -47,7 +47,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
|
||||
* $Id: fd.c,v 1.57 1999/05/06 20:00:31 phk Exp $
|
||||
* $Id: fd.c,v 1.58 1999/05/07 07:03:42 phk Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -2782,7 +2782,7 @@ static driver_t fd_driver = {
|
||||
sizeof(struct fd_data)
|
||||
};
|
||||
|
||||
BDEV_DRIVER_MODULE(fd, fdc, fd_driver, fd_devclass, BDEV_MAJOR, CDEV_MAJOR,
|
||||
DEV_DRIVER_MODULE(fd, fdc, fd_driver, fd_devclass, CDEV_MAJOR, BDEV_MAJOR,
|
||||
fd_cdevsw, 0, 0);
|
||||
|
||||
#endif /* NFDC > 0 */
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: sio.c,v 1.89 1999/04/27 11:18:01 phk Exp $
|
||||
* $Id: sio.c,v 1.90 1999/05/05 01:53:43 kato Exp $
|
||||
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
|
||||
* from: i386/isa sio.c,v 1.234
|
||||
*/
|
||||
@ -4425,8 +4425,8 @@ siopnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev)
|
||||
}
|
||||
#endif
|
||||
|
||||
CDEV_DRIVER_MODULE(sio, isa, sio_driver, sio_devclass,
|
||||
CDEV_MAJOR, sio_cdevsw, 0, 0);
|
||||
DEV_DRIVER_MODULE(sio, isa, sio_driver, sio_devclass,
|
||||
CDEV_MAJOR, NODEV, sio_cdevsw, 0, 0);
|
||||
|
||||
#ifdef PC98
|
||||
/*
|
||||
|
@ -47,7 +47,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)fd.c 7.4 (Berkeley) 5/25/91
|
||||
* $Id: fd.c,v 1.57 1999/05/06 20:00:31 phk Exp $
|
||||
* $Id: fd.c,v 1.58 1999/05/07 07:03:42 phk Exp $
|
||||
*
|
||||
*/
|
||||
|
||||
@ -2782,7 +2782,7 @@ static driver_t fd_driver = {
|
||||
sizeof(struct fd_data)
|
||||
};
|
||||
|
||||
BDEV_DRIVER_MODULE(fd, fdc, fd_driver, fd_devclass, BDEV_MAJOR, CDEV_MAJOR,
|
||||
DEV_DRIVER_MODULE(fd, fdc, fd_driver, fd_devclass, CDEV_MAJOR, BDEV_MAJOR,
|
||||
fd_cdevsw, 0, 0);
|
||||
|
||||
#endif /* NFDC > 0 */
|
||||
|
@ -30,7 +30,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: sio.c,v 1.89 1999/04/27 11:18:01 phk Exp $
|
||||
* $Id: sio.c,v 1.90 1999/05/05 01:53:43 kato Exp $
|
||||
* from: @(#)com.c 7.5 (Berkeley) 5/16/91
|
||||
* from: i386/isa sio.c,v 1.234
|
||||
*/
|
||||
@ -4425,8 +4425,8 @@ siopnp_attach(u_long csn, u_long vend_id, char *name, struct isa_device *dev)
|
||||
}
|
||||
#endif
|
||||
|
||||
CDEV_DRIVER_MODULE(sio, isa, sio_driver, sio_devclass,
|
||||
CDEV_MAJOR, sio_cdevsw, 0, 0);
|
||||
DEV_DRIVER_MODULE(sio, isa, sio_driver, sio_devclass,
|
||||
CDEV_MAJOR, NODEV, sio_cdevsw, 0, 0);
|
||||
|
||||
#ifdef PC98
|
||||
/*
|
||||
|
@ -23,7 +23,7 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: bus.h,v 1.10 1999/03/29 08:54:19 dfr Exp $
|
||||
* $Id: bus.h,v 1.11 1999/04/16 21:22:54 peter Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_BUS_H_
|
||||
@ -280,25 +280,15 @@ static moduledata_t name##_##busname##_mod = { \
|
||||
DECLARE_MODULE(name##_##busname, name##_##busname##_mod, \
|
||||
SI_SUB_DRIVERS, SI_ORDER_MIDDLE)
|
||||
|
||||
#define CDEV_DRIVER_MODULE(name, busname, driver, devclass, \
|
||||
major, devsw, evh, arg) \
|
||||
#define DEV_DRIVER_MODULE(name, busname, driver, devclass, \
|
||||
cmajor, bmajor, devsw, evh, arg) \
|
||||
\
|
||||
static struct cdevsw_module_data name##_##busname##_cdevsw_mod = { \
|
||||
evh, arg, makedev(major, 0), &devsw \
|
||||
}; \
|
||||
\
|
||||
DRIVER_MODULE(name, busname, driver, devclass, \
|
||||
cdevsw_module_handler, &name##_##busname##_cdevsw_mod)
|
||||
|
||||
#define BDEV_DRIVER_MODULE(name, busname, driver, devclass, \
|
||||
bmajor, cmajor, devsw, evh, arg) \
|
||||
\
|
||||
static struct bdevsw_module_data name##_##busname##_bdevsw_mod = { \
|
||||
static struct devsw_module_data name##_##busname##_devsw_mod = { \
|
||||
evh, arg, makedev(bmajor, 0), makedev(cmajor, 0), &devsw \
|
||||
}; \
|
||||
\
|
||||
DRIVER_MODULE(name, busname, driver, devclass, \
|
||||
bdevsw_module_handler, &name##_##busname##_bdevsw_mod)
|
||||
devsw_module_handler, &name##_##busname##_devsw_mod)
|
||||
|
||||
#endif /* KERNEL */
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)conf.h 8.5 (Berkeley) 1/9/95
|
||||
* $Id: conf.h,v 1.49 1999/01/21 16:15:53 peter Exp $
|
||||
* $Id: conf.h,v 1.50 1999/02/25 05:22:28 dillon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_CONF_H_
|
||||
@ -128,8 +128,19 @@ struct cdevsw {
|
||||
};
|
||||
|
||||
#ifdef KERNEL
|
||||
extern struct cdevsw *bdevsw[];
|
||||
extern struct cdevsw *cdevsw[];
|
||||
extern int bmaj2cmaj[];
|
||||
|
||||
static __inline
|
||||
struct cdevsw *
|
||||
bdevsw(int maj)
|
||||
{
|
||||
struct cdevsw *c = cdevsw[bmaj2cmaj[maj]];
|
||||
/* CMAJ zero is the console, which has no strategy so this works */
|
||||
if (c->d_strategy)
|
||||
return (c);
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -207,14 +218,7 @@ l_write_t l_nowrite;
|
||||
|
||||
struct module;
|
||||
|
||||
struct cdevsw_module_data {
|
||||
int (*chainevh)(struct module *, int, void *); /* next handler */
|
||||
void *chainarg; /* arg for next event handler */
|
||||
dev_t dev; /* device major to use */
|
||||
struct cdevsw *cdevsw; /* device functions */
|
||||
};
|
||||
|
||||
struct bdevsw_module_data {
|
||||
struct devsw_module_data {
|
||||
int (*chainevh)(struct module *, int, void *); /* next handler */
|
||||
void *chainarg; /* arg for next event handler */
|
||||
int bdev; /* device major to use */
|
||||
@ -222,33 +226,20 @@ struct bdevsw_module_data {
|
||||
struct cdevsw *cdevsw; /* device functions */
|
||||
};
|
||||
|
||||
#define CDEV_MODULE(name, major, devsw, evh, arg) \
|
||||
static struct cdevsw_module_data name##_cdevsw_mod = { \
|
||||
evh, arg, major == NODEV ? NODEV : makedev(major, 0), &devsw \
|
||||
#define DEV_MODULE(name, cmaj, bmaj, devsw, evh, arg) \
|
||||
static struct devsw_module_data name##_devsw_mod = { \
|
||||
evh, arg, bmaj == NODEV ? NODEV : makedev(bmaj, 0), \
|
||||
cmaj == NODEV ? NODEV : makedev(cmaj, 0), &devsw \
|
||||
}; \
|
||||
\
|
||||
static moduledata_t name##_mod = { \
|
||||
#name, \
|
||||
cdevsw_module_handler, \
|
||||
&name##_cdevsw_mod \
|
||||
devsw_module_handler, \
|
||||
&name##_devsw_mod \
|
||||
}; \
|
||||
DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+major)
|
||||
DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+cmaj*256+bmaj)
|
||||
|
||||
#define BDEV_MODULE(name, bdev, cdev, devsw, evh, arg) \
|
||||
static struct bdevsw_module_data name##_bdevsw_mod = { \
|
||||
evh, arg, bdev == NODEV ? NODEV : makedev(bdev, 0), \
|
||||
cdev == NODEV ? NODEV : makedev(cdev, 0), &devsw \
|
||||
}; \
|
||||
\
|
||||
static moduledata_t name##_mod = { \
|
||||
#name, \
|
||||
bdevsw_module_handler, \
|
||||
&name##_bdevsw_mod \
|
||||
}; \
|
||||
DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+cdev)
|
||||
|
||||
int cdevsw_module_handler __P((struct module *mod, int what, void *arg));
|
||||
int bdevsw_module_handler __P((struct module *mod, int what, void *arg));
|
||||
int devsw_module_handler __P((struct module *mod, int what, void *arg));
|
||||
|
||||
int cdevsw_add __P((dev_t *descrip,struct cdevsw *new,struct cdevsw **old));
|
||||
void cdevsw_add_generic __P((int bdev, int cdev, struct cdevsw *cdevsw));
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)conf.h 8.5 (Berkeley) 1/9/95
|
||||
* $Id: conf.h,v 1.49 1999/01/21 16:15:53 peter Exp $
|
||||
* $Id: conf.h,v 1.50 1999/02/25 05:22:28 dillon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_CONF_H_
|
||||
@ -128,8 +128,19 @@ struct cdevsw {
|
||||
};
|
||||
|
||||
#ifdef KERNEL
|
||||
extern struct cdevsw *bdevsw[];
|
||||
extern struct cdevsw *cdevsw[];
|
||||
extern int bmaj2cmaj[];
|
||||
|
||||
static __inline
|
||||
struct cdevsw *
|
||||
bdevsw(int maj)
|
||||
{
|
||||
struct cdevsw *c = cdevsw[bmaj2cmaj[maj]];
|
||||
/* CMAJ zero is the console, which has no strategy so this works */
|
||||
if (c->d_strategy)
|
||||
return (c);
|
||||
return (0);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -207,14 +218,7 @@ l_write_t l_nowrite;
|
||||
|
||||
struct module;
|
||||
|
||||
struct cdevsw_module_data {
|
||||
int (*chainevh)(struct module *, int, void *); /* next handler */
|
||||
void *chainarg; /* arg for next event handler */
|
||||
dev_t dev; /* device major to use */
|
||||
struct cdevsw *cdevsw; /* device functions */
|
||||
};
|
||||
|
||||
struct bdevsw_module_data {
|
||||
struct devsw_module_data {
|
||||
int (*chainevh)(struct module *, int, void *); /* next handler */
|
||||
void *chainarg; /* arg for next event handler */
|
||||
int bdev; /* device major to use */
|
||||
@ -222,33 +226,20 @@ struct bdevsw_module_data {
|
||||
struct cdevsw *cdevsw; /* device functions */
|
||||
};
|
||||
|
||||
#define CDEV_MODULE(name, major, devsw, evh, arg) \
|
||||
static struct cdevsw_module_data name##_cdevsw_mod = { \
|
||||
evh, arg, major == NODEV ? NODEV : makedev(major, 0), &devsw \
|
||||
#define DEV_MODULE(name, cmaj, bmaj, devsw, evh, arg) \
|
||||
static struct devsw_module_data name##_devsw_mod = { \
|
||||
evh, arg, bmaj == NODEV ? NODEV : makedev(bmaj, 0), \
|
||||
cmaj == NODEV ? NODEV : makedev(cmaj, 0), &devsw \
|
||||
}; \
|
||||
\
|
||||
static moduledata_t name##_mod = { \
|
||||
#name, \
|
||||
cdevsw_module_handler, \
|
||||
&name##_cdevsw_mod \
|
||||
devsw_module_handler, \
|
||||
&name##_devsw_mod \
|
||||
}; \
|
||||
DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+major)
|
||||
DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+cmaj*256+bmaj)
|
||||
|
||||
#define BDEV_MODULE(name, bdev, cdev, devsw, evh, arg) \
|
||||
static struct bdevsw_module_data name##_bdevsw_mod = { \
|
||||
evh, arg, bdev == NODEV ? NODEV : makedev(bdev, 0), \
|
||||
cdev == NODEV ? NODEV : makedev(cdev, 0), &devsw \
|
||||
}; \
|
||||
\
|
||||
static moduledata_t name##_mod = { \
|
||||
#name, \
|
||||
bdevsw_module_handler, \
|
||||
&name##_bdevsw_mod \
|
||||
}; \
|
||||
DECLARE_MODULE(name, name##_mod, SI_SUB_DRIVERS, SI_ORDER_MIDDLE+cdev)
|
||||
|
||||
int cdevsw_module_handler __P((struct module *mod, int what, void *arg));
|
||||
int bdevsw_module_handler __P((struct module *mod, int what, void *arg));
|
||||
int devsw_module_handler __P((struct module *mod, int what, void *arg));
|
||||
|
||||
int cdevsw_add __P((dev_t *descrip,struct cdevsw *new,struct cdevsw **old));
|
||||
void cdevsw_add_generic __P((int bdev, int cdev, struct cdevsw *cdevsw));
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ffs_vfsops.c 8.31 (Berkeley) 5/20/95
|
||||
* $Id: ffs_vfsops.c,v 1.95 1999/01/07 16:14:17 bde Exp $
|
||||
* $Id: ffs_vfsops.c,v 1.96 1999/01/28 00:57:54 dillon Exp $
|
||||
*/
|
||||
|
||||
#include "opt_quota.h"
|
||||
@ -158,9 +158,9 @@ ffs_mount( mp, path, data, ndp, p)
|
||||
return (err);
|
||||
}
|
||||
|
||||
if (bdevsw[major(rootdev)]->d_flags & D_NOCLUSTERR)
|
||||
if (bdevsw(major(rootdev))->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (bdevsw[major(rootdev)]->d_flags & D_NOCLUSTERW)
|
||||
if (bdevsw(major(rootdev))->d_flags & D_NOCLUSTERW)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
if( ( err = ffs_mountfs(rootvp, mp, p, M_FFSNODE)) != 0) {
|
||||
/* fs specific cleanup (if any)*/
|
||||
@ -194,9 +194,9 @@ ffs_mount( mp, path, data, ndp, p)
|
||||
devvp = ump->um_devvp;
|
||||
err = 0;
|
||||
ronly = fs->fs_ronly; /* MNT_RELOAD might change this */
|
||||
if (bdevsw[major(ump->um_dev)]->d_flags & D_NOCLUSTERR)
|
||||
if (bdevsw(major(ump->um_dev))->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (bdevsw[major(ump->um_dev)]->d_flags & D_NOCLUSTERW)
|
||||
if (bdevsw(major(ump->um_dev))->d_flags & D_NOCLUSTERW)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
if (ronly == 0 && (mp->mnt_flag & MNT_RDONLY)) {
|
||||
flags = WRITECLOSE;
|
||||
@ -291,7 +291,7 @@ ffs_mount( mp, path, data, ndp, p)
|
||||
goto error_2;
|
||||
}
|
||||
if (major(devvp->v_rdev) >= nblkdev ||
|
||||
bdevsw[major(devvp->v_rdev)] == NULL) {
|
||||
bdevsw(major(devvp->v_rdev)) == NULL) {
|
||||
err = ENXIO;
|
||||
goto error_2;
|
||||
}
|
||||
@ -347,9 +347,9 @@ ffs_mount( mp, path, data, ndp, p)
|
||||
********************
|
||||
*/
|
||||
|
||||
if (bdevsw[major(devvp->v_rdev)]->d_flags & D_NOCLUSTERR)
|
||||
if (bdevsw(major(devvp->v_rdev))->d_flags & D_NOCLUSTERR)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERR;
|
||||
if (bdevsw[major(devvp->v_rdev)]->d_flags & D_NOCLUSTERW)
|
||||
if (bdevsw(major(devvp->v_rdev))->d_flags & D_NOCLUSTERW)
|
||||
mp->mnt_flag |= MNT_NOCLUSTERW;
|
||||
|
||||
/*
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)ufs_bmap.c 8.7 (Berkeley) 3/21/95
|
||||
* $Id: ufs_bmap.c,v 1.25 1999/01/28 00:57:55 dillon Exp $
|
||||
* $Id: ufs_bmap.c,v 1.26 1999/05/02 23:57:04 alc Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -151,12 +151,12 @@ ufs_bmaparray(vp, bn, bnp, ap, nump, runp, runb)
|
||||
|
||||
if (devvp != NULL && devvp->v_tag != VT_MFS &&
|
||||
devvp->v_type == VBLK) {
|
||||
if (bdevsw[major(devvp->v_rdev)]->d_maxio > MAXPHYS) {
|
||||
if (bdevsw(major(devvp->v_rdev))->d_maxio > MAXPHYS) {
|
||||
maxrun = MAXPHYS;
|
||||
vp->v_maxio = MAXPHYS;
|
||||
} else {
|
||||
maxrun = bdevsw[major(devvp->v_rdev)]->d_maxio;
|
||||
vp->v_maxio = bdevsw[major(devvp->v_rdev)]->d_maxio;
|
||||
maxrun = bdevsw(major(devvp->v_rdev))->d_maxio;
|
||||
vp->v_maxio = bdevsw(major(devvp->v_rdev))->d_maxio;
|
||||
}
|
||||
maxrun = maxrun / blksize;
|
||||
maxrun -= 1;
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)vm_swap.c 8.5 (Berkeley) 2/17/94
|
||||
* $Id: vm_swap.c,v 1.63 1999/04/28 10:54:24 dt Exp $
|
||||
* $Id: vm_swap.c,v 1.64 1999/05/07 07:03:47 phk Exp $
|
||||
*/
|
||||
|
||||
#include "opt_devfs.h"
|
||||
@ -209,7 +209,7 @@ swapon(p, uap)
|
||||
switch (vp->v_type) {
|
||||
case VBLK:
|
||||
dev = vp->v_rdev;
|
||||
if (major(dev) >= nblkdev || bdevsw[major(dev)] == NULL) {
|
||||
if (major(dev) >= nblkdev || bdevsw(major(dev)) == NULL) {
|
||||
error = ENXIO;
|
||||
break;
|
||||
}
|
||||
@ -281,8 +281,8 @@ swaponvp(p, vp, dev, nblks)
|
||||
if (error)
|
||||
return (error);
|
||||
|
||||
if (nblks == 0 && dev != NODEV && (bdevsw[major(dev)]->d_psize == 0 ||
|
||||
(nblks = (*bdevsw[major(dev)]->d_psize) (dev)) == -1)) {
|
||||
if (nblks == 0 && dev != NODEV && (bdevsw(major(dev))->d_psize == 0 ||
|
||||
(nblks = (*bdevsw(major(dev))->d_psize) (dev)) == -1)) {
|
||||
(void) VOP_CLOSE(vp, FREAD | FWRITE, p->p_ucred, p);
|
||||
return (ENXIO);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user