forked from ibm-s390-linux/s390-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
zdev: add helper to convert from zdev config to dasd_mod.dasd
Converts zdev configuration into the syntax of the kernel module parameter dasd_mod.dasd. Only DASD options with non-default values are emitted. The result string occurs on stdout. It represents one device-specification for the given DASD device bus-ID. Example: /lib/s390-tools/zdev-to-dasd_mod.dasd persistent 0.0.da5d 0.0.da5d(erplog) User: storaged-project/blivet#1162 to generate dracut cmdline entries such as rd.dasd=0.0.da5d(erplog) Signed-off-by: Steffen Maier <[email protected]>
- Loading branch information
1 parent
97aa088
commit b66396d
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright IBM Corp. 2023 | ||
# | ||
# s390-tools is free software; you can redistribute it and/or modify | ||
# it under the terms of the MIT license. See LICENSE for details. | ||
# | ||
# zdev-to-dasd_mod.dasd | ||
# Converts zdev configuration into the syntax of the kernel module parameter | ||
# dasd_mod.dasd. Only DASD options with non-default values are emitted. The | ||
# result string occurs on stdout. It represents one device-specification for | ||
# the given DASD device bus-ID. | ||
# | ||
|
||
function usage() { | ||
echo "usage: ${0##*/} active|persistent <DASD device bus-ID>" 1>&2 | ||
exit 1 | ||
} | ||
|
||
[[ $# -eq 2 ]] || usage | ||
|
||
[[ "$1" == active ]] || [[ "$1" == persistent ]] || usage | ||
|
||
_selection="--${1}" | ||
_busid="$2" | ||
|
||
while read -r _line; do | ||
case "$_line" in | ||
"readonly=1") _attrs="${_attrs:+${_attrs}:}ro" ;; | ||
"use_diag=1") _attrs="${_attrs:+${_attrs}:}diag" ;; | ||
"raw_track_access=1") _attrs="${_attrs:+${_attrs}:}raw" ;; | ||
"erplog=1") _attrs="${_attrs:+${_attrs}:}erplog" ;; | ||
"failfast=1") _attrs="${_attrs:+${_attrs}:}failfast" ;; | ||
esac | ||
done < <(chzdev dasd "$_busid" "$_selection" --export - --quiet) | ||
[[ -n "$_attrs" ]] && _attrs="($_attrs)" | ||
printf "%s%s\n" "$_busid" "$_attrs" |