From a70a9e81f8f5574c0b22ef37f0893c7e10819e4d Mon Sep 17 00:00:00 2001 From: luoqi Date: Fri, 14 May 1999 20:40:23 +0000 Subject: [PATCH] Legally acquire a major number for mfs. --- sys/kern/vfs_export.c | 7 ++----- sys/kern/vfs_subr.c | 7 ++----- sys/ufs/mfs/mfs_vfsops.c | 9 +++++++-- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index 30d31b90c16a..86d2f6ce3c76 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.196 1999/05/12 19:06:40 peter Exp $ + * $Id: vfs_subr.c,v 1.197 1999/05/14 01:29:21 mckusick Exp $ */ /* @@ -1175,9 +1175,7 @@ bdevvp(dev, vpp) struct vnode *nvp; int error; - /* XXX 255 is for mfs. */ - if (dev == NODEV || (major(dev) != 255 && (major(dev) >= nblkdev || - bdevsw(dev) == NULL))) { + if (dev == NODEV || major(dev) >= nblkdev || bdevsw(dev) == NULL) { *vpp = NULLVP; return (ENXIO); } @@ -1279,7 +1277,6 @@ checkalias(nvp, nvp_rdev, mp) if (nvp->v_type == VBLK && rmaj < nblkdev) { if (bdevsw(dev) && bdevsw(dev)->d_parms) - (*bdevsw(dev)->d_parms)(dev, sinfo, DPARM_GET); } else if (nvp->v_type == VCHR && rmaj < nchrdev) { if (devsw(dev) && devsw(dev)->d_parms) diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index 30d31b90c16a..86d2f6ce3c76 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.196 1999/05/12 19:06:40 peter Exp $ + * $Id: vfs_subr.c,v 1.197 1999/05/14 01:29:21 mckusick Exp $ */ /* @@ -1175,9 +1175,7 @@ bdevvp(dev, vpp) struct vnode *nvp; int error; - /* XXX 255 is for mfs. */ - if (dev == NODEV || (major(dev) != 255 && (major(dev) >= nblkdev || - bdevsw(dev) == NULL))) { + if (dev == NODEV || major(dev) >= nblkdev || bdevsw(dev) == NULL) { *vpp = NULLVP; return (ENXIO); } @@ -1279,7 +1277,6 @@ checkalias(nvp, nvp_rdev, mp) if (nvp->v_type == VBLK && rmaj < nblkdev) { if (bdevsw(dev) && bdevsw(dev)->d_parms) - (*bdevsw(dev)->d_parms)(dev, sinfo, DPARM_GET); } else if (nvp->v_type == VCHR && rmaj < nchrdev) { if (devsw(dev) && devsw(dev)->d_parms) diff --git a/sys/ufs/mfs/mfs_vfsops.c b/sys/ufs/mfs/mfs_vfsops.c index 9ac454e0e914..e3eb25b50695 100644 --- a/sys/ufs/mfs/mfs_vfsops.c +++ b/sys/ufs/mfs/mfs_vfsops.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)mfs_vfsops.c 8.11 (Berkeley) 6/19/95 - * $Id: mfs_vfsops.c,v 1.61 1999/05/10 17:12:45 peter Exp $ + * $Id: mfs_vfsops.c,v 1.62 1999/05/11 19:55:03 phk Exp $ */ @@ -67,7 +67,7 @@ static caddr_t mfs_rootbase; /* address of mini-root in kernel virtual memory */ static u_long mfs_rootsize; /* size of mini-root in bytes */ #endif -static int mfs_minor; /* used for building internal dev_t */ +static int mfs_minor; /* used for building internal dev_t */ extern vop_t **mfs_vnodeop_p; @@ -453,6 +453,8 @@ mfs_statfs(mp, sbp, p) return (error); } +static struct cdevsw mfs_cdevsw = {}; + /* * Memory based filesystem initialization. */ @@ -460,5 +462,8 @@ static int mfs_init(vfsp) struct vfsconf *vfsp; { + dev_t dev = NODEV; + cdevsw_add(&dev, &mfs_cdevsw, NULL); + cdevsw_add_generic(255, major(dev), &mfs_cdevsw); return (0); }