diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2003-05-14 00:20:39 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2003-05-14 00:20:39 +0000 |
commit | cafc243ebae5558778638ed6f6c70c9c9bbd86f4 (patch) | |
tree | 8cbf420519d09c3da1122dfc01777d9d3a734649 /sys/arch/i386 | |
parent | b4dd55d103207347b453f69c731250bd549e6b5b (diff) |
add {b,c}devsw_lookup convenience functions.
move chrtoblk and blktochr into MI code.
tested on several archs and ok deraadt@
Diffstat (limited to 'sys/arch/i386')
-rw-r--r-- | sys/arch/i386/i386/conf.c | 41 |
1 files changed, 3 insertions, 38 deletions
diff --git a/sys/arch/i386/i386/conf.c b/sys/arch/i386/i386/conf.c index b148df48c69..85189f95e66 100644 --- a/sys/arch/i386/i386/conf.c +++ b/sys/arch/i386/i386/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.101 2002/12/05 02:49:55 kjc Exp $ */ +/* $OpenBSD: conf.c,v 1.102 2003/05/14 00:20:37 tedu Exp $ */ /* $NetBSD: conf.c,v 1.75 1996/05/03 19:40:20 christos Exp $ */ /* @@ -356,7 +356,7 @@ getnulldev() return makedev(mem_no, 2); } -static int chrtoblktbl[] = { +int chrtoblktbl[] = { /* XXXX This needs to be dynamic for LKMs. */ /*VCHR*/ /*VBLK*/ /* 0 */ NODEV, @@ -415,42 +415,7 @@ static int chrtoblktbl[] = { /* 53 */ NODEV, /* 54 */ 19, }; - -/* - * Convert a character device number to a block device number. - */ -dev_t -chrtoblk(dev) - dev_t dev; -{ - int blkmaj; - - if (major(dev) >= nchrdev || - major(dev) > sizeof(chrtoblktbl)/sizeof(chrtoblktbl[0])) - return (NODEV); - blkmaj = chrtoblktbl[major(dev)]; - if (blkmaj == NODEV) - return (NODEV); - return (makedev(blkmaj, minor(dev))); -} - -/* - * Convert a block device number to a character device number. - */ -dev_t -blktochr(dev) - dev_t dev; -{ - int blkmaj = major(dev); - int i; - - if (blkmaj >= nblkdev) - return (NODEV); - for (i = 0; i < sizeof(chrtoblktbl)/sizeof(chrtoblktbl[0]); i++) - if (blkmaj == chrtoblktbl[i]) - return (makedev(i, minor(dev))); - return (NODEV); -} +int nchrtoblktbl = sizeof(chrtoblktbl) / sizeof(chrtoblktbl[0]); /* * In order to map BSD bdev numbers of disks to their BIOS equivalents |