[PATCH 1/3] Remove duplicate search_cu() in linuxrc.s390

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Remove duplicate search_cu() function in linuxrc.s390, move CU_ data
structures to controlunits.sh and have linuxrc.s390 source
/sbin/controlunits when it runs.
---
 loader/controlunits.sh |   48 +++++++++++++++++++++++++++
 loader/lsznet.raw      |   84 +-----------------------------------------------
 2 files changed, 49 insertions(+), 83 deletions(-)

diff --git a/loader/controlunits.sh b/loader/controlunits.sh
index e99db36..890598d 100644
--- a/loader/controlunits.sh
+++ b/loader/controlunits.sh
@@ -18,6 +18,14 @@
 # The arrays (among other things) should be adapted, if any of those device
 # drivers start supporting different CU types/models.
 
+# The following combinations of control unit type and model were taken from the
+# Linux network device drivers for s390 on 2008-06-09 from Linux 2.6.25.4.
+# The list (among other things) should be adapted, if any of those device
+# drivers start supporting different CU types/models.
+# (Alternatively, the list could be generated by reading the modaliases
+#  directly out of the device driver modules:
+#  modinfo qeth/cu3088 | fgrep 'alias:'
+#  However, this would still require a list of device driver modules.)
 readonly -a CU=(
     1731/01
     1731/05
@@ -29,6 +37,18 @@ readonly -a CU=(
     3088/61
 )
 
+# $CU_CARDTYPE array is the only one which may contain entries with spaces
+readonly -a CU_CARDTYPE=(
+    "OSA (QDIO)"
+    "HiperSocket"
+    "CTC adapter"
+    "escon channel"
+    "ficon channel"
+    "LCS p390"
+    "LCS OSA"
+    "LCS CLAW"
+)
+
 readonly -a CU_DEVDRV=(
     qeth
     qeth
@@ -40,6 +60,34 @@ readonly -a CU_DEVDRV=(
     lcs
 )
 
+readonly -a CU_DEVNAME=(
+    eth
+    hsi
+    ctc
+    ctc
+    ctc
+    eth
+    eth
+    eth
+)
+
+readonly -a CU_GROUPCHANNELS=(
+    3
+    3
+    2
+    2
+    2
+    2
+    2
+    2
+)
+
+readonly -a CHPIDTYPES=(
+    [10]=OSE
+    [11]=OSD
+    [24]=IQD
+)
+
 # Searches for a match of argument 1 on the array $CU and sets $cu_idx
 # to the matched array index on success.
 # Returns 0 on success, 1 on failure.
diff --git a/loader/lsznet.raw b/loader/lsznet.raw
index 5b3df91..a260f6d 100644
--- a/loader/lsznet.raw
+++ b/loader/lsznet.raw
@@ -50,74 +50,7 @@ if [ $krn_ver -lt 2 -o $krn_patch -lt 6 ]; then
     error $"only works for kernel versions 2.6 or probably later"
 fi
 
-# The following combinations of control unit type and model were taken from the
-# Linux network device drivers for s390 on 2008-06-09 from Linux 2.6.25.4.
-# The list (among other things) should be adapted, if any of those device
-# drivers start supporting different CU types/models.
-# (Alternatively, the list could be generated by reading the modaliases
-#  directly out of the device driver modules:
-#  modinfo qeth/cu3088 | fgrep 'alias:'
-#  However, this would still require a list of device driver modules.)
-readonly -a CU=(
-    1731/01
-    1731/05
-    3088/08
-    3088/1f
-    3088/1e
-    3088/01
-    3088/60
-    3088/61
-)
-
-# $CU_CARDTYPE array is the only one which may contain entries with spaces
-readonly -a CU_CARDTYPE=(
-    "OSA (QDIO)"
-    "HiperSocket"
-    "CTC adapter"
-    "escon channel"
-    "ficon channel"
-    "LCS p390"
-    "LCS OSA"
-    "LCS CLAW"
-)
-
-readonly -a CU_DEVDRV=(
-    qeth
-    qeth
-    ctc
-    ctc
-    ctc
-    lcs
-    lcs
-    lcs
-)
-
-readonly -a CU_DEVNAME=(
-    eth
-    hsi
-    ctc
-    ctc
-    ctc
-    eth
-    eth
-    eth
-)
-
-readonly -a CU_GROUPCHANNELS=(
-    3
-    3
-    2
-    2
-    2
-    2
-    2
-    2
-)
-readonly -a CHPIDTYPES=(
-    [10]=OSE
-    [11]=OSD
-    [24]=IQD
-)
+. /sbin/controlunits
 
 readonly PREFIXFORMAT=[[:xdigit:]]*
 readonly SSIDFORMAT=[0-3]
@@ -131,21 +64,6 @@ function debug() {
     [ $DEBUG -ge $level ] && echo "$*" 1>&2
 }
 
-# Searches for a match of argument 1 on the array $CU and sets $cu_idx
-# to the matched array index on success.
-# Returns 0 on success, 1 on failure.
-function search_cu() {
-    local scu=$1
-    local i
-    for ((i=0; i < ${#CU[@]}; i++)); do
-        if [ $scu == ${CU[i]} ]; then
-            cu_idx=$i
-            return 0
-        fi
-    done
-    return 1
-}
-
 # Returns symbolic name of CHPID type in $chpidtype_symbolic,
 # if an entry in the array $CHPIDTYPES has been found at index of argument 1.
 # Returns "?" otherwise.
-- 
1.6.2.5

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux