From 7e26ca1d1a4bb6507cb6f9241f2d35b1048eaecd Mon Sep 17 00:00:00 2001 From: phk Date: Tue, 11 May 1999 19:55:07 +0000 Subject: Divorce "dev_t" from the "major|minor" bitmap, which is now called udev_t in the kernel but still called dev_t in userland. Provide functions to manipulate both types: major() umajor() minor() uminor() makedev() umakedev() dev2udev() udev2dev() For now they're functions, they will become in-line functions after one of the next two steps in this process. Return major/minor/makedev to macro-hood for userland. Register a name in cdevsw[] for the "filedescriptor" driver. In the kernel the udev_t appears in places where we have the major/minor number combination, (ie: a potential device: we may not have the driver nor the device), like in inodes, vattr, cdevsw registration and so on, whereas the dev_t appears where we carry around a reference to a actual device. In the future the cdevsw and the aliased-from vnode will be hung directly from the dev_t, along with up to two softc pointers for the device driver and a few houskeeping bits. This will essentially replace the current "alias" check code (same buck, bigger bang). A little stunt has been provided to try to catch places where the wrong type is being used (dev_t vs udev_t), if you see something not working, #undef DEVT_FASCIST in kern/kern_conf.c and see if it makes a difference. If it does, please try to track it down (many hands make light work) or at least try to reproduce it as simply as possible, and describe how to do that. Without DEVT_FASCIST I belive this patch is a no-op. Stylistic/posixoid comments about the userland view of the files welcome now, from userland they now contain the end result. Next planned step: make all dev_t's refer to the same devsw[] which means convert BLK's to CHR's at the perimeter of the vnodes and other places where they enter the game (bootdev, mknod, sysctl). --- sys/msdosfs/msdosfs_denode.c | 4 ++-- sys/msdosfs/msdosfs_vnops.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'sys/msdosfs') diff --git a/sys/msdosfs/msdosfs_denode.c b/sys/msdosfs/msdosfs_denode.c index 74be5c4..3c6f9d9 100644 --- a/sys/msdosfs/msdosfs_denode.c +++ b/sys/msdosfs/msdosfs_denode.c @@ -1,4 +1,4 @@ -/* $Id: msdosfs_denode.c,v 1.43 1998/12/07 21:58:34 archie Exp $ */ +/* $Id: msdosfs_denode.c,v 1.44 1999/01/02 11:34:56 bde Exp $ */ /* $NetBSD: msdosfs_denode.c,v 1.28 1998/02/10 14:10:00 mrg Exp $ */ /*- @@ -70,7 +70,7 @@ static MALLOC_DEFINE(M_MSDOSFSNODE, "MSDOSFS node", "MSDOSFS vnode private part" static struct denode **dehashtbl; static u_long dehash; /* size of hash table - 1 */ -#define DEHASH(dev, dcl, doff) (dehashtbl[((dev) + (dcl) + (doff) / \ +#define DEHASH(dev, dcl, doff) (dehashtbl[(minor(dev) + (dcl) + (doff) / \ sizeof(struct direntry)) & dehash]) #ifndef NULL_SIMPLELOCKS static struct simplelock dehash_slock; diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c index e8678ab..036ad2f 100644 --- a/sys/msdosfs/msdosfs_vnops.c +++ b/sys/msdosfs/msdosfs_vnops.c @@ -1,4 +1,4 @@ -/* $Id: msdosfs_vnops.c,v 1.83 1999/04/28 11:37:27 phk Exp $ */ +/* $Id: msdosfs_vnops.c,v 1.84 1999/05/06 18:12:51 peter Exp $ */ /* $NetBSD: msdosfs_vnops.c,v 1.68 1998/02/10 14:10:04 mrg Exp $ */ /*- @@ -341,7 +341,7 @@ msdosfs_getattr(ap) getnanotime(&ts); DETIMES(dep, &ts, &ts, &ts); - vap->va_fsid = dep->de_dev; + vap->va_fsid = dev2udev(dep->de_dev); /* * The following computation of the fileid must be the same as that * used in msdosfs_readdir() to compute d_fileno. If not, pwd -- cgit v1.1