summaryrefslogtreecommitdiffstats
path: root/sys/ufs
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1999-05-11 19:55:07 +0000
committerphk <phk@FreeBSD.org>1999-05-11 19:55:07 +0000
commit7e26ca1d1a4bb6507cb6f9241f2d35b1048eaecd (patch)
tree31ecebf331e4a644fafb96ecafe7d2b6b1a24d39 /sys/ufs
parentc783fdfffac012af2a31c3939b62a23b94680404 (diff)
downloadFreeBSD-src-7e26ca1d1a4bb6507cb6f9241f2d35b1048eaecd.zip
FreeBSD-src-7e26ca1d1a4bb6507cb6f9241f2d35b1048eaecd.tar.gz
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 <sys/*.h> 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).
Diffstat (limited to 'sys/ufs')
-rw-r--r--sys/ufs/mfs/mfs_vfsops.c4
-rw-r--r--sys/ufs/ufs/ufs_ihash.c4
-rw-r--r--sys/ufs/ufs/ufs_vnops.c6
3 files changed, 7 insertions, 7 deletions
diff --git a/sys/ufs/mfs/mfs_vfsops.c b/sys/ufs/mfs/mfs_vfsops.c
index f82582f..9ac454e 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.60 1999/04/21 09:41:07 dt Exp $
+ * $Id: mfs_vfsops.c,v 1.61 1999/05/10 17:12:45 peter Exp $
*/
@@ -309,7 +309,7 @@ mfs_mount(mp, path, data, ndp, p)
goto error_1;
}
devvp->v_type = VBLK;
- if (checkalias(devvp, makedev(255, mfs_minor++), (struct mount *)0))
+ if (checkalias(devvp, umakedev(255, mfs_minor++), (struct mount *)0))
panic("mfs_mount: dup dev");
devvp->v_data = mfsp;
mfsp->mfs_baseoff = args.base;
diff --git a/sys/ufs/ufs/ufs_ihash.c b/sys/ufs/ufs/ufs_ihash.c
index 853c739..c2dd63e 100644
--- a/sys/ufs/ufs/ufs_ihash.c
+++ b/sys/ufs/ufs/ufs_ihash.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_ihash.c 8.7 (Berkeley) 5/17/95
- * $Id: ufs_ihash.c,v 1.17 1998/11/10 09:16:27 peter Exp $
+ * $Id: ufs_ihash.c,v 1.18 1999/01/02 11:34:56 bde Exp $
*/
#include <sys/param.h>
@@ -52,7 +52,7 @@ static MALLOC_DEFINE(M_UFSIHASH, "UFS ihash", "UFS Inode hash tables");
*/
static LIST_HEAD(ihashhead, inode) *ihashtbl;
static u_long ihash; /* size of hash table - 1 */
-#define INOHASH(device, inum) (&ihashtbl[((device) + (inum)) & ihash])
+#define INOHASH(device, inum) (&ihashtbl[(minor(device) + (inum)) & ihash])
#ifndef NULL_SIMPLELOCKS
static struct simplelock ufs_ihash_slock;
#endif
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 411f2fe..52b3ab6 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95
- * $Id: ufs_vnops.c,v 1.112 1999/04/27 11:18:44 phk Exp $
+ * $Id: ufs_vnops.c,v 1.113 1999/04/28 11:38:20 phk Exp $
*/
#include "opt_quota.h"
@@ -380,13 +380,13 @@ ufs_getattr(ap)
/*
* Copy from inode table
*/
- vap->va_fsid = ip->i_dev;
+ vap->va_fsid = dev2udev(ip->i_dev);
vap->va_fileid = ip->i_number;
vap->va_mode = ip->i_mode & ~IFMT;
vap->va_nlink = ip->i_effnlink;
vap->va_uid = ip->i_uid;
vap->va_gid = ip->i_gid;
- vap->va_rdev = (dev_t)ip->i_rdev;
+ vap->va_rdev = ip->i_rdev;
vap->va_size = ip->i_din.di_size;
vap->va_atime.tv_sec = ip->i_atime;
vap->va_atime.tv_nsec = ip->i_atimensec;
OpenPOWER on IntegriCloud