Use DISKUNIT macro to encode md's unit in the minor number.
This commit is contained in:
parent
3bef8402d3
commit
b9906e7600
@ -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
|
||||
;;
|
||||
|
@ -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
|
||||
;;
|
||||
|
||||
|
@ -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
|
||||
;;
|
||||
|
@ -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
|
||||
;;
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
;;
|
||||
|
13
sys/dev/md.c
13
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 <sys/disk.h>
|
||||
#include <sys/proc.h>
|
||||
#include <sys/conf.h>
|
||||
#include <sys/disklabel.h>
|
||||
|
||||
#include <vm/vm.h>
|
||||
#include <vm/vm_kern.h>
|
||||
@ -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];
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user