summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1999-05-08 06:40:31 +0000
committerphk <phk@FreeBSD.org>1999-05-08 06:40:31 +0000
commit500e41bd7127ee03db75cd2a3704b8025c24e345 (patch)
tree8dc80d7dc8cd7f629dab45bcd87aa448cb9a4ca0 /sys
parented809a974db9e6d86dabb993b9b0c6c49e1bbf32 (diff)
downloadFreeBSD-src-500e41bd7127ee03db75cd2a3704b8025c24e345.zip
FreeBSD-src-500e41bd7127ee03db75cd2a3704b8025c24e345.tar.gz
I got tired of seeing all the cdevsw[major(foo)] all over the place.
Made a new (inline) function devsw(dev_t dev) and substituted it. Changed to the BDEV variant to this format as well: bdevsw(dev_t dev) DEVFS will eventually benefit from this change too.
Diffstat (limited to 'sys')
-rw-r--r--sys/alpha/alpha/autoconf.c8
-rw-r--r--sys/alpha/alpha/cons.c14
-rw-r--r--sys/amd64/amd64/autoconf.c4
-rw-r--r--sys/coda/coda_vfsops.c7
-rw-r--r--sys/compat/linux/linux_file.c4
-rw-r--r--sys/dev/snp/snp.c2
-rw-r--r--sys/dev/vinum/vinumio.c4
-rw-r--r--sys/dev/vinum/vinumrequest.c6
-rw-r--r--sys/fs/cd9660/cd9660_vfsops.c12
-rw-r--r--sys/fs/coda/coda_vfsops.c7
-rw-r--r--sys/fs/msdosfs/msdosfs_vfsops.c4
-rw-r--r--sys/fs/specfs/spec_vnops.c45
-rw-r--r--sys/gnu/ext2fs/ext2_bmap.c8
-rw-r--r--sys/gnu/ext2fs/ext2_vfsops.c14
-rw-r--r--sys/gnu/fs/ext2fs/ext2_bmap.c8
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vfsops.c14
-rw-r--r--sys/i386/i386/autoconf.c4
-rw-r--r--sys/i386/i386/cons.c14
-rw-r--r--sys/i386/linux/linux_file.c4
-rw-r--r--sys/isofs/cd9660/cd9660_vfsops.c12
-rw-r--r--sys/kern/kern_conf.c4
-rw-r--r--sys/kern/kern_physio.c10
-rw-r--r--sys/kern/kern_shutdown.c8
-rw-r--r--sys/kern/tty.c12
-rw-r--r--sys/kern/tty_cons.c14
-rw-r--r--sys/kern/tty_pty.c4
-rw-r--r--sys/kern/tty_snoop.c2
-rw-r--r--sys/kern/vfs_aio.c4
-rw-r--r--sys/kern/vfs_export.c14
-rw-r--r--sys/kern/vfs_subr.c14
-rw-r--r--sys/miscfs/kernfs/kernfs_vfsops.c4
-rw-r--r--sys/miscfs/specfs/spec_vnops.c45
-rw-r--r--sys/msdosfs/msdosfs_vfsops.c4
-rw-r--r--sys/net/ppp_tty.c4
-rw-r--r--sys/sys/conf.h13
-rw-r--r--sys/sys/linedisc.h13
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c16
-rw-r--r--sys/ufs/ufs/ufs_bmap.c8
-rw-r--r--sys/vm/device_pager.c6
-rw-r--r--sys/vm/vm_swap.c8
40 files changed, 214 insertions, 188 deletions
diff --git a/sys/alpha/alpha/autoconf.c b/sys/alpha/alpha/autoconf.c
index 0df3c08..ec6de84 100644
--- a/sys/alpha/alpha/autoconf.c
+++ b/sys/alpha/alpha/autoconf.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: autoconf.c,v 1.17 1999/05/03 09:36:26 dfr Exp $
+ * $Id: autoconf.c,v 1.18 1999/05/07 17:48:44 mjacob Exp $
*/
#include "opt_bootp.h"
@@ -296,11 +296,11 @@ setdumpdev(dev)
return (0);
}
maj = major(dev);
- if (maj >= nblkdev || bdevsw(maj) == NULL)
+ if (maj >= nblkdev || bdevsw(dev) == NULL)
return (ENXIO); /* XXX is this right? */
- if (bdevsw(maj)->d_psize == NULL)
+ if (bdevsw(dev)->d_psize == NULL)
return (ENXIO); /* XXX should be ENODEV ? */
- psize = bdevsw(maj)->d_psize(dev);
+ psize = bdevsw(dev)->d_psize(dev);
if (psize == -1)
return (ENXIO); /* XXX should be ENODEV ? */
/*
diff --git a/sys/alpha/alpha/cons.c b/sys/alpha/alpha/cons.c
index 8e934ff..7e6b814 100644
--- a/sys/alpha/alpha/cons.c
+++ b/sys/alpha/alpha/cons.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
- * $Id: cons.c,v 1.4 1999/04/27 11:13:16 phk Exp $
+ * $Id: cons.c,v 1.5 1999/04/27 12:20:52 phk Exp $
*/
#include "opt_devfs.h"
@@ -168,7 +168,7 @@ cninit_finish()
/*
* Hook the open and close functions.
*/
- cdp = cdevsw[major(cn_tab->cn_dev)];
+ cdp = devsw(cn_tab->cn_dev);
cn_phys_close = cdp->d_close;
cdp->d_close = cnclose;
cn_phys_open = cdp->d_open;
@@ -188,7 +188,7 @@ cnuninit(void)
/*
* Unhook the open and close functions.
*/
- cdp = cdevsw[major(cn_tab->cn_dev)];
+ cdp = devsw(cn_tab->cn_dev);
cdp->d_close = cn_phys_close;
cn_phys_close = NULL;
cdp->d_open = cn_phys_open;
@@ -331,7 +331,7 @@ cnread(dev, uio, flag)
if ((cn_tab == NULL) || cn_mute)
return (0);
dev = cn_tab->cn_dev;
- return ((*cdevsw[major(dev)]->d_read)(dev, uio, flag));
+ return ((*devsw(dev)->d_read)(dev, uio, flag));
}
static int
@@ -348,7 +348,7 @@ cnwrite(dev, uio, flag)
dev = constty->t_dev;
else
dev = cn_tab->cn_dev;
- return ((*cdevsw[major(dev)]->d_write)(dev, uio, flag));
+ return ((*devsw(dev)->d_write)(dev, uio, flag));
}
static int
@@ -375,7 +375,7 @@ cnioctl(dev, cmd, data, flag, p)
return (0);
}
dev = cn_tab->cn_dev;
- return ((*cdevsw[major(dev)]->d_ioctl)(dev, cmd, data, flag, p));
+ return ((*devsw(dev)->d_ioctl)(dev, cmd, data, flag, p));
}
static int
@@ -389,7 +389,7 @@ cnpoll(dev, events, p)
dev = cn_tab->cn_dev;
- return ((*cdevsw[major(dev)]->d_poll)(dev, events, p));
+ return ((*devsw(dev)->d_poll)(dev, events, p));
}
int
diff --git a/sys/amd64/amd64/autoconf.c b/sys/amd64/amd64/autoconf.c
index 7ecf9e8..82414fe 100644
--- a/sys/amd64/amd64/autoconf.c
+++ b/sys/amd64/amd64/autoconf.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
- * $Id: autoconf.c,v 1.115 1999/05/06 22:16:19 peter Exp $
+ * $Id: autoconf.c,v 1.116 1999/05/07 10:10:21 phk 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(rootdev);
if (bd == NULL || bd->d_open == NULL)
continue;
if (bootverbose)
diff --git a/sys/coda/coda_vfsops.c b/sys/coda/coda_vfsops.c
index 8f6befe..3af2ad2 100644
--- a/sys/coda/coda_vfsops.c
+++ b/sys/coda/coda_vfsops.c
@@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance.
*
* @(#) src/sys/cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- * $Id: coda_vfsops.c,v 1.10 1998/12/04 22:54:43 archie Exp $
+ * $Id: coda_vfsops.c,v 1.11 1999/01/17 20:25:17 peter Exp $
*
*/
@@ -47,6 +47,9 @@
/*
* HISTORY
* $Log: coda_vfsops.c,v $
+ * Revision 1.11 1999/01/17 20:25:17 peter
+ * Clean up the KLD/LKM goop a bit.
+ *
* Revision 1.10 1998/12/04 22:54:43 archie
* Examine all occurrences of sprintf(), strcat(), and str[n]cpy()
* for possible buffer overflow problems. Replaced most sprintf()'s
@@ -337,7 +340,7 @@ coda_mount(vfsp, path, data, ndp, p)
/*
* See if the device table matches our expectations.
*/
- if (cdevsw[major(dev)]->d_open != vc_nb_open)
+ if (devsw(dev)->d_open != vc_nb_open)
{
MARK_INT_FAIL(CODA_MOUNT_STATS);
return(ENXIO);
diff --git a/sys/compat/linux/linux_file.c b/sys/compat/linux/linux_file.c
index 907e6b8..e357e15 100644
--- a/sys/compat/linux/linux_file.c
+++ b/sys/compat/linux/linux_file.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: linux_file.c,v 1.23 1999/01/10 23:15:35 eivind Exp $
+ * $Id: linux_file.c,v 1.24 1999/05/06 18:44:20 peter Exp $
*/
#include "opt_compat.h"
@@ -306,7 +306,7 @@ linux_fcntl(struct proc *p, struct linux_fcntl_args *args)
if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p)))
return error;
- d_tty = cdevsw[major(va.va_rdev)]->d_devtotty;
+ d_tty = devsw(va.va_rdev)->d_devtotty;
if (!d_tty || (!(tp = (*d_tty)(va.va_rdev))))
return EINVAL;
if (args->cmd == LINUX_F_GETOWN) {
diff --git a/sys/dev/snp/snp.c b/sys/dev/snp/snp.c
index ebffb2a..204088c 100644
--- a/sys/dev/snp/snp.c
+++ b/sys/dev/snp/snp.c
@@ -71,7 +71,7 @@ snpdevtotty (dev)
maj = major(dev);
if ((u_int)maj >= nchrdev)
return (NULL);
- cdp = cdevsw[maj];
+ cdp = devsw(dev);
if (cdp == NULL)
return (NULL);
return ((*cdp->d_devtotty)(dev));
diff --git a/sys/dev/vinum/vinumio.c b/sys/dev/vinum/vinumio.c
index 2651205..9faf767 100644
--- a/sys/dev/vinum/vinumio.c
+++ b/sys/dev/vinum/vinumio.c
@@ -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.23 1999/05/07 01:32:09 grog Exp $
+ * $Id: vinumio.c,v 1.24 1999/05/07 10:10:04 phk 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(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 */
diff --git a/sys/dev/vinum/vinumrequest.c b/sys/dev/vinum/vinumrequest.c
index 477ec40..a05c6e6 100644
--- a/sys/dev/vinum/vinumrequest.c
+++ b/sys/dev/vinum/vinumrequest.c
@@ -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.21 1999/05/07 08:07:09 grog Exp $
+ * $Id: vinumrequest.c,v 1.22 1999/05/07 10:10:07 phk 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(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(sbp->b.b_dev)->d_strategy) (&sbp->b);
splx(s);
}
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c
index d10f49c..1de8b40 100644
--- a/sys/fs/cd9660/cd9660_vfsops.c
+++ b/sys/fs/cd9660/cd9660_vfsops.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
- * $Id: cd9660_vfsops.c,v 1.53 1999/04/27 11:15:47 phk Exp $
+ * $Id: cd9660_vfsops.c,v 1.54 1999/05/07 10:10:46 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(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(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(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(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(devvp->v_rdev)->d_flags & D_NOCLUSTERR)
mp->mnt_flag |= MNT_NOCLUSTERR;
error = iso_mountfs(devvp, mp, p, &args);
} else {
diff --git a/sys/fs/coda/coda_vfsops.c b/sys/fs/coda/coda_vfsops.c
index 8f6befe..3af2ad2 100644
--- a/sys/fs/coda/coda_vfsops.c
+++ b/sys/fs/coda/coda_vfsops.c
@@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance.
*
* @(#) src/sys/cfs/coda_vfsops.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
- * $Id: coda_vfsops.c,v 1.10 1998/12/04 22:54:43 archie Exp $
+ * $Id: coda_vfsops.c,v 1.11 1999/01/17 20:25:17 peter Exp $
*
*/
@@ -47,6 +47,9 @@
/*
* HISTORY
* $Log: coda_vfsops.c,v $
+ * Revision 1.11 1999/01/17 20:25:17 peter
+ * Clean up the KLD/LKM goop a bit.
+ *
* Revision 1.10 1998/12/04 22:54:43 archie
* Examine all occurrences of sprintf(), strcat(), and str[n]cpy()
* for possible buffer overflow problems. Replaced most sprintf()'s
@@ -337,7 +340,7 @@ coda_mount(vfsp, path, data, ndp, p)
/*
* See if the device table matches our expectations.
*/
- if (cdevsw[major(dev)]->d_open != vc_nb_open)
+ if (devsw(dev)->d_open != vc_nb_open)
{
MARK_INT_FAIL(CODA_MOUNT_STATS);
return(ENXIO);
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index c062519..35c4cb2 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_vfsops.c,v 1.42 1999/05/06 18:12:50 peter Exp $ */
+/* $Id: msdosfs_vfsops.c,v 1.43 1999/05/07 10:11:10 phk 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(devvp->v_rdev) == NULL) {
vrele(devvp);
return (ENXIO);
}
diff --git a/sys/fs/specfs/spec_vnops.c b/sys/fs/specfs/spec_vnops.c
index 63f2b36..74c30c7 100644
--- a/sys/fs/specfs/spec_vnops.c
+++ b/sys/fs/specfs/spec_vnops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
- * $Id: spec_vnops.c,v 1.83 1999/05/06 20:00:27 phk Exp $
+ * $Id: spec_vnops.c,v 1.84 1999/05/07 10:11:05 phk Exp $
*/
#include <sys/param.h>
@@ -165,6 +165,7 @@ spec_open(ap)
dev_t bdev, dev = (dev_t)vp->v_rdev;
int maj = major(dev);
int error;
+ struct cdevsw *dsw;
/*
* Don't allow open if fs is mounted -nodev.
@@ -177,7 +178,8 @@ spec_open(ap)
case VCHR:
if ((u_int)maj >= nchrdev)
return (ENXIO);
- if ( (cdevsw[maj] == NULL) || (cdevsw[maj]->d_open == NULL))
+ dsw = devsw(dev);
+ if ( (dsw == NULL) || (dsw->d_open == NULL))
return ENXIO;
if (ap->a_cred != FSCRED && (ap->a_mode & FWRITE)) {
/*
@@ -185,8 +187,8 @@ spec_open(ap)
* opens for writing of any disk character devices.
*/
if (securelevel >= 2
- && cdevsw[maj]->d_bmaj != -1
- && (cdevsw[maj]->d_flags & D_TYPEMASK) == D_DISK)
+ && dsw->d_bmaj != -1
+ && (dsw->d_flags & D_TYPEMASK) == D_DISK)
return (EPERM);
/*
* When running in secure mode, do not allow opens
@@ -204,17 +206,18 @@ spec_open(ap)
return (EPERM);
}
}
- if ((cdevsw[maj]->d_flags & D_TYPEMASK) == D_TTY)
+ if ((dsw->d_flags & D_TYPEMASK) == D_TTY)
vp->v_flag |= VISTTY;
VOP_UNLOCK(vp, 0, p);
- error = (*cdevsw[maj]->d_open)(dev, ap->a_mode, S_IFCHR, p);
+ error = (*dsw->d_open)(dev, ap->a_mode, S_IFCHR, p);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
return (error);
/* NOT REACHED */
case VBLK:
if ((u_int)maj >= nblkdev)
return (ENXIO);
- if ( (bdevsw(maj) == NULL) || (bdevsw(maj)->d_open == NULL))
+ dsw = bdevsw(dev);
+ if ( (dsw == NULL) || (dsw->d_open == NULL))
return ENXIO;
/*
* When running in very secure mode, do not allow
@@ -222,7 +225,7 @@ spec_open(ap)
*/
if (securelevel >= 2 && ap->a_cred != FSCRED &&
(ap->a_mode & FWRITE) &&
- (bdevsw(maj)->d_flags & D_TYPEMASK) == D_DISK)
+ (dsw->d_flags & D_TYPEMASK) == D_DISK)
return (EPERM);
/*
@@ -232,7 +235,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 ((*dsw->d_open)(dev, ap->a_mode, S_IFBLK, p));
/* NOT REACHED */
default:
break;
@@ -278,7 +281,7 @@ spec_read(ap)
case VCHR:
VOP_UNLOCK(vp, 0, p);
- error = (*cdevsw[major(vp->v_rdev)]->d_read)
+ error = (*devsw(vp->v_rdev)->d_read)
(vp->v_rdev, uio, ap->a_ioflag);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
return (error);
@@ -295,7 +298,7 @@ spec_read(ap)
bsize = vp->v_specinfo->si_bsize_best;
- if ((ioctl = bdevsw(major(dev))->d_ioctl) != NULL &&
+ if ((ioctl = bdevsw(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)
@@ -362,7 +365,7 @@ spec_write(ap)
case VCHR:
VOP_UNLOCK(vp, 0, p);
- error = (*cdevsw[major(vp->v_rdev)]->d_write)
+ error = (*devsw(vp->v_rdev)->d_write)
(vp->v_rdev, uio, ap->a_ioflag);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
return (error);
@@ -379,7 +382,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(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)
@@ -434,10 +437,10 @@ spec_ioctl(ap)
switch (ap->a_vp->v_type) {
case VCHR:
- return ((*cdevsw[major(dev)]->d_ioctl)(dev, ap->a_command,
+ return ((*devsw(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(dev)->d_ioctl)(dev, ap->a_command,
ap->a_data, ap->a_fflag, ap->a_p));
default:
panic("spec_ioctl");
@@ -461,7 +464,7 @@ spec_poll(ap)
case VCHR:
dev = ap->a_vp->v_rdev;
- return (*cdevsw[major(dev)]->d_poll)(dev, ap->a_events, ap->a_p);
+ return (*devsw(dev)->d_poll)(dev, ap->a_events, ap->a_p);
default:
return (vop_defaultop((struct vop_generic_args *)ap));
@@ -553,7 +556,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(bp->b_dev)->d_strategy)(bp);
return (0);
}
@@ -568,7 +571,7 @@ spec_freeblks(ap)
struct cdevsw *bsw;
struct buf *bp;
- bsw = bdevsw(major(ap->a_vp->v_rdev));
+ bsw = bdevsw(ap->a_vp->v_rdev);
if ((bsw->d_flags & D_CANFREE) == 0)
return (0);
bp = geteblk(ap->a_length);
@@ -650,7 +653,7 @@ spec_close(ap)
*/
if (vcount(vp) > 1 && (vp->v_flag & VXLOCK) == 0)
return (0);
- devclose = cdevsw[major(dev)]->d_close;
+ devclose = devsw(dev)->d_close;
mode = S_IFCHR;
break;
@@ -678,7 +681,7 @@ spec_close(ap)
if ((vcount(vp) > 1) && (vp->v_flag & VXLOCK) == 0)
return (0);
- devclose = bdevsw(major(dev))->d_close;
+ devclose = bdevsw(dev)->d_close;
mode = S_IFBLK;
break;
@@ -956,7 +959,7 @@ spec_getattr(ap)
vap->va_blocksize = MAXBSIZE;
}
- if ((*bdevsw(major(vp->v_rdev))->d_ioctl)(vp->v_rdev, DIOCGPART,
+ if ((*bdevsw(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);
diff --git a/sys/gnu/ext2fs/ext2_bmap.c b/sys/gnu/ext2fs/ext2_bmap.c
index 88f4c24..8532628 100644
--- a/sys/gnu/ext2fs/ext2_bmap.c
+++ b/sys/gnu/ext2fs/ext2_bmap.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_bmap.c 8.7 (Berkeley) 3/21/95
- * $Id: ufs_bmap.c,v 1.26 1999/05/02 23:57:04 alc Exp $
+ * $Id: ufs_bmap.c,v 1.27 1999/05/07 10:11:36 phk 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(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(devvp->v_rdev)->d_maxio;
+ vp->v_maxio = bdevsw(devvp->v_rdev)->d_maxio;
}
maxrun = maxrun / blksize;
maxrun -= 1;
diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c
index 4410199..43f8ead 100644
--- a/sys/gnu/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/ext2fs/ext2_vfsops.c
@@ -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(rootdev)->d_flags & D_NOCLUSTERR)
mp->mnt_flag |= MNT_NOCLUSTERR;
- if (bdevsw(major(rootdev))->d_flags & D_NOCLUSTERW)
+ if (bdevsw(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(ump->um_dev)->d_flags & D_NOCLUSTERR)
mp->mnt_flag |= MNT_NOCLUSTERR;
- if (bdevsw(major(ump->um_dev))->d_flags & D_NOCLUSTERW)
+ if (bdevsw(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(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(devvp->v_rdev)->d_flags & D_NOCLUSTERR)
mp->mnt_flag |= MNT_NOCLUSTERR;
- if (bdevsw(major(devvp->v_rdev))->d_flags & D_NOCLUSTERW)
+ if (bdevsw(devvp->v_rdev)->d_flags & D_NOCLUSTERW)
mp->mnt_flag |= MNT_NOCLUSTERW;
error = ext2_mountfs(devvp, mp, p);
} else {
diff --git a/sys/gnu/fs/ext2fs/ext2_bmap.c b/sys/gnu/fs/ext2fs/ext2_bmap.c
index 88f4c24..8532628 100644
--- a/sys/gnu/fs/ext2fs/ext2_bmap.c
+++ b/sys/gnu/fs/ext2fs/ext2_bmap.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_bmap.c 8.7 (Berkeley) 3/21/95
- * $Id: ufs_bmap.c,v 1.26 1999/05/02 23:57:04 alc Exp $
+ * $Id: ufs_bmap.c,v 1.27 1999/05/07 10:11:36 phk 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(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(devvp->v_rdev)->d_maxio;
+ vp->v_maxio = bdevsw(devvp->v_rdev)->d_maxio;
}
maxrun = maxrun / blksize;
maxrun -= 1;
diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c
index 4410199..43f8ead 100644
--- a/sys/gnu/fs/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c
@@ -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(rootdev)->d_flags & D_NOCLUSTERR)
mp->mnt_flag |= MNT_NOCLUSTERR;
- if (bdevsw(major(rootdev))->d_flags & D_NOCLUSTERW)
+ if (bdevsw(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(ump->um_dev)->d_flags & D_NOCLUSTERR)
mp->mnt_flag |= MNT_NOCLUSTERR;
- if (bdevsw(major(ump->um_dev))->d_flags & D_NOCLUSTERW)
+ if (bdevsw(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(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(devvp->v_rdev)->d_flags & D_NOCLUSTERR)
mp->mnt_flag |= MNT_NOCLUSTERR;
- if (bdevsw(major(devvp->v_rdev))->d_flags & D_NOCLUSTERW)
+ if (bdevsw(devvp->v_rdev)->d_flags & D_NOCLUSTERW)
mp->mnt_flag |= MNT_NOCLUSTERW;
error = ext2_mountfs(devvp, mp, p);
} else {
diff --git a/sys/i386/i386/autoconf.c b/sys/i386/i386/autoconf.c
index 7ecf9e8..82414fe 100644
--- a/sys/i386/i386/autoconf.c
+++ b/sys/i386/i386/autoconf.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)autoconf.c 7.1 (Berkeley) 5/9/91
- * $Id: autoconf.c,v 1.115 1999/05/06 22:16:19 peter Exp $
+ * $Id: autoconf.c,v 1.116 1999/05/07 10:10:21 phk 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(rootdev);
if (bd == NULL || bd->d_open == NULL)
continue;
if (bootverbose)
diff --git a/sys/i386/i386/cons.c b/sys/i386/i386/cons.c
index 9540125..32b181d 100644
--- a/sys/i386/i386/cons.c
+++ b/sys/i386/i386/cons.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
- * $Id: cons.c,v 1.63 1999/04/27 12:21:03 phk Exp $
+ * $Id: cons.c,v 1.64 1999/04/28 10:52:04 dt Exp $
*/
#include "opt_devfs.h"
@@ -158,7 +158,7 @@ cninit_finish()
/*
* Hook the open and close functions.
*/
- cdp = cdevsw[major(cn_tab->cn_dev)];
+ cdp = devsw(cn_tab->cn_dev);
cn_phys_close = cdp->d_close;
cdp->d_close = cnclose;
cn_phys_open = cdp->d_open;
@@ -178,7 +178,7 @@ cnuninit(void)
/*
* Unhook the open and close functions.
*/
- cdp = cdevsw[major(cn_tab->cn_dev)];
+ cdp = devsw(cn_tab->cn_dev);
cdp->d_close = cn_phys_close;
cn_phys_close = NULL;
cdp->d_open = cn_phys_open;
@@ -321,7 +321,7 @@ cnread(dev, uio, flag)
if ((cn_tab == NULL) || cn_mute)
return (0);
dev = cn_tab->cn_dev;
- return ((*cdevsw[major(dev)]->d_read)(dev, uio, flag));
+ return ((*devsw(dev)->d_read)(dev, uio, flag));
}
static int
@@ -338,7 +338,7 @@ cnwrite(dev, uio, flag)
dev = constty->t_dev;
else
dev = cn_tab->cn_dev;
- return ((*cdevsw[major(dev)]->d_write)(dev, uio, flag));
+ return ((*devsw(dev)->d_write)(dev, uio, flag));
}
static int
@@ -365,7 +365,7 @@ cnioctl(dev, cmd, data, flag, p)
return (0);
}
dev = cn_tab->cn_dev;
- return ((*cdevsw[major(dev)]->d_ioctl)(dev, cmd, data, flag, p));
+ return ((*devsw(dev)->d_ioctl)(dev, cmd, data, flag, p));
}
static int
@@ -379,7 +379,7 @@ cnpoll(dev, events, p)
dev = cn_tab->cn_dev;
- return ((*cdevsw[major(dev)]->d_poll)(dev, events, p));
+ return ((*devsw(dev)->d_poll)(dev, events, p));
}
int
diff --git a/sys/i386/linux/linux_file.c b/sys/i386/linux/linux_file.c
index 907e6b8..e357e15 100644
--- a/sys/i386/linux/linux_file.c
+++ b/sys/i386/linux/linux_file.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: linux_file.c,v 1.23 1999/01/10 23:15:35 eivind Exp $
+ * $Id: linux_file.c,v 1.24 1999/05/06 18:44:20 peter Exp $
*/
#include "opt_compat.h"
@@ -306,7 +306,7 @@ linux_fcntl(struct proc *p, struct linux_fcntl_args *args)
if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p)))
return error;
- d_tty = cdevsw[major(va.va_rdev)]->d_devtotty;
+ d_tty = devsw(va.va_rdev)->d_devtotty;
if (!d_tty || (!(tp = (*d_tty)(va.va_rdev))))
return EINVAL;
if (args->cmd == LINUX_F_GETOWN) {
diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c
index d10f49c..1de8b40 100644
--- a/sys/isofs/cd9660/cd9660_vfsops.c
+++ b/sys/isofs/cd9660/cd9660_vfsops.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vfsops.c 8.18 (Berkeley) 5/22/95
- * $Id: cd9660_vfsops.c,v 1.53 1999/04/27 11:15:47 phk Exp $
+ * $Id: cd9660_vfsops.c,v 1.54 1999/05/07 10:10:46 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(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(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(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(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(devvp->v_rdev)->d_flags & D_NOCLUSTERR)
mp->mnt_flag |= MNT_NOCLUSTERR;
error = iso_mountfs(devvp, mp, p, &args);
} else {
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c
index 2e303b2..8a8b326 100644
--- a/sys/kern/kern_conf.c
+++ b/sys/kern/kern_conf.c
@@ -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.31 1999/03/23 21:11:47 dfr Exp $
+ * $Id: kern_conf.c,v 1.32 1999/05/07 10:10:50 phk Exp $
*/
#include <sys/param.h>
@@ -58,7 +58,7 @@ chrtoblk(dev_t dev)
{
struct cdevsw *cd;
- if((cd = cdevsw[major(dev)]) != NULL) {
+ if((cd = devsw(dev)) != NULL) {
if (cd->d_bmaj != -1)
return(makedev(cd->d_bmaj,minor(dev)));
}
diff --git a/sys/kern/kern_physio.c b/sys/kern/kern_physio.c
index c2cbb69..5f685b5 100644
--- a/sys/kern/kern_physio.c
+++ b/sys/kern/kern_physio.c
@@ -16,7 +16,7 @@
* 4. Modifications may be freely made to this file if the above conditions
* are met.
*
- * $Id: kern_physio.c,v 1.32 1999/05/06 20:00:25 phk Exp $
+ * $Id: kern_physio.c,v 1.33 1999/05/07 07:03:39 phk Exp $
*/
#include <sys/param.h>
@@ -35,13 +35,13 @@ static struct buf * phygetvpbuf(dev_t dev, int resid);
int
physread(dev_t dev, struct uio *uio, int ioflag)
{
- return(physio(cdevsw[major(dev)]->d_strategy, NULL, dev, 1, minphys, uio));
+ return(physio(devsw(dev)->d_strategy, NULL, dev, 1, minphys, uio));
}
int
physwrite(dev_t dev, struct uio *uio, int ioflag)
{
- return(physio(cdevsw[major(dev)]->d_strategy, NULL, dev, 0, minphys, uio));
+ return(physio(devsw(dev)->d_strategy, NULL, dev, 0, minphys, uio));
}
int
@@ -181,7 +181,7 @@ minphys(bp)
u_int maxphys = DFLTPHYS;
struct cdevsw *bdsw;
- bdsw = cdevsw[major(bp->b_dev)];
+ bdsw = devsw(bp->b_dev);
if (bdsw && bdsw->d_maxio) {
maxphys = bdsw->d_maxio;
@@ -206,7 +206,7 @@ phygetvpbuf(dev_t dev, int resid)
struct cdevsw *bdsw;
int maxio;
- bdsw = cdevsw[major(dev)];
+ bdsw = devsw(dev);
if ((bdsw == NULL) || (bdsw->d_bmaj == -1))
return getpbuf(NULL);
diff --git a/sys/kern/kern_shutdown.c b/sys/kern/kern_shutdown.c
index 2c51ac7..23f4ac8 100644
--- a/sys/kern/kern_shutdown.c
+++ b/sys/kern/kern_shutdown.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_shutdown.c 8.3 (Berkeley) 1/21/94
- * $Id: kern_shutdown.c,v 1.49 1999/05/06 18:12:44 peter Exp $
+ * $Id: kern_shutdown.c,v 1.50 1999/05/07 10:10:53 phk Exp $
*/
#include "opt_ddb.h"
@@ -377,14 +377,14 @@ dumpsys(void)
return;
if (dumpdev == NODEV)
return;
- if (!(bdevsw(major(dumpdev))))
+ if (!(bdevsw(dumpdev)))
return;
- if (!(bdevsw(major(dumpdev))->d_dump))
+ if (!(bdevsw(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(dumpdev)->d_dump)(dumpdev)) {
case ENXIO:
printf("device bad\n");
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 4201196..8b946cf 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)tty.c 8.8 (Berkeley) 1/21/94
- * $Id: tty.c,v 1.116 1999/04/27 11:16:17 phk Exp $
+ * $Id: tty.c,v 1.117 1999/05/06 18:12:47 peter Exp $
*/
/*-
@@ -419,7 +419,7 @@ parmrk:
#ifdef sun4c /* XXX */
(*tp->t_stop)(tp, 0);
#else
- (*cdevsw[major(tp->t_dev)]->d_stop)(tp,
+ (*devsw(tp->t_dev)->d_stop)(tp,
0);
#endif
return (0);
@@ -996,7 +996,7 @@ ttioctl(tp, cmd, data, flag)
#ifdef sun4c /* XXX */
(*tp->t_stop)(tp, 0);
#else
- (*cdevsw[major(tp->t_dev)]->d_stop)(tp, 0);
+ (*devsw(tp->t_dev)->d_stop)(tp, 0);
#endif
}
splx(s);
@@ -1097,7 +1097,7 @@ ttpoll(dev, events, p)
int events;
struct proc *p;
{
- return ttypoll((*cdevsw[major(dev)]->d_devtotty)(dev), events, p);
+ return ttypoll((*devsw(dev)->d_devtotty)(dev), events, p);
}
/*
@@ -1189,7 +1189,7 @@ again:
#ifdef sun4c /* XXX */
(*tp->t_stop)(tp, rw);
#else
- (*cdevsw[major(tp->t_dev)]->d_stop)(tp, rw);
+ (*devsw(tp->t_dev)->d_stop)(tp, rw);
#endif
if (rw & FREAD) {
FLUSHQ(&tp->t_canq);
@@ -1374,7 +1374,7 @@ ttymodem(tp, flag)
#ifdef sun4c /* XXX */
(*tp->t_stop)(tp, 0);
#else
- (*cdevsw[major(tp->t_dev)]->d_stop)(tp, 0);
+ (*devsw(tp->t_dev)->d_stop)(tp, 0);
#endif
}
} else if (flag == 0) {
diff --git a/sys/kern/tty_cons.c b/sys/kern/tty_cons.c
index 9540125..32b181d 100644
--- a/sys/kern/tty_cons.c
+++ b/sys/kern/tty_cons.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
- * $Id: cons.c,v 1.63 1999/04/27 12:21:03 phk Exp $
+ * $Id: cons.c,v 1.64 1999/04/28 10:52:04 dt Exp $
*/
#include "opt_devfs.h"
@@ -158,7 +158,7 @@ cninit_finish()
/*
* Hook the open and close functions.
*/
- cdp = cdevsw[major(cn_tab->cn_dev)];
+ cdp = devsw(cn_tab->cn_dev);
cn_phys_close = cdp->d_close;
cdp->d_close = cnclose;
cn_phys_open = cdp->d_open;
@@ -178,7 +178,7 @@ cnuninit(void)
/*
* Unhook the open and close functions.
*/
- cdp = cdevsw[major(cn_tab->cn_dev)];
+ cdp = devsw(cn_tab->cn_dev);
cdp->d_close = cn_phys_close;
cn_phys_close = NULL;
cdp->d_open = cn_phys_open;
@@ -321,7 +321,7 @@ cnread(dev, uio, flag)
if ((cn_tab == NULL) || cn_mute)
return (0);
dev = cn_tab->cn_dev;
- return ((*cdevsw[major(dev)]->d_read)(dev, uio, flag));
+ return ((*devsw(dev)->d_read)(dev, uio, flag));
}
static int
@@ -338,7 +338,7 @@ cnwrite(dev, uio, flag)
dev = constty->t_dev;
else
dev = cn_tab->cn_dev;
- return ((*cdevsw[major(dev)]->d_write)(dev, uio, flag));
+ return ((*devsw(dev)->d_write)(dev, uio, flag));
}
static int
@@ -365,7 +365,7 @@ cnioctl(dev, cmd, data, flag, p)
return (0);
}
dev = cn_tab->cn_dev;
- return ((*cdevsw[major(dev)]->d_ioctl)(dev, cmd, data, flag, p));
+ return ((*devsw(dev)->d_ioctl)(dev, cmd, data, flag, p));
}
static int
@@ -379,7 +379,7 @@ cnpoll(dev, events, p)
dev = cn_tab->cn_dev;
- return ((*cdevsw[major(dev)]->d_poll)(dev, events, p));
+ return ((*devsw(dev)->d_poll)(dev, events, p));
}
int
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c
index d8b4893..c7c0313 100644
--- a/sys/kern/tty_pty.c
+++ b/sys/kern/tty_pty.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)tty_pty.c 8.4 (Berkeley) 2/20/95
- * $Id: tty_pty.c,v 1.55 1999/01/30 12:17:37 phk Exp $
+ * $Id: tty_pty.c,v 1.56 1999/04/27 11:16:19 phk Exp $
*/
/*
@@ -675,7 +675,7 @@ ptyioctl(dev, cmd, data, flag, p)
}
return(0);
} else
- if (cdevsw[major(dev)]->d_open == ptcopen)
+ if (devsw(dev)->d_open == ptcopen)
switch (cmd) {
case TIOCGPGRP:
diff --git a/sys/kern/tty_snoop.c b/sys/kern/tty_snoop.c
index ebffb2a..204088c 100644
--- a/sys/kern/tty_snoop.c
+++ b/sys/kern/tty_snoop.c
@@ -71,7 +71,7 @@ snpdevtotty (dev)
maj = major(dev);
if ((u_int)maj >= nchrdev)
return (NULL);
- cdp = cdevsw[maj];
+ cdp = devsw(dev);
if (cdp == NULL)
return (NULL);
return ((*cdp->d_devtotty)(dev));
diff --git a/sys/kern/vfs_aio.c b/sys/kern/vfs_aio.c
index cd5c2ff..e614631 100644
--- a/sys/kern/vfs_aio.c
+++ b/sys/kern/vfs_aio.c
@@ -13,7 +13,7 @@
* bad that happens because of using this software isn't the responsibility
* of the author. This software is distributed AS-IS.
*
- * $Id: vfs_aio.c,v 1.47 1999/05/06 18:44:42 peter Exp $
+ * $Id: vfs_aio.c,v 1.48 1999/05/06 20:00:25 phk Exp $
*/
/*
@@ -963,7 +963,7 @@ aio_qphysio(p, aiocbe)
return -1;
}
- cdev = cdevsw[major(vp->v_rdev)];
+ cdev = devsw(vp->v_rdev);
if (cdev == NULL) {
return -1;
}
diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c
index 258d8e5..c33406e 100644
--- a/sys/kern/vfs_export.c
+++ b/sys/kern/vfs_export.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
- * $Id: vfs_subr.c,v 1.190 1999/05/03 23:57:24 billf Exp $
+ * $Id: vfs_subr.c,v 1.191 1999/05/07 10:10:58 phk 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(dev) == NULL))) {
*vpp = NULLVP;
return (ENXIO);
}
@@ -1275,12 +1275,12 @@ loop:
*/
if (nvp->v_type == VBLK && rmaj < nblkdev) {
- if (bdevsw(rmaj) && bdevsw(rmaj)->d_parms)
+ if (bdevsw(nvp_rdev) && bdevsw(nvp_rdev)->d_parms)
- (*bdevsw(rmaj)->d_parms)(nvp_rdev, sinfo, DPARM_GET);
+ (*bdevsw(nvp_rdev)->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);
+ if (devsw(nvp_rdev) && devsw(nvp_rdev)->d_parms)
+ (*devsw(nvp_rdev)->d_parms)(nvp_rdev, sinfo, DPARM_GET);
}
simple_unlock(&spechash_slock);
@@ -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(vp->v_rdev) != NULL) {
/*
* This simply allocates the biggest object possible
* for a VBLK vnode. This should be fixed, but doesn't
diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c
index 258d8e5..c33406e 100644
--- a/sys/kern/vfs_subr.c
+++ b/sys/kern/vfs_subr.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
- * $Id: vfs_subr.c,v 1.190 1999/05/03 23:57:24 billf Exp $
+ * $Id: vfs_subr.c,v 1.191 1999/05/07 10:10:58 phk 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(dev) == NULL))) {
*vpp = NULLVP;
return (ENXIO);
}
@@ -1275,12 +1275,12 @@ loop:
*/
if (nvp->v_type == VBLK && rmaj < nblkdev) {
- if (bdevsw(rmaj) && bdevsw(rmaj)->d_parms)
+ if (bdevsw(nvp_rdev) && bdevsw(nvp_rdev)->d_parms)
- (*bdevsw(rmaj)->d_parms)(nvp_rdev, sinfo, DPARM_GET);
+ (*bdevsw(nvp_rdev)->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);
+ if (devsw(nvp_rdev) && devsw(nvp_rdev)->d_parms)
+ (*devsw(nvp_rdev)->d_parms)(nvp_rdev, sinfo, DPARM_GET);
}
simple_unlock(&spechash_slock);
@@ -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(vp->v_rdev) != NULL) {
/*
* This simply allocates the biggest object possible
* for a VBLK vnode. This should be fixed, but doesn't
diff --git a/sys/miscfs/kernfs/kernfs_vfsops.c b/sys/miscfs/kernfs/kernfs_vfsops.c
index 7e94b9f..44ddd52 100644
--- a/sys/miscfs/kernfs/kernfs_vfsops.c
+++ b/sys/miscfs/kernfs/kernfs_vfsops.c
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)kernfs_vfsops.c 8.10 (Berkeley) 5/14/95
- * $Id: kernfs_vfsops.c,v 1.24 1998/12/07 21:58:31 archie Exp $
+ * $Id: kernfs_vfsops.c,v 1.25 1999/05/07 10:11:02 phk Exp $
*/
/*
@@ -88,7 +88,7 @@ kernfs_get_rrootdev()
}
tried = 1;
- if (!bdevsw(bmaj)) {
+ if (!bdevsw(rootdev)) {
panic("root dev has no bdevsw");
}
if (rootdev == NODEV)
diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c
index 63f2b36..74c30c7 100644
--- a/sys/miscfs/specfs/spec_vnops.c
+++ b/sys/miscfs/specfs/spec_vnops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
- * $Id: spec_vnops.c,v 1.83 1999/05/06 20:00:27 phk Exp $
+ * $Id: spec_vnops.c,v 1.84 1999/05/07 10:11:05 phk Exp $
*/
#include <sys/param.h>
@@ -165,6 +165,7 @@ spec_open(ap)
dev_t bdev, dev = (dev_t)vp->v_rdev;
int maj = major(dev);
int error;
+ struct cdevsw *dsw;
/*
* Don't allow open if fs is mounted -nodev.
@@ -177,7 +178,8 @@ spec_open(ap)
case VCHR:
if ((u_int)maj >= nchrdev)
return (ENXIO);
- if ( (cdevsw[maj] == NULL) || (cdevsw[maj]->d_open == NULL))
+ dsw = devsw(dev);
+ if ( (dsw == NULL) || (dsw->d_open == NULL))
return ENXIO;
if (ap->a_cred != FSCRED && (ap->a_mode & FWRITE)) {
/*
@@ -185,8 +187,8 @@ spec_open(ap)
* opens for writing of any disk character devices.
*/
if (securelevel >= 2
- && cdevsw[maj]->d_bmaj != -1
- && (cdevsw[maj]->d_flags & D_TYPEMASK) == D_DISK)
+ && dsw->d_bmaj != -1
+ && (dsw->d_flags & D_TYPEMASK) == D_DISK)
return (EPERM);
/*
* When running in secure mode, do not allow opens
@@ -204,17 +206,18 @@ spec_open(ap)
return (EPERM);
}
}
- if ((cdevsw[maj]->d_flags & D_TYPEMASK) == D_TTY)
+ if ((dsw->d_flags & D_TYPEMASK) == D_TTY)
vp->v_flag |= VISTTY;
VOP_UNLOCK(vp, 0, p);
- error = (*cdevsw[maj]->d_open)(dev, ap->a_mode, S_IFCHR, p);
+ error = (*dsw->d_open)(dev, ap->a_mode, S_IFCHR, p);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
return (error);
/* NOT REACHED */
case VBLK:
if ((u_int)maj >= nblkdev)
return (ENXIO);
- if ( (bdevsw(maj) == NULL) || (bdevsw(maj)->d_open == NULL))
+ dsw = bdevsw(dev);
+ if ( (dsw == NULL) || (dsw->d_open == NULL))
return ENXIO;
/*
* When running in very secure mode, do not allow
@@ -222,7 +225,7 @@ spec_open(ap)
*/
if (securelevel >= 2 && ap->a_cred != FSCRED &&
(ap->a_mode & FWRITE) &&
- (bdevsw(maj)->d_flags & D_TYPEMASK) == D_DISK)
+ (dsw->d_flags & D_TYPEMASK) == D_DISK)
return (EPERM);
/*
@@ -232,7 +235,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 ((*dsw->d_open)(dev, ap->a_mode, S_IFBLK, p));
/* NOT REACHED */
default:
break;
@@ -278,7 +281,7 @@ spec_read(ap)
case VCHR:
VOP_UNLOCK(vp, 0, p);
- error = (*cdevsw[major(vp->v_rdev)]->d_read)
+ error = (*devsw(vp->v_rdev)->d_read)
(vp->v_rdev, uio, ap->a_ioflag);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
return (error);
@@ -295,7 +298,7 @@ spec_read(ap)
bsize = vp->v_specinfo->si_bsize_best;
- if ((ioctl = bdevsw(major(dev))->d_ioctl) != NULL &&
+ if ((ioctl = bdevsw(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)
@@ -362,7 +365,7 @@ spec_write(ap)
case VCHR:
VOP_UNLOCK(vp, 0, p);
- error = (*cdevsw[major(vp->v_rdev)]->d_write)
+ error = (*devsw(vp->v_rdev)->d_write)
(vp->v_rdev, uio, ap->a_ioflag);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
return (error);
@@ -379,7 +382,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(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)
@@ -434,10 +437,10 @@ spec_ioctl(ap)
switch (ap->a_vp->v_type) {
case VCHR:
- return ((*cdevsw[major(dev)]->d_ioctl)(dev, ap->a_command,
+ return ((*devsw(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(dev)->d_ioctl)(dev, ap->a_command,
ap->a_data, ap->a_fflag, ap->a_p));
default:
panic("spec_ioctl");
@@ -461,7 +464,7 @@ spec_poll(ap)
case VCHR:
dev = ap->a_vp->v_rdev;
- return (*cdevsw[major(dev)]->d_poll)(dev, ap->a_events, ap->a_p);
+ return (*devsw(dev)->d_poll)(dev, ap->a_events, ap->a_p);
default:
return (vop_defaultop((struct vop_generic_args *)ap));
@@ -553,7 +556,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(bp->b_dev)->d_strategy)(bp);
return (0);
}
@@ -568,7 +571,7 @@ spec_freeblks(ap)
struct cdevsw *bsw;
struct buf *bp;
- bsw = bdevsw(major(ap->a_vp->v_rdev));
+ bsw = bdevsw(ap->a_vp->v_rdev);
if ((bsw->d_flags & D_CANFREE) == 0)
return (0);
bp = geteblk(ap->a_length);
@@ -650,7 +653,7 @@ spec_close(ap)
*/
if (vcount(vp) > 1 && (vp->v_flag & VXLOCK) == 0)
return (0);
- devclose = cdevsw[major(dev)]->d_close;
+ devclose = devsw(dev)->d_close;
mode = S_IFCHR;
break;
@@ -678,7 +681,7 @@ spec_close(ap)
if ((vcount(vp) > 1) && (vp->v_flag & VXLOCK) == 0)
return (0);
- devclose = bdevsw(major(dev))->d_close;
+ devclose = bdevsw(dev)->d_close;
mode = S_IFBLK;
break;
@@ -956,7 +959,7 @@ spec_getattr(ap)
vap->va_blocksize = MAXBSIZE;
}
- if ((*bdevsw(major(vp->v_rdev))->d_ioctl)(vp->v_rdev, DIOCGPART,
+ if ((*bdevsw(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);
diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c
index c062519..35c4cb2 100644
--- a/sys/msdosfs/msdosfs_vfsops.c
+++ b/sys/msdosfs/msdosfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $Id: msdosfs_vfsops.c,v 1.42 1999/05/06 18:12:50 peter Exp $ */
+/* $Id: msdosfs_vfsops.c,v 1.43 1999/05/07 10:11:10 phk 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(devvp->v_rdev) == NULL) {
vrele(devvp);
return (ENXIO);
}
diff --git a/sys/net/ppp_tty.c b/sys/net/ppp_tty.c
index 7f91fda..737c581 100644
--- a/sys/net/ppp_tty.c
+++ b/sys/net/ppp_tty.c
@@ -70,7 +70,7 @@
* Paul Mackerras (paulus@cs.anu.edu.au).
*/
-/* $Id: ppp_tty.c,v 1.38 1999/01/17 20:53:47 peter Exp $ */
+/* $Id: ppp_tty.c,v 1.39 1999/04/27 11:17:07 phk Exp $ */
#include "ppp.h"
#if NPPP > 0
@@ -896,7 +896,7 @@ pppinput(c, tp)
if (c == tp->t_cc[VSTOP] && tp->t_cc[VSTOP] != _POSIX_VDISABLE) {
if ((tp->t_state & TS_TTSTOP) == 0) {
tp->t_state |= TS_TTSTOP;
- (*cdevsw[major(tp->t_dev)]->d_stop)(tp, 0);
+ (*devsw(tp->t_dev)->d_stop)(tp, 0);
}
return 0;
}
diff --git a/sys/sys/conf.h b/sys/sys/conf.h
index dbe2af3..387fc9a 100644
--- a/sys/sys/conf.h
+++ b/sys/sys/conf.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)conf.h 8.5 (Berkeley) 1/9/95
- * $Id: conf.h,v 1.50 1999/02/25 05:22:28 dillon Exp $
+ * $Id: conf.h,v 1.51 1999/05/07 10:11:23 phk Exp $
*/
#ifndef _SYS_CONF_H_
@@ -133,9 +133,16 @@ extern int bmaj2cmaj[];
static __inline
struct cdevsw *
-bdevsw(int maj)
+devsw(dev_t dev)
{
- struct cdevsw *c = cdevsw[bmaj2cmaj[maj]];
+ return(cdevsw[major(dev)]);
+}
+
+static __inline
+struct cdevsw *
+bdevsw(dev_t dev)
+{
+ struct cdevsw *c = cdevsw[bmaj2cmaj[major(dev)]];
/* CMAJ zero is the console, which has no strategy so this works */
if (c->d_strategy)
return (c);
diff --git a/sys/sys/linedisc.h b/sys/sys/linedisc.h
index dbe2af3..387fc9a 100644
--- a/sys/sys/linedisc.h
+++ b/sys/sys/linedisc.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)conf.h 8.5 (Berkeley) 1/9/95
- * $Id: conf.h,v 1.50 1999/02/25 05:22:28 dillon Exp $
+ * $Id: conf.h,v 1.51 1999/05/07 10:11:23 phk Exp $
*/
#ifndef _SYS_CONF_H_
@@ -133,9 +133,16 @@ extern int bmaj2cmaj[];
static __inline
struct cdevsw *
-bdevsw(int maj)
+devsw(dev_t dev)
{
- struct cdevsw *c = cdevsw[bmaj2cmaj[maj]];
+ return(cdevsw[major(dev)]);
+}
+
+static __inline
+struct cdevsw *
+bdevsw(dev_t dev)
+{
+ struct cdevsw *c = cdevsw[bmaj2cmaj[major(dev)]];
/* CMAJ zero is the console, which has no strategy so this works */
if (c->d_strategy)
return (c);
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 184f866..db60d49 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ffs_vfsops.c 8.31 (Berkeley) 5/20/95
- * $Id: ffs_vfsops.c,v 1.96 1999/01/28 00:57:54 dillon Exp $
+ * $Id: ffs_vfsops.c,v 1.97 1999/05/07 10:11:33 phk 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(rootdev)->d_flags & D_NOCLUSTERR)
mp->mnt_flag |= MNT_NOCLUSTERR;
- if (bdevsw(major(rootdev))->d_flags & D_NOCLUSTERW)
+ if (bdevsw(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(ump->um_dev)->d_flags & D_NOCLUSTERR)
mp->mnt_flag |= MNT_NOCLUSTERR;
- if (bdevsw(major(ump->um_dev))->d_flags & D_NOCLUSTERW)
+ if (bdevsw(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(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(devvp->v_rdev)->d_flags & D_NOCLUSTERR)
mp->mnt_flag |= MNT_NOCLUSTERR;
- if (bdevsw(major(devvp->v_rdev))->d_flags & D_NOCLUSTERW)
+ if (bdevsw(devvp->v_rdev)->d_flags & D_NOCLUSTERW)
mp->mnt_flag |= MNT_NOCLUSTERW;
/*
diff --git a/sys/ufs/ufs/ufs_bmap.c b/sys/ufs/ufs/ufs_bmap.c
index 88f4c24..8532628 100644
--- a/sys/ufs/ufs/ufs_bmap.c
+++ b/sys/ufs/ufs/ufs_bmap.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_bmap.c 8.7 (Berkeley) 3/21/95
- * $Id: ufs_bmap.c,v 1.26 1999/05/02 23:57:04 alc Exp $
+ * $Id: ufs_bmap.c,v 1.27 1999/05/07 10:11:36 phk 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(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(devvp->v_rdev)->d_maxio;
+ vp->v_maxio = bdevsw(devvp->v_rdev)->d_maxio;
}
maxrun = maxrun / blksize;
maxrun -= 1;
diff --git a/sys/vm/device_pager.c b/sys/vm/device_pager.c
index d8f8df1..c8e241a 100644
--- a/sys/vm/device_pager.c
+++ b/sys/vm/device_pager.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)device_pager.c 8.1 (Berkeley) 6/11/93
- * $Id: device_pager.c,v 1.38 1999/01/21 08:29:09 dillon Exp $
+ * $Id: device_pager.c,v 1.39 1999/01/24 02:32:14 dillon Exp $
*/
#include <sys/param.h>
@@ -104,7 +104,7 @@ dev_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t fo
* Make sure this device can be mapped.
*/
dev = (dev_t) (uintptr_t) handle;
- mapfunc = cdevsw[major(dev)]->d_mmap;
+ mapfunc = devsw(dev)->d_mmap;
if (mapfunc == NULL || mapfunc == (d_mmap_t *)nullop) {
printf("obsolete map function %p\n", (void *)mapfunc);
return (NULL);
@@ -202,7 +202,7 @@ dev_pager_getpages(object, m, count, reqpage)
dev = (dev_t) (uintptr_t) object->handle;
offset = m[reqpage]->pindex;
prot = PROT_READ; /* XXX should pass in? */
- mapfunc = cdevsw[major(dev)]->d_mmap;
+ mapfunc = devsw(dev)->d_mmap;
if (mapfunc == NULL || mapfunc == (d_mmap_t *)nullop)
panic("dev_pager_getpage: no map function");
diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c
index 9a8db05..48c7ad3 100644
--- a/sys/vm/vm_swap.c
+++ b/sys/vm/vm_swap.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)vm_swap.c 8.5 (Berkeley) 2/17/94
- * $Id: vm_swap.c,v 1.64 1999/05/07 07:03:47 phk Exp $
+ * $Id: vm_swap.c,v 1.65 1999/05/07 10:11:40 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(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(dev)->d_psize == 0 ||
+ (nblks = (*bdevsw(dev)->d_psize) (dev)) == -1)) {
(void) VOP_CLOSE(vp, FREAD | FWRITE, p->p_ucred, p);
return (ENXIO);
}
OpenPOWER on IntegriCloud