summaryrefslogtreecommitdiff
path: root/sys/arch/sparc
diff options
context:
space:
mode:
authorTed Unangst <tedu@cvs.openbsd.org>2003-05-14 00:20:39 +0000
committerTed Unangst <tedu@cvs.openbsd.org>2003-05-14 00:20:39 +0000
commitcafc243ebae5558778638ed6f6c70c9c9bbd86f4 (patch)
tree8cbf420519d09c3da1122dfc01777d9d3a734649 /sys/arch/sparc
parentb4dd55d103207347b453f69c731250bd549e6b5b (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/sparc')
-rw-r--r--sys/arch/sparc/sparc/conf.c41
1 files changed, 3 insertions, 38 deletions
diff --git a/sys/arch/sparc/sparc/conf.c b/sys/arch/sparc/sparc/conf.c
index 5e68aff6dd6..dee3953b7ed 100644
--- a/sys/arch/sparc/sparc/conf.c
+++ b/sys/arch/sparc/sparc/conf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conf.c,v 1.36 2003/04/13 22:55:52 miod Exp $ */
+/* $OpenBSD: conf.c,v 1.37 2003/05/14 00:20:37 tedu Exp $ */
/* $NetBSD: conf.c,v 1.40 1996/04/11 19:20:03 thorpej Exp $ */
/*
@@ -306,7 +306,7 @@ getnulldev()
return makedev(mem_no, 2);
}
-static int chrtoblktbl[] = {
+int chrtoblktbl[] = {
/* XXXX This needs to be dynamic for LKMs. */
/*VCHR*/ /*VBLK*/
/* 0 */ NODEV,
@@ -434,39 +434,4 @@ static int chrtoblktbl[] = {
/*122 */ NODEV,
/*123 */ 25,
};
-
-/*
- * Routine to convert from character to block device number.
- */
-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]);