blob: 32615814271cce1f90e6be56d5a26eb15c12de3d [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001#! /bin/sh
2
3if test "$#" != "2"; then
4 echo "Usage: sh `basename $0` {dir} {shelfaddress}" 1>&2
ecashin@coraid.comd0988402005-04-18 22:00:20 -07005 echo " n_partitions=16 sh `basename $0` {dir} {shelfaddress}" 1>&2
Linus Torvalds1da177e2005-04-16 15:20:36 -07006 exit 1
7fi
8n_partitions=${n_partitions:-16}
9dir=$1
10shelf=$2
Ed L Cashine39526e2005-08-19 16:54:43 -040011nslots=16
12maxslot=`echo $nslots 1 - p | dc`
Linus Torvalds1da177e2005-04-16 15:20:36 -070013MAJOR=152
14
15set -e
16
Ed L Cashine39526e2005-08-19 16:54:43 -040017minor=`echo $nslots \* $shelf \* $n_partitions | bc`
Linus Torvalds1da177e2005-04-16 15:20:36 -070018endp=`echo $n_partitions - 1 | bc`
Ed L Cashine39526e2005-08-19 16:54:43 -040019for slot in `seq 0 $maxslot`; do
Linus Torvalds1da177e2005-04-16 15:20:36 -070020 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
28done