1#!/bin/sh
2# Script to create device nodes for SMART array controllers
3# Usage:
4#	mkdev.ida [num controllers] [num log volumes] [num partitions]
5#
6# With no arguments, the script assumes 1 controller, 16 logical volumes,
7# and 16 partitions/volume, which is adequate for most configurations.
8#
9# If you had 5 controllers and were planning on no more than 4 logical volumes
10# each, using a maximum of 8 partitions per volume, you could say:
11#
12# mkdev.ida 5 4 8
13#
14# Of course, this has no real benefit over "mkdev.ida 5" except that it
15# doesn't create so many device nodes in /dev/ida.
16
17NR_CTLR=${1-1}
18NR_VOL=${2-16}
19NR_PART=${3-16}
20
21if [ ! -d /dev/ida ]; then
22	mkdir -p /dev/ida
23fi
24
25C=0; while [ $C -lt $NR_CTLR ]; do
26	MAJ=`expr $C + 72`
27	D=0; while [ $D -lt $NR_VOL ]; do
28		P=0; while [ $P -lt $NR_PART ]; do
29			MIN=`expr $D \* 16 + $P`
30			if [ $P -eq 0 ]; then
31				mknod /dev/ida/c${C}d${D} b $MAJ $MIN
32			else
33				mknod /dev/ida/c${C}d${D}p${P} b $MAJ $MIN
34			fi
35			P=`expr $P + 1`
36		done
37		D=`expr $D + 1`
38	done
39	C=`expr $C + 1`
40done
41