From f95691896db58441325b8fb166935654ec90ec65 Mon Sep 17 00:00:00 2001 From: Theo de Raadt Date: Wed, 6 Nov 1996 02:01:09 +0000 Subject: add blktochr() --- sys/arch/alpha/alpha/conf.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'sys/arch') diff --git a/sys/arch/alpha/alpha/conf.c b/sys/arch/alpha/alpha/conf.c index 6cb3cb311a0..f2a566cfda7 100644 --- a/sys/arch/alpha/alpha/conf.c +++ b/sys/arch/alpha/alpha/conf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: conf.c,v 1.8 1996/10/30 22:38:00 niklas Exp $ */ +/* $OpenBSD: conf.c,v 1.9 1996/11/06 02:01:08 deraadt Exp $ */ /* $NetBSD: conf.c,v 1.16 1996/10/18 21:26:57 cgd Exp $ */ /*- @@ -270,3 +270,21 @@ chrtoblk(dev) 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); +} -- cgit v1.2.3