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/mvme88k | |
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/mvme88k')
-rw-r--r-- | sys/arch/mvme88k/mvme88k/conf.c | 41 |
1 files changed, 3 insertions, 38 deletions
diff --git a/sys/arch/mvme88k/mvme88k/conf.c b/sys/arch/mvme88k/mvme88k/conf.c index c1bcc8341b1..6989305e7c7 100644 --- a/sys/arch/mvme88k/mvme88k/conf.c +++ b/sys/arch/mvme88k/mvme88k/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.24 2002/12/05 02:49:55 kjc Exp $ */ +/* $OpenBSD: conf.c,v 1.25 2003/05/14 00:20:37 tedu Exp $ */ /*- * Copyright (c) 1991 The Regents of the University of California. @@ -246,7 +246,7 @@ getnulldev() return makedev(mem_no, 2); } -static int chrtoblktbl[] = { +int chrtoblktbl[] = { /* XXXX This needs to be dynamic for LKMs. */ /*VCHR*/ /*VBLK*/ /* 0 */ NODEV, @@ -277,42 +277,7 @@ static int chrtoblktbl[] = { /* 25 */ NODEV, /* 26 */ 10, /* XD disk */ }; - -/* - * 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 character device number to a block 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]); /* * This entire table could be autoconfig()ed but that would mean that |