summaryrefslogtreecommitdiffstats
path: root/ccw_init
diff options
context:
space:
mode:
authorDan Horák <dan@danny.cz>2010-03-29 15:43:50 +0200
committerDan Horák <dan@danny.cz>2010-03-29 15:43:50 +0200
commitba5188dbbe65c9473f312a4d5e46f7d203d5af04 (patch)
tree306548d2399a0b5342577fdd73362e28a6fba119 /ccw_init
parent3790592efda2302d245c3bfaa23ff2d717e1e6dc (diff)
downloadutils-ba5188dbbe65c9473f312a4d5e46f7d203d5af04.tar.gz
utils-ba5188dbbe65c9473f312a4d5e46f7d203d5af04.tar.xz
utils-ba5188dbbe65c9473f312a4d5e46f7d203d5af04.zip
add ccw udev stuff
Diffstat (limited to 'ccw_init')
-rw-r--r--ccw_init76
1 files changed, 76 insertions, 0 deletions
diff --git a/ccw_init b/ccw_init
new file mode 100644
index 0000000..67beb58
--- /dev/null
+++ b/ccw_init
@@ -0,0 +1,76 @@
+#!/bin/bash
+
+[ -z "$DEVPATH" ] && exit 0
+[ "$SUBSYSTEM" != "ccw" ] && exit 0
+
+NOLOCALE="yes"
+
+. /etc/sysconfig/network-scripts/network-functions
+
+# First, determine our channel
+
+CHANNEL=${DEVPATH##*/}
+
+CONFIG=$(get_config_by_subchannel $CHANNEL)
+
+if [ -n "$CONFIG" ]; then
+ cd /etc/sysconfig/network-scripts
+ source_config
+fi
+
+# put LAYER2 option into its own variable
+set $OPTIONS
+OPTIONS=""
+while [ $# -gt 0 ]; do
+ case $1 in
+ layer2=*) LAYER2=${1##layer2=};;
+ *=*) OPTIONS="$OPTIONS $1";;
+ esac
+ shift
+done
+
+# SUBCHANNELS is only set on mainframe ccwgroup devices
+[ -z "$SUBCHANNELS" -o -z "$NETTYPE" ] && exit 0
+DIR="/sys/bus/ccwgroup/drivers/$NETTYPE"
+
+i=0
+while [ $i -lt 20 ]; do
+ [ -e $DIR ] && break
+ sleep 0.1
+ i=$(($i+1))
+done
+
+# driver missing or not loaded
+[ ! -e $DIR ] && exit 0
+
+SYSDIR="$DIR/${SUBCHANNELS//,*/}"
+[ -e $SYSDIR ] && exit 0
+echo "$SUBCHANNELS" > $DIR/group
+
+i=0
+while [ $i -lt 20 ]; do
+ [ -e $SYSDIR ] && break
+ sleep 0.1
+ i=$(($i+1))
+done
+
+# first set layer2, other options may depend on it
+[ -n "$LAYER2" ] && echo $LAYER2 > $SYSDIR/layer2
+
+if [ -n "$PORTNAME" ]; then
+ if [ "$NETTYPE" = "lcs" ]; then
+ [ -e $SYSDIR/portno ] && echo "$PORTNAME" > $SYSDIR/portno
+ else
+ [ -e $SYSDIR/portname ] && echo "$PORTNAME" > $SYSDIR/portname
+ fi
+fi
+if [ "$NETTYPE" = "ctc" -a -n "$CTCPROT" ]; then
+ echo "$CTCPROT" > $SYSDIR/protocol
+fi
+if [ -n "$OPTIONS" ]; then
+
+ for i in $OPTIONS; do
+ echo "${i//*=/}" > "$SYSDIR/${i//=*/}"
+ done
+fi
+[ -e $SYSDIR/online ] && echo 1 > $SYSDIR/online