summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-11-06 02:01:09 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-11-06 02:01:09 +0000
commitf95691896db58441325b8fb166935654ec90ec65 (patch)
tree513bf0c161b708dc9d6327155a4792d5c0bcede8 /sys
parentc76942909d783de97f8cee390f02bd548b3292f3 (diff)
add blktochr()
Diffstat (limited to 'sys')
-rw-r--r--sys/arch/alpha/alpha/conf.c20
1 files changed, 19 insertions, 1 deletions
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);
+}