From b9906e76004cc9d8dc0f4fc3e0621c697dca2d13 Mon Sep 17 00:00:00 2001 From: leo Date: Fri, 1 Aug 1997 19:38:30 +0000 Subject: [PATCH] Use DISKUNIT macro to encode md's unit in the minor number. --- etc/etc.arm32/MAKEDEV | 6 +++--- etc/etc.atari/MAKEDEV | 11 ++++++----- etc/etc.pc532/MAKEDEV | 6 +++--- etc/etc.sparc/MAKEDEV | 6 +++--- etc/etc.sun3/MAKEDEV | 8 ++++---- etc/etc.x68k/MAKEDEV | 6 +++--- sys/dev/md.c | 13 +++++++------ 7 files changed, 29 insertions(+), 27 deletions(-) diff --git a/etc/etc.arm32/MAKEDEV b/etc/etc.arm32/MAKEDEV index f083b71f5a40..5d921e84e3d2 100644 --- a/etc/etc.arm32/MAKEDEV +++ b/etc/etc.arm32/MAKEDEV @@ -1,6 +1,6 @@ #!/bin/sh - # -# $NetBSD: MAKEDEV,v 1.13 1997/07/31 04:08:21 perry Exp $ +# $NetBSD: MAKEDEV,v 1.14 1997/08/01 19:38:30 leo Exp $ # # Copyright (c) 1990 The Regents of the University of California. # All rights reserved. @@ -282,11 +282,11 @@ cd*|acd*) ;; md*) - unit=`expr $i : 'md\(.*\)'` + unit=${i#md} rm -f md${unit} rm -f md${unit}c mknod md${unit} b 18 ${unit} - mknod md${unit}c c 18 `expr ${unit} + 16` + mknod md${unit}c c 18 $((($unit + 16) * 8)) chown root.wheel md${unit} chown root.wheel md${unit}c ;; diff --git a/etc/etc.atari/MAKEDEV b/etc/etc.atari/MAKEDEV index df16b125b66f..78938cc6df52 100644 --- a/etc/etc.atari/MAKEDEV +++ b/etc/etc.atari/MAKEDEV @@ -1,6 +1,6 @@ #!/bin/sh - # -# $NetBSD: MAKEDEV,v 1.20 1997/07/31 04:08:22 perry Exp $ +# $NetBSD: MAKEDEV,v 1.21 1997/08/01 19:38:42 leo Exp $ # # Copyright (c) 1990 The Regents of the University of California. # All rights reserved. @@ -106,7 +106,7 @@ all) floppy) sh MAKEDEV std st0 ttye0 ttye1 ttye2 grf0 grf1 grf2 kbd tun0 tun1 - sh MAKEDEV sd0 sd1 sd2 sd3 sd4 wd0 wd1 cd0 fd0 md0 rtc + sh MAKEDEV sd0 sd1 sd2 sd3 sd4 wd0 wd1 cd0 fd0 md0 md1 rtc ;; std) @@ -214,9 +214,10 @@ fd*) umask 77 ;; -md0) # Memory disk, only useful for boot-floppy - umask 2; rm -f md0 - mknod md0 b 1 0 +md*) # Memory disk, only useful for boot-floppy + unit=${i#md} + umask 2; rm -f md${unit} + mknod md${unit} b 1 $(($unit * 16)) umask 77 ;; diff --git a/etc/etc.pc532/MAKEDEV b/etc/etc.pc532/MAKEDEV index cf1d866a0c84..b213d1a1e84d 100644 --- a/etc/etc.pc532/MAKEDEV +++ b/etc/etc.pc532/MAKEDEV @@ -1,6 +1,6 @@ #!/bin/sh - # -# $NetBSD: MAKEDEV,v 1.16 1997/07/31 04:08:33 perry Exp $ +# $NetBSD: MAKEDEV,v 1.17 1997/08/01 19:38:44 leo Exp $ # # Copyright (c) 1990 The Regents of the University of California. # All rights reserved. @@ -116,8 +116,8 @@ md*) md*) name=md; unit=${i#md}; chr=9; blk=3;; esac rm -f $name$unit r$name$unit - mknod $name$unit b $blk $(($unit + 0)) - mknod r$name$unit c $chr $(($unit + 16)) + mknod $name$unit b $blk $(($unit * 8 + 0)) + mknod r$name$unit c $chr $((($unit + 16) * 8)) chgrp operator $name$unit r$name$unit chmod 640 $name$unit r$name$unit ;; diff --git a/etc/etc.sparc/MAKEDEV b/etc/etc.sparc/MAKEDEV index 8ffe23fddce8..127bb37d363b 100644 --- a/etc/etc.sparc/MAKEDEV +++ b/etc/etc.sparc/MAKEDEV @@ -1,6 +1,6 @@ #!/bin/sh - # -# $NetBSD: MAKEDEV,v 1.28 1997/07/31 04:08:37 perry Exp $ +# $NetBSD: MAKEDEV,v 1.29 1997/08/01 19:38:46 leo Exp $ # # Copyright (c) 1990 The Regents of the University of California. # All rights reserved. @@ -194,8 +194,8 @@ tun*) md*) unit=${i#md} rm -f md$unit - mknod md$unit b 5 $unit - mknod rmd$unit c 61 $unit + mknod md${unit} b 5 $(($unit * 8)) + mknod rmd${unit} c 61 $((($unit + 16) * 8)) chown root.operator md$unit rmd$unit chmod 640 md$unit rmd$unit ;; diff --git a/etc/etc.sun3/MAKEDEV b/etc/etc.sun3/MAKEDEV index 081e8a679a51..5f9a23881066 100644 --- a/etc/etc.sun3/MAKEDEV +++ b/etc/etc.sun3/MAKEDEV @@ -1,6 +1,6 @@ #!/bin/sh - # -# $NetBSD: MAKEDEV,v 1.14 1997/07/31 04:08:38 perry Exp $ +# $NetBSD: MAKEDEV,v 1.15 1997/08/01 19:38:48 leo Exp $ # # Copyright (c) 1990 The Regents of the University of California. # All rights reserved. @@ -226,9 +226,9 @@ cgfour*) ;; md*) - mk md$unit b 13 $unit -# mk rmd$unit b 13 `expr $unit + 16` - mk md${unit}c b 13 `expr $unit + 16` + mknod md${unit} b 13 $(($unit * 8)) +# mknod rmd${unit} b 13 $((($unit + 16) * 8)) + mknod md${unit}c b 13 $((($unit + 16) * 8)) ;; local) diff --git a/etc/etc.x68k/MAKEDEV b/etc/etc.x68k/MAKEDEV index 95b98a59ce24..8d2df6c69879 100755 --- a/etc/etc.x68k/MAKEDEV +++ b/etc/etc.x68k/MAKEDEV @@ -1,6 +1,6 @@ #!/bin/sh - # -# $NetBSD: MAKEDEV,v 1.12 1997/07/31 04:08:42 perry Exp $ +# $NetBSD: MAKEDEV,v 1.13 1997/08/01 19:38:50 leo Exp $ # # Copyright (c) 1990 The Regents of the University of California. # All rights reserved. @@ -268,8 +268,8 @@ md*) md*) name=md; unit=${i#md}; blk=8; chr=7;; esac rm -f $name$unit r$name$unit - mknod $name$unit b $blk $(($unit + 0)) - mknod r$name$unit c $chr $(($unit + 16)) + mknod $name$unit b $blk $(($unit * 8 + 0)) + mknod r$name$unit c $chr $((($unit + 16) * 8)) chgrp operator $name$unit r$name$unit chmod 640 $name$unit r$name$unit ;; diff --git a/sys/dev/md.c b/sys/dev/md.c index 739fdf0a46cb..97373fcc786d 100644 --- a/sys/dev/md.c +++ b/sys/dev/md.c @@ -1,4 +1,4 @@ -/* $NetBSD: md.c,v 1.13 1997/05/23 23:44:34 jeremy Exp $ */ +/* $NetBSD: md.c,v 1.14 1997/08/01 19:44:11 leo Exp $ */ /* * Copyright (c) 1995 Gordon W. Ross, Leo Weppelman. @@ -54,6 +54,7 @@ #include #include #include +#include #include #include @@ -223,7 +224,7 @@ int mdsize(dev_t dev) struct md_softc *sc; /* Disallow control units. */ - unit = minor(dev); + unit = DISKUNIT(dev); if (unit >= ramdisk_ndevs) return 0; sc = ramdisk_devs[unit]; @@ -245,7 +246,7 @@ mdopen(dev, flag, fmt, proc) int md, unit; struct md_softc *sc; - md = minor(dev); + md = DISKUNIT(dev); unit = MD_UNIT(md); if (unit >= ramdisk_ndevs) return ENXIO; @@ -286,7 +287,7 @@ mdclose(dev, flag, fmt, proc) int md, unit; struct md_softc *sc; - md = minor(dev); + md = DISKUNIT(dev); unit = MD_UNIT(md); sc = ramdisk_devs[unit]; @@ -330,7 +331,7 @@ mdstrategy(bp) caddr_t addr; size_t off, xfer; - md = minor(bp->b_dev); + md = DISKUNIT(bp->b_dev); unit = MD_UNIT(md); sc = ramdisk_devs[unit]; @@ -392,7 +393,7 @@ mdioctl(dev, cmd, data, flag, proc) struct md_softc *sc; struct md_conf *umd; - md = minor(dev); + md = DISKUNIT(dev); unit = MD_UNIT(md); sc = ramdisk_devs[unit];