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/mvmeppc | |
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/mvmeppc')
-rw-r--r-- | sys/arch/mvmeppc/mvmeppc/conf.c | 41 |
1 files changed, 3 insertions, 38 deletions
diff --git a/sys/arch/mvmeppc/mvmeppc/conf.c b/sys/arch/mvmeppc/mvmeppc/conf.c index 8e0100965f9..ec9a7b65c53 100644 --- a/sys/arch/mvmeppc/mvmeppc/conf.c +++ b/sys/arch/mvmeppc/mvmeppc/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.14 2002/12/05 02:49:55 kjc Exp $ */ +/* $OpenBSD: conf.c,v 1.15 2003/05/14 00:20:37 tedu Exp $ */ /* * Copyright (c) 1997 Per Fogelstrom @@ -238,7 +238,7 @@ getnulldev() return makedev(mem_no, 2); } -static int chrtoblktbl[] = { +int chrtoblktbl[] = { /*VCHR*/ /*VBLK*/ /* 0 */ NODEV, /* 1 */ NODEV, @@ -296,42 +296,7 @@ static int chrtoblktbl[] = { /* 53 */ NODEV, /* 54 */ 19, }; - -/* - * Return accompanying block dev for a char dev. - */ -int -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]); #include <dev/cons.h> |