Blame 0010-feat-dasd_rules-remove-dasd-handling-consolidated-in.patch

218d2d
From 7294e45b5204e47bb8ee2108e2c38c5843e64fac Mon Sep 17 00:00:00 2001
218d2d
From: Steffen Maier <maier@linux.ibm.com>
218d2d
Date: Thu, 23 Mar 2023 18:06:23 +0100
218d2d
Subject: [PATCH 10/23] feat(dasd_rules): remove dasd handling consolidated in
218d2d
 s390-tools
218d2d
218d2d
These are handled by s390-tools zdev dracut module 95zdev as of
218d2d
https://github.com/ibm-s390-linux/s390-tools/commit/99270236805972544932feab9692ee7122a343b8
218d2d
("zdev/dracut: add rd.dasd cmdline option handling").
218d2d
218d2d
Even though this removes one implementation of parsing rd.dasd in dracut,
218d2d
above s390-tools change introduces another implementation of parsing the
218d2d
exact same rd.dasd syntax. Therefore, it would be good to keep the
218d2d
documentation in man/dracut.cmdline.7 of dracut as one central place
218d2d
describing all s390 device types that dracut handles.
218d2d
218d2d
module-setup.sh having copied all udev rules from the root-fs into the
218d2d
initrd conflicted with s390-tools dracut module zdev-kdump, which
218d2d
intentionally only activates the dependencies of the kdump target.
218d2d
218d2d
Signed-off-by: Steffen Maier <maier@linux.ibm.com>
218d2d
---
218d2d
 modules.d/95dasd_rules/module-setup.sh | 65 --------------------------
218d2d
 modules.d/95dasd_rules/parse-dasd.sh   | 43 -----------------
218d2d
 2 files changed, 108 deletions(-)
218d2d
 delete mode 100755 modules.d/95dasd_rules/module-setup.sh
218d2d
 delete mode 100755 modules.d/95dasd_rules/parse-dasd.sh
218d2d
218d2d
diff --git a/modules.d/95dasd_rules/module-setup.sh b/modules.d/95dasd_rules/module-setup.sh
218d2d
deleted file mode 100755
218d2d
index 06c57a48..00000000
218d2d
--- a/modules.d/95dasd_rules/module-setup.sh
218d2d
+++ /dev/null
218d2d
@@ -1,65 +0,0 @@
218d2d
-#!/bin/bash
218d2d
-
218d2d
-# called by dracut
218d2d
-cmdline() {
218d2d
-    is_dasd() {
218d2d
-        local _dev=$1
218d2d
-        local _devpath
218d2d
-        _devpath=$(
218d2d
-            cd -P /sys/dev/block/"$_dev" || exit
218d2d
-            echo "$PWD"
218d2d
-        )
218d2d
-
218d2d
-        [ "${_devpath#*/dasd}" == "$_devpath" ] && return 1
218d2d
-        _ccw="${_devpath%%/block/*}"
218d2d
-        echo "rd.dasd=${_ccw##*/}"
218d2d
-        return 0
218d2d
-    }
218d2d
-    [[ $hostonly ]] || [[ $mount_needs ]] && {
218d2d
-        for_each_host_dev_and_slaves_all is_dasd || return 255
218d2d
-    } | sort | uniq
218d2d
-}
218d2d
-
218d2d
-# called by dracut
218d2d
-check() {
218d2d
-    local _arch=${DRACUT_ARCH:-$(uname -m)}
218d2d
-    local found=0
218d2d
-    local bdev
218d2d
-    [ "$_arch" = "s390" -o "$_arch" = "s390x" ] || return 1
218d2d
-
218d2d
-    [[ $hostonly ]] || [[ $mount_needs ]] && {
218d2d
-        for bdev in /sys/block/*; do
218d2d
-            case "${bdev##*/}" in
218d2d
-                dasd*)
218d2d
-                    found=$((found + 1))
218d2d
-                    break
218d2d
-                    ;;
218d2d
-            esac
218d2d
-        done
218d2d
-        [ $found -eq 0 ] && return 255
218d2d
-    }
218d2d
-    return 0
218d2d
-}
218d2d
-
218d2d
-# called by dracut
218d2d
-depends() {
218d2d
-    echo 'dasd_mod' bash
218d2d
-    return 0
218d2d
-}
218d2d
-
218d2d
-# called by dracut
218d2d
-install() {
218d2d
-    inst_hook cmdline 30 "$moddir/parse-dasd.sh"
218d2d
-    if [[ $hostonly_cmdline == "yes" ]]; then
218d2d
-        local _dasd
218d2d
-        _dasd=$(cmdline)
218d2d
-        [[ $_dasd ]] && printf "%s\n" "$_dasd" >> "${initdir}/etc/cmdline.d/95dasd.conf"
218d2d
-    fi
218d2d
-    if [[ $hostonly ]]; then
218d2d
-        inst_rules_wildcard "51-dasd-*.rules"
218d2d
-        inst_rules_wildcard "41-dasd-*.rules"
218d2d
-        mark_hostonly /etc/udev/rules.d/51-dasd-*.rules
218d2d
-        mark_hostonly /etc/udev/rules.d/41-dasd-*.rules
218d2d
-    fi
218d2d
-    inst_rules 59-dasd.rules
218d2d
-}
218d2d
diff --git a/modules.d/95dasd_rules/parse-dasd.sh b/modules.d/95dasd_rules/parse-dasd.sh
218d2d
deleted file mode 100755
218d2d
index 4454aec3..00000000
218d2d
--- a/modules.d/95dasd_rules/parse-dasd.sh
218d2d
+++ /dev/null
218d2d
@@ -1,43 +0,0 @@
218d2d
-#!/bin/bash
218d2d
-
218d2d
-allow_device() {
218d2d
-    local ccw=$1
218d2d
-
218d2d
-    if [ -x /sbin/cio_ignore ] && cio_ignore -i "$ccw" > /dev/null; then
218d2d
-        cio_ignore -r "$ccw"
218d2d
-    fi
218d2d
-}
218d2d
-
218d2d
-if [[ -f /sys/firmware/ipl/ipl_type ]] && [[ $(< /sys/firmware/ipl/ipl_type) == "ccw" ]]; then
218d2d
-    allow_device "$(< /sys/firmware/ipl/device)"
218d2d
-fi
218d2d
-
218d2d
-for dasd_arg in $(getargs root=) $(getargs resume=); do
218d2d
-    [[ $dasd_arg =~ /dev/disk/by-path/ccw-* ]] || continue
218d2d
-
218d2d
-    ccw_dev="${dasd_arg##*/ccw-}"
218d2d
-    allow_device "${ccw_dev%%-*}"
218d2d
-done
218d2d
-
218d2d
-for dasd_arg in $(getargs rd.dasd=); do
218d2d
-    IFS=',' read -r -a devs <<< "$dasd_arg"
218d2d
-    declare -p devs
218d2d
-    for dev in "${devs[@]}"; do
218d2d
-        case "$dev" in
218d2d
-            autodetect | probeonly) ;;
218d2d
-
218d2d
-            *-*)
218d2d
-                IFS="-" read -r start end _ <<< "${dev%(ro)}"
218d2d
-                prefix=${start%.*}
218d2d
-                start=${start##*.}
218d2d
-                for rdev in $(seq $((16#$start)) $((16#$end))); do
218d2d
-                    allow_device "$(printf "%s.%04x" "$prefix" "$rdev")"
218d2d
-                done
218d2d
-                ;;
218d2d
-            *)
218d2d
-                IFS="." read -r sid ssid chan _ <<< "${dev%(ro)}"
218d2d
-                allow_device "$(printf "%01x.%01x.%04x" $((16#$sid)) $((16#$ssid)) $((16#$chan)))"
218d2d
-                ;;
218d2d
-        esac
218d2d
-    done
218d2d
-done
218d2d
-- 
218d2d
2.42.0
218d2d