summaryrefslogtreecommitdiffstats
path: root/sys/miscfs
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/miscfs
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/miscfs')
-rw-r--r--sys/miscfs/devfs/devfs_vnops.c8
-rw-r--r--sys/miscfs/kernfs/kernfs_vfsops.c3
-rw-r--r--sys/miscfs/specfs/spec_vnops.c4
-rw-r--r--sys/miscfs/specfs/specdev.h8
4 files changed, 9 insertions, 14 deletions
diff --git a/sys/miscfs/devfs/devfs_vnops.c b/sys/miscfs/devfs/devfs_vnops.c
index 55771ec..7dc9476 100644
--- a/sys/miscfs/devfs/devfs_vnops.c
+++ b/sys/miscfs/devfs/devfs_vnops.c
@@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
- * $Id: devfs_vnops.c,v 1.72 1999/04/28 11:37:15 phk Exp $
+ * $Id: devfs_vnops.c,v 1.73 1999/05/06 20:00:27 phk Exp $
*/
@@ -411,15 +411,15 @@ DBPRINT(("getattr\n"));
switch (file_node->type)
{
case DEV_DIR:
- vap->va_rdev = (dev_t)file_node->dvm;
+ vap->va_rdev = (udev_t)file_node->dvm;
vap->va_mode |= (S_IFDIR);
break;
case DEV_CDEV:
- vap->va_rdev = file_node->by.Cdev.dev;
+ vap->va_rdev = dev2udev(file_node->by.Cdev.dev);
vap->va_mode |= (S_IFCHR);
break;
case DEV_BDEV:
- vap->va_rdev = file_node->by.Bdev.dev;
+ vap->va_rdev = dev2udev(file_node->by.Bdev.dev);
vap->va_mode |= (S_IFBLK);
break;
case DEV_SLNK:
diff --git a/sys/miscfs/kernfs/kernfs_vfsops.c b/sys/miscfs/kernfs/kernfs_vfsops.c
index 44ddd52..7ae0a35 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.25 1999/05/07 10:11:02 phk Exp $
+ * $Id: kernfs_vfsops.c,v 1.26 1999/05/08 06:39:52 phk Exp $
*/
/*
@@ -79,7 +79,6 @@ static void
kernfs_get_rrootdev()
{
static int tried = 0;
- int bmaj = major(rootdev);
int cmaj;
if (tried) {
diff --git a/sys/miscfs/specfs/spec_vnops.c b/sys/miscfs/specfs/spec_vnops.c
index 74c30c7..636bc44 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.84 1999/05/07 10:11:05 phk Exp $
+ * $Id: spec_vnops.c,v 1.85 1999/05/08 06:39:55 phk Exp $
*/
#include <sys/param.h>
@@ -162,7 +162,7 @@ spec_open(ap)
{
struct proc *p = ap->a_p;
struct vnode *bvp, *vp = ap->a_vp;
- dev_t bdev, dev = (dev_t)vp->v_rdev;
+ dev_t bdev, dev = vp->v_rdev;
int maj = major(dev);
int error;
struct cdevsw *dsw;
diff --git a/sys/miscfs/specfs/specdev.h b/sys/miscfs/specfs/specdev.h
index a7e2bab..d0cfd77 100644
--- a/sys/miscfs/specfs/specdev.h
+++ b/sys/miscfs/specfs/specdev.h
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)specdev.h 8.6 (Berkeley) 5/21/95
- * $Id: specdev.h,v 1.15 1998/04/19 23:32:29 julian Exp $
+ * $Id: specdev.h,v 1.16 1999/02/25 05:22:30 dillon Exp $
*/
/*
@@ -60,11 +60,7 @@ struct specinfo {
* Special device management
*/
#define SPECHSZ 64
-#if ((SPECHSZ&(SPECHSZ-1)) == 0)
-#define SPECHASH(rdev) (((rdev>>5)+(rdev))&(SPECHSZ-1))
-#else
-#define SPECHASH(rdev) (((unsigned)((rdev>>5)+(rdev)))%SPECHSZ)
-#endif
+#define SPECHASH(rdev) (((unsigned)(minor(rdev)))%SPECHSZ)
extern struct vnode *speclisth[SPECHSZ];
OpenPOWER on IntegriCloud