File: mkdev.ida

package info (click to toggle)
kernel-source-2.4.14 2.4.14-1
  • links: PTS
  • area: main
  • in suites: woody
  • size: 139,160 kB
  • ctags: 428,423
  • sloc: ansic: 2,435,554; asm: 141,119; makefile: 8,258; sh: 3,099; perl: 2,561; yacc: 1,177; cpp: 755; tcl: 577; lex: 352; awk: 251; lisp: 218; sed: 72
file content (40 lines) | stat: -rw-r--r-- 1,037 bytes parent folder | download | duplicates (15)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/sh
# Script to create device nodes for SMART array controllers
# Usage:
#	mkdev.ida [num controllers] [num log volumes] [num partitions]
#
# With no arguments, the script assumes 1 controller, 16 logical volumes,
# and 16 partitions/volume, which is adequate for most configurations.
#
# If you had 5 controllers and were planning on no more than 4 logical volumes
# each, using a maximum of 8 partitions per volume, you could say:
#
# mkdev.ida 5 4 8
#
# Of course, this has no real benefit over "mkdev.ida 5" except that it
# doesn't create so many device nodes in /dev/ida.

NR_CTLR=${1-1}
NR_VOL=${2-16}
NR_PART=${3-16}

if [ ! -d /dev/ida ]; then
	mkdir -p /dev/ida
fi

C=0; while [ $C -lt $NR_CTLR ]; do
	MAJ=`expr $C + 72`
	D=0; while [ $D -lt $NR_VOL ]; do
		P=0; while [ $P -lt $NR_PART ]; do
			MIN=`expr $D \* 16 + $P`
			if [ $P -eq 0 ]; then
				mknod /dev/ida/c${C}d${D} b $MAJ $MIN
			else
				mknod /dev/ida/c${C}d${D}p${P} b $MAJ $MIN
			fi
			P=`expr $P + 1`
		done
		D=`expr $D + 1`
	done
	C=`expr $C + 1`
done