From 23c1504059e187a279296bc827878c8dc314cc05 Mon Sep 17 00:00:00 2001 From: Yangbo Lu Date: Wed, 18 Oct 2017 10:37:58 +0800 Subject: layerscape: add restool package restool is a user space application providing the ability to dynamically create and manage Layerscape DPAA2 containers and objects from Linux. Signed-off-by: Yangbo Lu --- ...006-scripts-use-strings-instead-of-arrays.patch | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 package/network/utils/layerscape/restool/patches/0006-scripts-use-strings-instead-of-arrays.patch (limited to 'package/network/utils/layerscape/restool/patches/0006-scripts-use-strings-instead-of-arrays.patch') diff --git a/package/network/utils/layerscape/restool/patches/0006-scripts-use-strings-instead-of-arrays.patch b/package/network/utils/layerscape/restool/patches/0006-scripts-use-strings-instead-of-arrays.patch new file mode 100644 index 0000000000..a1217668f5 --- /dev/null +++ b/package/network/utils/layerscape/restool/patches/0006-scripts-use-strings-instead-of-arrays.patch @@ -0,0 +1,79 @@ +From 2127850302de2bd8dccff0e31415ce0218750773 Mon Sep 17 00:00:00 2001 +From: Ioana Ciornei +Date: Tue, 24 Oct 2017 16:29:53 +0000 +Subject: [PATCH 06/12] scripts: use strings instead of arrays + +Signed-off-by: Ioana Ciornei +--- + scripts/ls-main | 21 ++++++++++++++------- + 1 file changed, 14 insertions(+), 7 deletions(-) + +diff --git a/scripts/ls-main b/scripts/ls-main +index a39df2c..b0c742e 100755 +--- a/scripts/ls-main ++++ b/scripts/ls-main +@@ -485,7 +485,9 @@ create_dpsw() { + + # Make a link in case there is an end point specified + index=0 +- for i in "${endpoint[@]}"; do ++ echo "${endpoint}" | ++ while read -r i ++ do + connect $root_c "$dpsw.$index" "$i" + index=$((index + 1)) + done +@@ -519,8 +521,8 @@ process_addsw() { + max_fdb_mc_groups=32 + # dpsw object label + label= +- #Endpoint objects provided as argument +- endpoint=() ++ # Endpoint objects provided as argument ++ endpoint= + ifcnt=0 + container=$root_c + +@@ -559,7 +561,7 @@ process_addsw() { + container="${i#*=}" + ;; + @(dpni|dpmac).+([0-9])) +- endpoint[$ifcnt]="$(echo ${i#*=} | tr -d ,)" ++ endpoint="${endpoint}"$'\n'"${i}" + ifcnt=$((ifcnt + 1)) + ;; + *) +@@ -571,14 +573,19 @@ process_addsw() { + done + + # Check if there are more endpoints provided than the number of the interfaces +- if [ $num_ifs -lt ${#endpoint[@]} ]; then ++ if [ $num_ifs -lt $ifcnt ]; then + echo "Error: there are more endpoints provided than the number of the interfaces" + usage_addsw + exit 1 + fi + ++ # Delete first empty line from the endpoint string ++ endpoint="$(echo "${endpoint}" | tail -n +2)" ++ + # Check if the endpoints are valid +- for i in "${endpoint[@]}"; do ++ echo "${endpoint}" | ++ while read -r i ++ do + type_of_endpoint "$i" + check_endpoint "$i" + has_endpoint "$i" +@@ -592,7 +599,7 @@ process_addsw() { + if (( $object_exists_status == 1 )); then + echo "Created ETHSW object $dpsw with ${num_ifs} ports" + +- if [ $num_ifs -gt ${#endpoint[@]} ]; then ++ if [ $num_ifs -gt $ifcnt ]; then + echo "Do not forget to connect devices to interface(s)." + fi + fi +-- +2.14.1 + -- cgit v1.2.3