aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/utils/layerscape/restool/patches/0004-scripts-use-restool-full-path-option.patch
blob: e1cc38f48182416852aa7d0b0061b2e32391c85d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
From 09f840049d155fa4b681ece749feeff9a269ecde Mon Sep 17 00:00:00 2001
From: Ioana Ciornei <ioana.ciornei@nxp.com>
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 <ioana.ciornei@nxp.com>
---
 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