From cafc243ebae5558778638ed6f6c70c9c9bbd86f4 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Wed, 14 May 2003 00:20:39 +0000 Subject: add {b,c}devsw_lookup convenience functions. move chrtoblk and blktochr into MI code. tested on several archs and ok deraadt@ --- sys/arch/mvme88k/mvme88k/conf.c | 41 +++-------------------------------------- 1 file changed, 3 insertions(+), 38 deletions(-) (limited to 'sys/arch/mvme88k') 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 -- cgit v1.2.3