1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- #! /bin/sh
- # aoe-mkshelf - device nodes for one shelf without udev
- # Copyright 2009, CORAID, Inc., and licensed under GPL v.2.
- zero=`basename $0`
- if test "$#" != "2"; then
- echo "Usage: $zero {dir} {shelfaddress}" 1>&2
- echo " n_partitions=16 $zero {dir} {shelfaddress}" 1>&2
- exit 1
- fi
- dyn=/sys/module/aoe/parameters/aoe_dyndevs
- if test -r "$dyn" && test "`cat $dyn`" = 1; then
- cat 1>&2 <<EOF
- $zero Error: aoe module is using dynamic devices.
- $zero: Please see the aoe-mkshelf manpage.
- $zero: Exiting.
- EOF
- exit 1
- fi
- if test "`ps axwwww | grep 'udev[d]'`" || test -d "/dev/.udev"; then
- cat 1>&2 <<EOF
- $zero Error: udev detected. You shouldn't need to use $zero.
- $zero: Please see the aoe-mkshelf manpage.
- $zero: Exiting.
- EOF
- exit 1
- fi
- n_partitions=${n_partitions:-16}
- dir=$1
- shelf=$2
- nslots=@npershelf@
- maxslot=$(($nslots - 1))
- MAJOR=152
- set -e
- minor=$(($nslots * $shelf * $n_partitions))
- endp=$(($n_partitions - 1))
- for slot in `seq 0 $maxslot`; do
- for part in `seq 0 $endp`; do
- name=e$shelf.$slot
- test "$part" != "0" && name=${name}p$part
- rm -f $dir/$name
- mknod -m 0660 $dir/$name b $MAJOR $minor
- minor=`expr $minor + 1`
- done
- done
|