diff options
author | phk <phk@FreeBSD.org> | 1999-07-19 09:37:59 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1999-07-19 09:37:59 +0000 |
commit | f3c07181e3a6a7579dac59ab5d7db8dda4765baa (patch) | |
tree | 93eba791a50e5529a9aa49618551b2c4915a8d72 /sys | |
parent | 27ccb91085806a7605b66aa03baccf16a9b33394 (diff) | |
download | FreeBSD-src-f3c07181e3a6a7579dac59ab5d7db8dda4765baa.zip FreeBSD-src-f3c07181e3a6a7579dac59ab5d7db8dda4765baa.tar.gz |
[click] Now all dev_t's in the kernel have their char device major.
Only know casualy of this is swapinfo/pstat which should be fixes
the right way: Store the actual pathname in the kernel like mount
does. [Volounteers sought for this task]
The road map from here is roughly: expand struct specinfo into struct
based dev_t. Add dev_t registration facilities for device drivers and
start to use them.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/kern/kern_conf.c | 24 | ||||
-rw-r--r-- | sys/kern/vfs_export.c | 6 | ||||
-rw-r--r-- | sys/kern/vfs_subr.c | 6 |
3 files changed, 14 insertions, 22 deletions
diff --git a/sys/kern/kern_conf.c b/sys/kern/kern_conf.c index 99ad6a6..caedd0f 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.48 1999/07/17 18:43:45 phk Exp $ + * $Id: kern_conf.c,v 1.49 1999/07/17 19:57:25 phk Exp $ */ #include <sys/param.h> @@ -71,22 +71,7 @@ devsw(dev_t dev) struct cdevsw * bdevsw(dev_t dev) { - struct cdevsw *c; - int i = major(dev); - - if (bmaj2cmaj[i] == 256) - return 0; - - c = cdevsw[bmaj2cmaj[major(dev)]]; - if (!c) { - printf("bogus bdev dev_t %p, no cdev\n", (void *)dev); - Debugger("Bummer"); - return 0; - } - /* CMAJ zero is the console, which has no strategy so this works */ - if (c->d_strategy) - return (c); - return (0); + return(cdevsw[major(dev)]); } /* @@ -209,7 +194,10 @@ minor(dev_t x) dev_t makebdev(int x, int y) { - return (makedev(x, y)); + if (bmaj2cmaj[x] == 256) { + return NODEV; + } + return (makedev(bmaj2cmaj[x], y)); } dev_t diff --git a/sys/kern/vfs_export.c b/sys/kern/vfs_export.c index b9cf55b..7dd2110 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.210 1999/07/17 19:38:00 phk Exp $ + * $Id: vfs_subr.c,v 1.211 1999/07/18 14:30:37 phk Exp $ */ /* @@ -1244,11 +1244,13 @@ bdevvp(dev, vpp) return (error); } vp = nvp; - vp->v_type = VBLK; + /* dev2udev() results in a CDEV, so we need to cheat here. */ + vp->v_type = VCHR; if ((nvp = checkalias(vp, dev2udev(dev), (struct mount *)0)) != NULL) { vput(vp); vp = nvp; } + vp->v_type = VBLK; *vpp = vp; return (0); } diff --git a/sys/kern/vfs_subr.c b/sys/kern/vfs_subr.c index b9cf55b..7dd2110 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.210 1999/07/17 19:38:00 phk Exp $ + * $Id: vfs_subr.c,v 1.211 1999/07/18 14:30:37 phk Exp $ */ /* @@ -1244,11 +1244,13 @@ bdevvp(dev, vpp) return (error); } vp = nvp; - vp->v_type = VBLK; + /* dev2udev() results in a CDEV, so we need to cheat here. */ + vp->v_type = VCHR; if ((nvp = checkalias(vp, dev2udev(dev), (struct mount *)0)) != NULL) { vput(vp); vp = nvp; } + vp->v_type = VBLK; *vpp = vp; return (0); } |