| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111 |
- From 09f840049d155fa4b681ece749feeff9a269ecde Mon Sep 17 00:00:00 2001
- From: Ioana Ciornei <[email protected]>
- Date: Tue, 24 Oct 2017 16:29:45 +0000
- Subject: [PATCH 04/12] scripts: use restool --full-path option
- Instead of constructing the the full path container list by
- hand use the restool option newly added.
- Signed-off-by: Ioana Ciornei <[email protected]>
- ---
- scripts/ls-main | 54 +++++++-----------------------------------------------
- 1 file changed, 7 insertions(+), 47 deletions(-)
- diff --git a/scripts/ls-main b/scripts/ls-main
- index ea0df92..72f6c77 100755
- --- a/scripts/ls-main
- +++ b/scripts/ls-main
- @@ -73,7 +73,6 @@
- ##
-
- shopt -s extglob
- -shopt -s lastpipe
-
- # Intercept the Ctrl+C command but do not interrupt execution
- trap ' ' INT
- @@ -87,11 +86,6 @@ root_c=
- # Type of endpoint object
- toe=
-
- -containers=()
- -# Full path containers
- -fpc=()
- -idx=0
- -
- SYS_DPRC="/sys/bus/fsl-mc/drivers/fsl_mc_dprc"
-
- set -e
- @@ -220,42 +214,6 @@ get_container() {
- echo $(echo "$i" | sed "s/\(dprc.[0-9]*\/\)*//g")
- }
-
- -build_fpc_list() {
- - $restool dprc list |
- - while IFS= read -r line
- - do
- - containers+=("$line")
- - done
- -
- - for i in "${containers[@]}"
- - do
- - cnt=$(count_spaces "$i")
- -
- - if [ "$cnt" -gt 0 ]; then
- - # Get index of the upper level container
- - idx2=$((idx-1))
- - crt_ct="$i"
- -
- - while [ "$idx2" -ge 0 ]
- - do
- - cntp=$(count_spaces "${containers[idx2]}")
- -
- - if [ "$cntp" -lt "$cnt" ]; then
- - upc=$(echo "${containers[idx2]}" | sed "s/ *$//")
- - crt_ct=$upc"/""$(echo $crt_ct | sed 's/ *$//')"
- - fi
- - idx2=$((idx2-1))
- - done
- -
- - fpc+=($crt_ct)
- - else
- - fpc+=("$i")
- - fi
- -
- - idx=$((idx+1))
- - done
- -}
- -
- get_label() {
- # Retrieve the type of the object
- too=$(echo "$1" | sed "s/\(\.[0-9]*\)\(\.[0-9]*\)*$//g")
- @@ -897,9 +855,9 @@ process_addni() {
- }
-
- process_listni() {
- - build_fpc_list
- -
- - for i in "${fpc[@]}"
- + dprc_list="$($restool dprc list --full-path)"
- + echo "${dprc_list}" |
- + while read -r i
- do
- crt_c=$(get_container "$i")
- $restool dprc show "$crt_c" | grep dpni |
- @@ -948,10 +906,12 @@ process_listni() {
- }
-
- process_listmac() {
- - build_fpc_list
- + dprc_list="$($restool dprc list --full-path)"
-
- - for i in "${fpc[@]}"
- + echo "${dprc_list}" |
- + while read -r i
- do
- +
- crt_c=$(get_container "$i")
- $restool dprc show "$crt_c" | grep dpmac |
- while IFS= read -r line
- --
- 2.14.1
|