Skip to content

Commit

Permalink
fixup! feat(znet): use zdev for consolidated device configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
steffen-maier committed Nov 9, 2023
1 parent aac59f9 commit 8c56334
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 38 deletions.
16 changes: 9 additions & 7 deletions modules.d/95znet/module-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@ install() {
chzdev qeth --export - --configured --persistent --quiet --type
chzdev lcs --export - --configured --persistent --quiet --type
chzdev ctc --export - --configured --persistent --quiet --type
} 2>/dev/null > "$_tempfile"
} 2> /dev/null > "$_tempfile"
ddebug < "$_tempfile"
chzdev --import "$_tempfile" --persistent --base "/etc=$initdir/etc" \
--yes --no-root-update --force 2>&1 | ddebug
--yes --no-root-update --force 2>&1 | ddebug
lszdev --configured --persistent --info \
--base "/etc=$initdir/etc" 2>&1 | ddebug
--base "/etc=$initdir/etc" 2>&1 | ddebug
rm -f "$_tempfile"
# these are purely generated udev rules so we have to glob expand
# within $initdir and strip the $initdir prefix for mark_hostonly
Expand All @@ -46,12 +46,14 @@ install() {
local _nullglob=$(shopt -p nullglob)
shopt -u nullglob
# shellcheck disable=SC2086
readarray -t _array < \
<(ls -1 $initdir/etc/udev/rules.d/41-*.rules 2> /dev/null)
readarray -t _array < <(
ls -1 $initdir/etc/udev/rules.d/41-*.rules 2> /dev/null
)
[[ ${#_array[@]} -gt 0 ]] && mark_hostonly "${_array[@]#$initdir}"
# shellcheck disable=SC2086
readarray -t _array < \
<(ls -1 $initdir/etc/modprobe.d/s390x-*.conf 2> /dev/null)
readarray -t _array < <(
ls -1 $initdir/etc/modprobe.d/s390x-*.conf 2> /dev/null
)
[[ ${#_array[@]} -gt 0 ]] && mark_hostonly "${_array[@]#$initdir}"
$_nullglob
fi
Expand Down
62 changes: 31 additions & 31 deletions modules.d/95znet/parse-ccw.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,43 @@ znet_base_args="--no-settle --yes --no-root-update --force"
# so use a vinfo alternative that still prints to the console via kmsg
znet_vinfo() {
while read -r _znet_vinfo_line || [ -n "$_znet_vinfo_line" ]; do
# Prefix "<30>" represents facility LOG_DAEMON 3 and loglevel INFO 6:
# (facility << 3) | level.
echo "<30>dracut: $_znet_vinfo_line" > /dev/kmsg
# Prefix "<30>" represents facility LOG_DAEMON 3 and loglevel INFO 6:
# (facility << 3) | level.
echo "<30>dracut: $_znet_vinfo_line" > /dev/kmsg
done
}

for ccw_arg in $(getargs rd.ccw -d 'rd_CCW=') $(getargs rd.znet -d 'rd_ZNET='); do
(
SAVED_IFS="$IFS"
IFS=","
# shellcheck disable=SC2086
set -- $ccw_arg
IFS="$SAVED_IFS"
type="$1"
subchannel1="$2"
subchannel2="$3"
subchannel3="$4"
echo "rd.znet ${ccw_arg} :" | znet_vinfo
if [ "$#" -lt 3 ]; then
echo "rd.znet needs at least 3 list items: type,subchannel1,subchannel2" | znet_vinfo
fi
if [ "$1" = "qeth" ]; then
if [ "$#" -lt 4 ]; then
echo "rd.znet for type qeth needs at least 4 list items: qeth,subchannel1,subchannel2,subchannel3" | znet_vinfo
fi
subchannels="$subchannel1:$subchannel2:$subchannel3"
shift 4
# shellcheck disable=SC2086
chzdev --enable --persistent $znet_base_args \
"$type" "$subchannels" "$*" 2>&1 | znet_vinfo
else
subchannels="$subchannel1:$subchannel2"
shift 3
# shellcheck disable=SC2086
SAVED_IFS="$IFS"
IFS=","
# shellcheck disable=SC2086
set -- $ccw_arg
IFS="$SAVED_IFS"
type="$1"
subchannel1="$2"
subchannel2="$3"
subchannel3="$4"
echo "rd.znet ${ccw_arg} :" | znet_vinfo
if [ "$#" -lt 3 ]; then
echo "rd.znet needs at least 3 list items: type,subchannel1,subchannel2" | znet_vinfo
fi
if [ "$1" = "qeth" ]; then
if [ "$#" -lt 4 ]; then
echo "rd.znet for type qeth needs at least 4 list items: qeth,subchannel1,subchannel2,subchannel3" | znet_vinfo
fi
subchannels="$subchannel1:$subchannel2:$subchannel3"
shift 4
# shellcheck disable=SC2086
chzdev --enable --persistent $znet_base_args \
"$type" "$subchannels" "$*" 2>&1 | znet_vinfo
fi
"$type" "$subchannels" "$*" 2>&1 | znet_vinfo
else
subchannels="$subchannel1:$subchannel2"
shift 3
# shellcheck disable=SC2086
chzdev --enable --persistent $znet_base_args \
"$type" "$subchannels" "$*" 2>&1 | znet_vinfo
fi
)
done

Expand Down

0 comments on commit 8c56334

Please sign in to comment.