From 0b9732be4acf2b6313b1161d4a5e2414ca72cfae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dan=20Hor=C3=A1k?= Date: Thu, 12 Nov 2009 14:42:15 +0000 Subject: [PATCH] - added udev rules and script for dasd initialization (#536966) - added ghosted zfcp and dasd config files, fixes their ownership on the system - fixed upgrade path for libzfcphbaapi-devel subpackage --- dasd.udev | 16 +++++++++ dasdconf.sh | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++ s390utils.spec | 19 +++++++++- 3 files changed, 128 insertions(+), 1 deletion(-) create mode 100644 dasd.udev create mode 100644 dasdconf.sh diff --git a/dasd.udev b/dasd.udev new file mode 100644 index 0000000..5364935 --- /dev/null +++ b/dasd.udev @@ -0,0 +1,16 @@ +ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="dasd-eckd", RUN+="/sbin/dasdconf.sh" +ACTION=="add", SUBSYSTEM=="drivers", KERNEL=="dasd-fba", RUN+="/sbin/dasdconf.sh" + +# This list should be autogenerated with "modinfo dasd_{eckd,fba}_mod" +ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t1750m*dt3380dm*", RUN+="/sbin/dasdconf.sh" +ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t1750m*dt3390dm*", RUN+="/sbin/dasdconf.sh" +ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t2107m*dt3380dm*", RUN+="/sbin/dasdconf.sh" +ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t2107m*dt3390dm*", RUN+="/sbin/dasdconf.sh" +ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t9343m*dt9345dm*", RUN+="/sbin/dasdconf.sh" +ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t2105m*dt3380dm*", RUN+="/sbin/dasdconf.sh" +ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t3990m*dt3380dm*", RUN+="/sbin/dasdconf.sh" +ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t3880m*dt3390dm*", RUN+="/sbin/dasdconf.sh" +ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t2105m*dt3390dm*", RUN+="/sbin/dasdconf.sh" +ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t3990m*dt3390dm*", RUN+="/sbin/dasdconf.sh" +ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t3880m*dt3370dm*", RUN+="/sbin/dasdconf.sh" +ACTION=="add", SUBSYSTEM=="ccw", ATTR{modalias}=="ccw:t6310m*dt9336dm*", RUN+="/sbin/dasdconf.sh" diff --git a/dasdconf.sh b/dasdconf.sh new file mode 100644 index 0000000..fb3ac90 --- /dev/null +++ b/dasdconf.sh @@ -0,0 +1,94 @@ +#!/bin/sh + +# config file syntax: +# deviceno sysfs_opts... +# +# Examples: +# 0.0.0203 readonly=1 failfast=1 +# 0.0.0204 +# 0.0.0205 erplog=1 + +[ -z "$DEVPATH" ] && exit 0 +[ "$ACTION" != "add" ] && exit 0 + +CHANNEL=${DEVPATH##*/} + +CONFIG=/etc/dasd.conf +PATH=/sbin:/bin:/usr/sbin:/usr/bin +export PATH + +warn() { + [ -e /dev/kmsg ] && echo "<4>dasdconf.sh Warning: $@" > /dev/kmsg + echo "dasdconf.sh Warning: $@" >&2 +} + +if [ -f "$CONFIG" ]; then + if [ ! -d /sys/bus/ccw/drivers/dasd-eckd ] && [ ! -d /sys/bus/ccw/drivers/dasd-fba ]; then + #warn "No dasd-eckd or dasd-eckd loaded" + exit 0 + fi + tr "A-Z" "a-z" < $CONFIG | while read line; do + case $line in + \#*) ;; + *) + [ -z "$line" ] && continue + set $line + + # if we are in single add mode, only add the new CHANNEL + [ "$SUBSYSTEM" = "ccw" ] && [ "$1" != "$CHANNEL" ] && continue + + DEVICE=$1 + SYSFSPATH= + + if [ -r "/sys/bus/ccw/drivers/dasd-eckd/$DEVICE" ]; then + SYSFSPATH="/sys/bus/ccw/drivers/dasd-eckd/$DEVICE" + elif [ -r "/sys/bus/ccw/drivers/dasd-fba/$DEVICE" ]; then + SYSFSPATH="/sys/bus/ccw/drivers/dasd-fba/$DEVICE" + else + # if we are in single add mode, this is a failure! + [ "$SUBSYSTEM" = "ccw" ] && warn "Could not find $DEVICE in sysfs" + continue + fi + + # skip already onlined devices + if [ "$(cat $SYSFSPATH/online)" = "1" ]; then + if [ "$SUBSYSTEM" = "ccw" ]; then + # if we are in single add mode, we should not touch the device + warn "$DEVICE is already online, not configuring" + exit 0 + fi + continue + fi + + shift + while [ -n "$1" ]; do + ( + attribute="$1" + IFS="=" + set $attribute + + if [ "$1" = "use_diag" ]; then + # this module better only returns after + # all sysfs entries have the "use_diag" file + modprobe dasd_diag_mod + fi + + if [ -r "$SYSFSPATH/$1" ]; then + echo $2 > $SYSFSPATH/$1 || warn "Could not set $1=$2 for $DEVICE" + else + warn "$1 does not exist for $DEVICE" + fi + ) + shift + done + + # Now, put the device online + echo 1 > $SYSFSPATH/online || echo "Could not activate $DEVICE" + + # if we are in single add mode, we are done + [ "$SUBSYSTEM" = "ccw" ] && exit 0 + ;; + esac + done +fi +exit 0 diff --git a/s390utils.spec b/s390utils.spec index d9da99b..e46cdb6 100644 --- a/s390utils.spec +++ b/s390utils.spec @@ -8,7 +8,7 @@ Name: s390utils Summary: Utilities and daemons for IBM System/z Group: System Environment/Base Version: 1.8.2 -Release: 3%{?dist} +Release: 4%{?dist} Epoch: 2 License: GPLv2 and GPLv2+ and CPL Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) @@ -28,6 +28,9 @@ Source9: http://download.boulder.ibm.com/ibmdl/pub/software/dw/linux390/h # files for the Control Program Identification (Linux Call Home) feature (#463282) Source10: cpi.initd Source11: cpi.sysconfig +# files for DASD initialization +Source12: dasd.udev +Source13: dasdconf.sh Patch1: 0001-s390-tools-1.5.3-zipl-zfcpdump-2.patch Patch2: 0002-s390-tools-1.8.1-zipl-automenu.patch @@ -186,7 +189,11 @@ install -p -m 644 zipl/boot/tape0.bin $RPM_BUILD_ROOT/boot/tape0 install -p -m 644 %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d install -p -m 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d install -p -m 755 %{SOURCE5} $RPM_BUILD_ROOT/sbin +install -p -m 755 %{SOURCE13} $RPM_BUILD_ROOT/sbin install -p -m 644 %{SOURCE7} $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d/56-zfcp.rules +install -p -m 644 %{SOURCE12} $RPM_BUILD_ROOT%{_sysconfdir}/udev/rules.d/56-dasd.rules + +touch $RPM_BUILD_ROOT%{_sysconfdir}/{zfcp.conf,dasd.conf} install -p -m 644 etc/sysconfig/dumpconf ${RPM_BUILD_ROOT}%{_sysconfdir}/sysconfig install -p -m 755 etc/init.d/dumpconf ${RPM_BUILD_ROOT}%{_initddir}/dumpconf @@ -485,8 +492,12 @@ fi %{_sysconfdir}/profile.d/s390.csh %{_sysconfdir}/profile.d/s390.sh %config(noreplace) %{_sysconfdir}/udev/rules.d/56-zfcp.rules +%config(noreplace) %{_sysconfdir}/udev/rules.d/56-dasd.rules %config(noreplace) %{_sysconfdir}/udev/rules.d/59-dasd.rules %config(noreplace) %{_sysconfdir}/udev/rules.d/60-readahead.rules +%ghost %config(noreplace) %{_sysconfdir}/dasd.conf +%ghost %config(noreplace) %{_sysconfdir}/zfcp.conf +/sbin/dasdconf.sh /sbin/zfcpconf.sh # src_vipa @@ -693,6 +704,7 @@ BuildRequires: automake autoconf BuildRequires: doxygen libsysfs-devel BuildRequires: sg3_utils-devel Requires: libhbaapi +Obsoletes: %{name}-libzfcphbaapi-devel < 2:1.8.2-4 %description libzfcphbaapi @@ -774,6 +786,11 @@ User-space development files for the s390/s390x architecture. %changelog +* Thu Nov 12 2009 Dan Horák 2:1.8.2-4 +- added udev rules and script for dasd initialization (#536966) +- added ghosted zfcp and dasd config files, fixes their ownership on the system +- fixed upgrade path for libzfcphbaapi-devel subpackage + * Mon Nov 9 2009 Dan Horák 2:1.8.2-3 - added files for the CPI feature (#463282) - built lib-zfcp-hbaabi library as vendor lib, switched from -devel (no devel content now) to -docs subpackage (#532707)