Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | |
| 3 | if test "$#" != "2"; then |
| 4 | echo "Usage: sh `basename $0` {dir} {shelfaddress}" 1>&2 |
ecashin@coraid.com | d098840 | 2005-04-18 22:00:20 -0700 | [diff] [blame] | 5 | echo " n_partitions=16 sh `basename $0` {dir} {shelfaddress}" 1>&2 |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 6 | exit 1 |
| 7 | fi |
| 8 | n_partitions=${n_partitions:-16} |
| 9 | dir=$1 |
| 10 | shelf=$2 |
Ed L Cashin | e39526e | 2005-08-19 16:54:43 -0400 | [diff] [blame] | 11 | nslots=16 |
| 12 | maxslot=`echo $nslots 1 - p | dc` |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | MAJOR=152 |
| 14 | |
| 15 | set -e |
| 16 | |
Ed L Cashin | e39526e | 2005-08-19 16:54:43 -0400 | [diff] [blame] | 17 | minor=`echo $nslots \* $shelf \* $n_partitions | bc` |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 18 | endp=`echo $n_partitions - 1 | bc` |
Ed L Cashin | e39526e | 2005-08-19 16:54:43 -0400 | [diff] [blame] | 19 | for slot in `seq 0 $maxslot`; do |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 20 | for part in `seq 0 $endp`; do |
| 21 | name=e$shelf.$slot |
| 22 | test "$part" != "0" && name=${name}p$part |
| 23 | rm -f $dir/$name |
| 24 | mknod -m 0660 $dir/$name b $MAJOR $minor |
| 25 | |
| 26 | minor=`expr $minor + 1` |
| 27 | done |
| 28 | done |