Skip to contentSkip to conversation

devtools: list symbols by version

PATCH In review David Marchand 3 participants 13 messages Aug 11, 2023 – Nov 27, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devtools: list symbols by version

Make it easier to list experimental symbols added in a certain version. While at it, add a check on map symbol files content to avoid breaking this listing tool.

Example:

$ ./buildtools/map-list-symbol.sh -V 18.11 lib/eal/version.map
lib/eal/version.map EXPERIMENTAL rte_dev_event_callback_process
lib/eal/version.map EXPERIMENTAL rte_dev_hotplug_handle_disable
lib/eal/version.map EXPERIMENTAL rte_dev_hotplug_handle_enable
---
 buildtools/map-list-symbol.sh | 39 ++++++++++++++++++++++-------------
 devtools/check-symbol-maps.sh | 21 +++++++++++++++++++
 2 files changed, 46 insertions(+), 14 deletions(-)
buildtools/map-list-symbol.sh +25 -14
index 3bf9bd66f8..a834399816 100755
@@ -6,7 +6,7 @@ section=all
 symbol=all
 quiet=
 
-while getopts 'S:s:q' name; do
+while getopts 'S:s:qV:' name; do
 	case $name in
 	S)
 		[ $section = 'all' ] || {
@@ -25,8 +25,11 @@ while getopts 'S:s:q' name; do
 	q)
 		quiet='y'
 	;;
+	V)
+		version=$OPTARG
+	;;
 	?)
-		echo 'usage: $0 [-S section] [-s symbol] [-q]'
+		echo 'usage: $0 [-S section] [-s symbol] [-V version] [-q]'
 		exit 1
 	;;
 	esac
@@ -38,7 +41,8 @@ for file in $@; do
 	cat "$file" |awk '
 	BEGIN {
 		current_section = "";
-		if ("'$section'" == "all" && "'$symbol'" == "all") {
+		current_version = "";
+		if ("'$section'" == "all" && "'$symbol'" == "all" && "'$version'" == "") {
 			ret = 0;
 		} else {
 			ret = 1;
@@ -49,18 +53,25 @@ for file in $@; do
 			current_section = $1;
 		}
 	}
-	/.*}/ { current_section = ""; }
+	/.*}/ { current_section = ""; current_version = ""; }
+	/^\t# added in / {
+		current_version=$4;
+	}
 	/^[^}].*[^:*];/ {
-		if (current_section != "") {
-			gsub(";","");
-			if ("'$symbol'" == "all" || $1 == "'$symbol'") {
-				ret = 0;
-				if ("'$quiet'" == "") {
-					print "'$file' "current_section" "$1;
-				}
-				if ("'$symbol'" != "all") {
-					exit 0;
-				}
+		if (current_section == "") {
+			next;
+		}
+		if ("'$version'" != "" && "'$version'" != current_version) {
+			next;
+		}
+		gsub(";","");
+		if ("'$symbol'" == "all" || $1 == "'$symbol'") {
+			ret = 0;
+			if ("'$quiet'" == "") {
+				print "'$file' "current_section" "$1;
+			}
+			if ("'$symbol'" != "all") {
+				exit 0;
 			}
 		}
 	}
devtools/check-symbol-maps.sh +21 -0
index 8c116bfa9c..01cd09768d 100755
@@ -74,4 +74,25 @@ if [ -n "$empty_maps" ] ; then
     ret=1
 fi
 
+find_bad_format_maps ()
+{
+    for map in $@ ; do
+        cat $map | awk '
+            /^(DPDK_[0-9]*|EXPERIMENTAL|INTERNAL) {$/ { next; } # start of a section
+            /^};$/ { next; } # end of a section
+            /^$/ { next; } # empty line
+            /^\t(global:|local: \*;)$/ { next; } # qualifiers
+            /^\t[a-zA-Z_0-9]*;(| # WINDOWS_NO_EXPORT)$/ { next; } # symbols
+            /^\t# added in [0-9]*\.[0-9]*$/ { next; } # version comments
+            { exit 1; }' || echo $map
+    done
+}
+
+bad_format_maps=$(find_bad_format_maps $@)
+if [ -n "$bad_format_maps" ] ; then
+    echo "Found badly formatted maps:"
+    echo "$bad_format_maps"
+    ret=1
+fi
+
 exit $ret
Signature · 1 line
2.41.0
Acked-by on v1 1/1
#1 lore raw
Quoted 11 lines · On Fri, 11 Aug 2023 17:49:44 +0200 David Marchand <[email protected]>…

Make it easier to list experimental symbols added in a certain version. While at it, add a check on map symbol files content to avoid breaking this listing tool.

Example:

$ ./buildtools/map-list-symbol.sh -V 18.11 lib/eal/version.map
lib/eal/version.map EXPERIMENTAL rte_dev_event_callback_process
lib/eal/version.map EXPERIMENTAL rte_dev_hotplug_handle_disable
lib/eal/version.map EXPERIMENTAL rte_dev_hotplug_handle_enable

Script would probably be cleaner in Python with elftools package. Using awk to parse map output is getting messy.

#2 lore raw
In reply to David Marchand

vendredi 11 août 2023, David Marchand:

Quoted 3 lines

Make it easier to list experimental symbols added in a certain version. While at it, add a check on map symbol files content to avoid breaking this listing tool.

Is there a relation between the new check and the new -V option? I feel it would be clearer in 2 separate patches.

#3 lore raw
Quoted 8 lines · Thomas Monjalon

vendredi 11 août 2023, David Marchand:

Quoted 3 lines

Make it easier to list experimental symbols added in a certain version. While at it, add a check on map symbol files content to avoid breaking this listing tool.

Is there a relation between the new check and the new -V option? I feel it would be clearer in 2 separate patches.

The new option relies on a strict format in the .map files. I could add the check first in a separate patch if you prefer.

Signature · 1 line
David Marchand
#4 lore raw

PATCH v2 1/2 devtools: add check on symbol maps format

In reply to David Marchand

Add a check on symbol maps format (fixing ethdev at the same time). This will be required by a next commit.

---
Changes since v1:
- moved this check in a separate patch,
- fixed ethdev map file,

---
 devtools/check-symbol-maps.sh | 21 +++++++++++++++++++++
 lib/ethdev/version.map        | 30 ++++++++++++++----------------
 2 files changed, 35 insertions(+), 16 deletions(-)
devtools/check-symbol-maps.sh +21 -0
index 8c116bfa9c..1ad48d9243 100755
@@ -74,4 +74,25 @@ if [ -n "$empty_maps" ] ; then
     ret=1
 fi
 
+find_bad_format_maps ()
+{
+    for map in $@ ; do
+        cat $map | awk '
+            /^(DPDK_[0-9]*|EXPERIMENTAL|INTERNAL) {$/ { next; } # start of a section
+            /^};$/ { next; } # end of a section
+            /^$/ { next; } # empty line
+            /^\t(global:|local: \*;)$/ { next; } # qualifiers
+            /^\t[a-zA-Z_0-9]*;(| # WINDOWS_NO_EXPORT)$/ { next; } # symbols
+            /^\t# added in [0-9]*\.[0-9]*$/ { next; } # version comments
+            { print $0; }' || echo $map
+    done
+}
+
+bad_format_maps=$(find_bad_format_maps $@)
+if [ -n "$bad_format_maps" ] ; then
+    echo "Found badly formatted maps:"
+    echo "$bad_format_maps"
+    ret=1
+fi
+
 exit $ret
lib/ethdev/version.map +14 -16
index b965d6aa52..da4f847116 100644
@@ -181,7 +181,20 @@ EXPERIMENTAL {
 	__rte_ethdev_trace_tx_burst;
 	rte_flow_get_aged_flows;
 
-	# Marked as experimental in 20.11
+	# added in 20.11
+	rte_eth_hairpin_bind;
+	rte_eth_hairpin_get_peer_ports;
+	rte_eth_hairpin_unbind;
+	rte_eth_link_speed_to_str;
+	rte_eth_link_to_str;
+	rte_eth_fec_get_capability;
+	rte_eth_fec_get;
+	rte_eth_fec_set;
+	rte_flow_tunnel_decap_set;
+	rte_flow_tunnel_match;
+	rte_flow_get_restore_info;
+	rte_flow_tunnel_action_decap_release;
+	rte_flow_tunnel_item_release;
 	rte_tm_capabilities_get;
 	rte_tm_get_number_of_leaf_nodes;
 	rte_tm_hierarchy_commit;
@@ -213,21 +226,6 @@ EXPERIMENTAL {
 	rte_tm_wred_profile_add;
 	rte_tm_wred_profile_delete;
 
-	# added in 20.11
-	rte_eth_hairpin_bind;
-	rte_eth_hairpin_get_peer_ports;
-	rte_eth_hairpin_unbind;
-	rte_eth_link_speed_to_str;
-	rte_eth_link_to_str;
-	rte_eth_fec_get_capability;
-	rte_eth_fec_get;
-	rte_eth_fec_set;
-	rte_flow_tunnel_decap_set;
-	rte_flow_tunnel_match;
-	rte_flow_get_restore_info;
-	rte_flow_tunnel_action_decap_release;
-	rte_flow_tunnel_item_release;
-
 	# added in 21.02
 	rte_eth_get_monitor_addr;
 
Signature · 1 line
2.41.0
#5 lore raw

PATCH v2 2/2 devtools: list symbols by version

Make it easier to list experimental symbols added in a certain version.

Example:

$ ./buildtools/map-list-symbol.sh -V 18.11 lib/eal/version.map
lib/eal/version.map EXPERIMENTAL rte_dev_event_callback_process
lib/eal/version.map EXPERIMENTAL rte_dev_hotplug_handle_disable
lib/eal/version.map EXPERIMENTAL rte_dev_hotplug_handle_enable
---
 buildtools/map-list-symbol.sh | 39 ++++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 14 deletions(-)
buildtools/map-list-symbol.sh +25 -14
index 3bf9bd66f8..a834399816 100755
@@ -6,7 +6,7 @@ section=all
 symbol=all
 quiet=
 
-while getopts 'S:s:q' name; do
+while getopts 'S:s:qV:' name; do
 	case $name in
 	S)
 		[ $section = 'all' ] || {
@@ -25,8 +25,11 @@ while getopts 'S:s:q' name; do
 	q)
 		quiet='y'
 	;;
+	V)
+		version=$OPTARG
+	;;
 	?)
-		echo 'usage: $0 [-S section] [-s symbol] [-q]'
+		echo 'usage: $0 [-S section] [-s symbol] [-V version] [-q]'
 		exit 1
 	;;
 	esac
@@ -38,7 +41,8 @@ for file in $@; do
 	cat "$file" |awk '
 	BEGIN {
 		current_section = "";
-		if ("'$section'" == "all" && "'$symbol'" == "all") {
+		current_version = "";
+		if ("'$section'" == "all" && "'$symbol'" == "all" && "'$version'" == "") {
 			ret = 0;
 		} else {
 			ret = 1;
@@ -49,18 +53,25 @@ for file in $@; do
 			current_section = $1;
 		}
 	}
-	/.*}/ { current_section = ""; }
+	/.*}/ { current_section = ""; current_version = ""; }
+	/^\t# added in / {
+		current_version=$4;
+	}
 	/^[^}].*[^:*];/ {
-		if (current_section != "") {
-			gsub(";","");
-			if ("'$symbol'" == "all" || $1 == "'$symbol'") {
-				ret = 0;
-				if ("'$quiet'" == "") {
-					print "'$file' "current_section" "$1;
-				}
-				if ("'$symbol'" != "all") {
-					exit 0;
-				}
+		if (current_section == "") {
+			next;
+		}
+		if ("'$version'" != "" && "'$version'" != current_version) {
+			next;
+		}
+		gsub(";","");
+		if ("'$symbol'" == "all" || $1 == "'$symbol'") {
+			ret = 0;
+			if ("'$quiet'" == "") {
+				print "'$file' "current_section" "$1;
+			}
+			if ("'$symbol'" != "all") {
+				exit 0;
 			}
 		}
 	}
Signature · 1 line
2.41.0
#6 lore raw

PATCH v3 1/2 devtools: add check on symbol maps format

In reply to David Marchand

Add a check on symbol maps format (fixing ethdev at the same time). This will be required by a next commit.

---
Changes since v2:
- fixed FreeBSD build by replacing (|pattern) with (pattern)?,

Changes since v1:
- moved this check in a separate patch,
- fixed ethdev map file,

---
 devtools/check-symbol-maps.sh | 21 +++++++++++++++++++++
 lib/ethdev/version.map        | 30 ++++++++++++++----------------
 2 files changed, 35 insertions(+), 16 deletions(-)
devtools/check-symbol-maps.sh +21 -0
index 8c116bfa9c..1907890635 100755
@@ -74,4 +74,25 @@ if [ -n "$empty_maps" ] ; then
     ret=1
 fi
 
+find_bad_format_maps ()
+{
+    for map in $@ ; do
+        cat $map | awk '
+            /^(DPDK_[0-9]*|EXPERIMENTAL|INTERNAL) {$/ { next; } # start of a section
+            /^};$/ { next; } # end of a section
+            /^$/ { next; } # empty line
+            /^\t(global:|local: \*;)$/ { next; } # qualifiers
+            /^\t[a-zA-Z_0-9]*;( # WINDOWS_NO_EXPORT)?$/ { next; } # symbols
+            /^\t# added in [0-9]*\.[0-9]*$/ { next; } # version comments
+            { print $0; }' || echo $map
+    done
+}
+
+bad_format_maps=$(find_bad_format_maps $@)
+if [ -n "$bad_format_maps" ] ; then
+    echo "Found badly formatted maps:"
+    echo "$bad_format_maps"
+    ret=1
+fi
+
 exit $ret
lib/ethdev/version.map +14 -16
index b965d6aa52..da4f847116 100644
@@ -181,7 +181,20 @@ EXPERIMENTAL {
 	__rte_ethdev_trace_tx_burst;
 	rte_flow_get_aged_flows;
 
-	# Marked as experimental in 20.11
+	# added in 20.11
+	rte_eth_hairpin_bind;
+	rte_eth_hairpin_get_peer_ports;
+	rte_eth_hairpin_unbind;
+	rte_eth_link_speed_to_str;
+	rte_eth_link_to_str;
+	rte_eth_fec_get_capability;
+	rte_eth_fec_get;
+	rte_eth_fec_set;
+	rte_flow_tunnel_decap_set;
+	rte_flow_tunnel_match;
+	rte_flow_get_restore_info;
+	rte_flow_tunnel_action_decap_release;
+	rte_flow_tunnel_item_release;
 	rte_tm_capabilities_get;
 	rte_tm_get_number_of_leaf_nodes;
 	rte_tm_hierarchy_commit;
@@ -213,21 +226,6 @@ EXPERIMENTAL {
 	rte_tm_wred_profile_add;
 	rte_tm_wred_profile_delete;
 
-	# added in 20.11
-	rte_eth_hairpin_bind;
-	rte_eth_hairpin_get_peer_ports;
-	rte_eth_hairpin_unbind;
-	rte_eth_link_speed_to_str;
-	rte_eth_link_to_str;
-	rte_eth_fec_get_capability;
-	rte_eth_fec_get;
-	rte_eth_fec_set;
-	rte_flow_tunnel_decap_set;
-	rte_flow_tunnel_match;
-	rte_flow_get_restore_info;
-	rte_flow_tunnel_action_decap_release;
-	rte_flow_tunnel_item_release;
-
 	# added in 21.02
 	rte_eth_get_monitor_addr;
 
Signature · 1 line
2.41.0
#7 lore raw

PATCH v3 2/2 devtools: list symbols by version

Make it easier to list experimental symbols added in a certain version.

Example:

$ ./buildtools/map-list-symbol.sh -V 18.11 lib/eal/version.map
lib/eal/version.map EXPERIMENTAL rte_dev_event_callback_process
lib/eal/version.map EXPERIMENTAL rte_dev_hotplug_handle_disable
lib/eal/version.map EXPERIMENTAL rte_dev_hotplug_handle_enable
---
 buildtools/map-list-symbol.sh | 39 ++++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 14 deletions(-)
buildtools/map-list-symbol.sh +25 -14
index 3bf9bd66f8..a834399816 100755
@@ -6,7 +6,7 @@ section=all
 symbol=all
 quiet=
 
-while getopts 'S:s:q' name; do
+while getopts 'S:s:qV:' name; do
 	case $name in
 	S)
 		[ $section = 'all' ] || {
@@ -25,8 +25,11 @@ while getopts 'S:s:q' name; do
 	q)
 		quiet='y'
 	;;
+	V)
+		version=$OPTARG
+	;;
 	?)
-		echo 'usage: $0 [-S section] [-s symbol] [-q]'
+		echo 'usage: $0 [-S section] [-s symbol] [-V version] [-q]'
 		exit 1
 	;;
 	esac
@@ -38,7 +41,8 @@ for file in $@; do
 	cat "$file" |awk '
 	BEGIN {
 		current_section = "";
-		if ("'$section'" == "all" && "'$symbol'" == "all") {
+		current_version = "";
+		if ("'$section'" == "all" && "'$symbol'" == "all" && "'$version'" == "") {
 			ret = 0;
 		} else {
 			ret = 1;
@@ -49,18 +53,25 @@ for file in $@; do
 			current_section = $1;
 		}
 	}
-	/.*}/ { current_section = ""; }
+	/.*}/ { current_section = ""; current_version = ""; }
+	/^\t# added in / {
+		current_version=$4;
+	}
 	/^[^}].*[^:*];/ {
-		if (current_section != "") {
-			gsub(";","");
-			if ("'$symbol'" == "all" || $1 == "'$symbol'") {
-				ret = 0;
-				if ("'$quiet'" == "") {
-					print "'$file' "current_section" "$1;
-				}
-				if ("'$symbol'" != "all") {
-					exit 0;
-				}
+		if (current_section == "") {
+			next;
+		}
+		if ("'$version'" != "" && "'$version'" != current_version) {
+			next;
+		}
+		gsub(";","");
+		if ("'$symbol'" == "all" || $1 == "'$symbol'") {
+			ret = 0;
+			if ("'$quiet'" == "") {
+				print "'$file' "current_section" "$1;
+			}
+			if ("'$symbol'" != "all") {
+				exit 0;
 			}
 		}
 	}
Signature · 1 line
2.41.0
#8 lore raw

PATCH v4 1/2 devtools: add check on symbol maps format

In reply to David Marchand

Add a check on symbol maps format (fixing ethdev at the same time). This will be required by a next commit.

---
Changes since v3:
- fixed Alpine build (same issue with { in awk expression than commit e1ab26df4862 ("buildtools: fix build with busybox")),

Changes since v2:
- fixed FreeBSD build by replacing (|pattern) with (pattern)?,

Changes since v1:
- moved this check in a separate patch,
- fixed ethdev map file,

---
 devtools/check-symbol-maps.sh | 21 +++++++++++++++++++++
 lib/ethdev/version.map        | 30 ++++++++++++++----------------
 2 files changed, 35 insertions(+), 16 deletions(-)
devtools/check-symbol-maps.sh +21 -0
index 8c116bfa9c..9913393ced 100755
@@ -74,4 +74,25 @@ if [ -n "$empty_maps" ] ; then
     ret=1
 fi
 
+find_bad_format_maps ()
+{
+    for map in $@ ; do
+        cat $map | awk '
+            /^(DPDK_[0-9]*|EXPERIMENTAL|INTERNAL) \{$/ { next; } # start of a section
+            /^};$/ { next; } # end of a section
+            /^$/ { next; } # empty line
+            /^\t(global:|local: \*;)$/ { next; } # qualifiers
+            /^\t[a-zA-Z_0-9]*;( # WINDOWS_NO_EXPORT)?$/ { next; } # symbols
+            /^\t# added in [0-9]*\.[0-9]*$/ { next; } # version comments
+            { print $0; }' || echo $map
+    done
+}
+
+bad_format_maps=$(find_bad_format_maps $@)
+if [ -n "$bad_format_maps" ] ; then
+    echo "Found badly formatted maps:"
+    echo "$bad_format_maps"
+    ret=1
+fi
+
 exit $ret
lib/ethdev/version.map +14 -16
index b965d6aa52..da4f847116 100644
@@ -181,7 +181,20 @@ EXPERIMENTAL {
 	__rte_ethdev_trace_tx_burst;
 	rte_flow_get_aged_flows;
 
-	# Marked as experimental in 20.11
+	# added in 20.11
+	rte_eth_hairpin_bind;
+	rte_eth_hairpin_get_peer_ports;
+	rte_eth_hairpin_unbind;
+	rte_eth_link_speed_to_str;
+	rte_eth_link_to_str;
+	rte_eth_fec_get_capability;
+	rte_eth_fec_get;
+	rte_eth_fec_set;
+	rte_flow_tunnel_decap_set;
+	rte_flow_tunnel_match;
+	rte_flow_get_restore_info;
+	rte_flow_tunnel_action_decap_release;
+	rte_flow_tunnel_item_release;
 	rte_tm_capabilities_get;
 	rte_tm_get_number_of_leaf_nodes;
 	rte_tm_hierarchy_commit;
@@ -213,21 +226,6 @@ EXPERIMENTAL {
 	rte_tm_wred_profile_add;
 	rte_tm_wred_profile_delete;
 
-	# added in 20.11
-	rte_eth_hairpin_bind;
-	rte_eth_hairpin_get_peer_ports;
-	rte_eth_hairpin_unbind;
-	rte_eth_link_speed_to_str;
-	rte_eth_link_to_str;
-	rte_eth_fec_get_capability;
-	rte_eth_fec_get;
-	rte_eth_fec_set;
-	rte_flow_tunnel_decap_set;
-	rte_flow_tunnel_match;
-	rte_flow_get_restore_info;
-	rte_flow_tunnel_action_decap_release;
-	rte_flow_tunnel_item_release;
-
 	# added in 21.02
 	rte_eth_get_monitor_addr;
 
Signature · 1 line
2.41.0
#9 lore raw

PATCH v4 2/2 devtools: list symbols by version

Make it easier to list experimental symbols added in a certain version.

Example:

$ ./buildtools/map-list-symbol.sh -V 18.11 lib/eal/version.map
lib/eal/version.map EXPERIMENTAL rte_dev_event_callback_process
lib/eal/version.map EXPERIMENTAL rte_dev_hotplug_handle_disable
lib/eal/version.map EXPERIMENTAL rte_dev_hotplug_handle_enable
---
 buildtools/map-list-symbol.sh | 39 ++++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 14 deletions(-)
buildtools/map-list-symbol.sh +25 -14
index 3bf9bd66f8..a834399816 100755
@@ -6,7 +6,7 @@ section=all
 symbol=all
 quiet=
 
-while getopts 'S:s:q' name; do
+while getopts 'S:s:qV:' name; do
 	case $name in
 	S)
 		[ $section = 'all' ] || {
@@ -25,8 +25,11 @@ while getopts 'S:s:q' name; do
 	q)
 		quiet='y'
 	;;
+	V)
+		version=$OPTARG
+	;;
 	?)
-		echo 'usage: $0 [-S section] [-s symbol] [-q]'
+		echo 'usage: $0 [-S section] [-s symbol] [-V version] [-q]'
 		exit 1
 	;;
 	esac
@@ -38,7 +41,8 @@ for file in $@; do
 	cat "$file" |awk '
 	BEGIN {
 		current_section = "";
-		if ("'$section'" == "all" && "'$symbol'" == "all") {
+		current_version = "";
+		if ("'$section'" == "all" && "'$symbol'" == "all" && "'$version'" == "") {
 			ret = 0;
 		} else {
 			ret = 1;
@@ -49,18 +53,25 @@ for file in $@; do
 			current_section = $1;
 		}
 	}
-	/.*}/ { current_section = ""; }
+	/.*}/ { current_section = ""; current_version = ""; }
+	/^\t# added in / {
+		current_version=$4;
+	}
 	/^[^}].*[^:*];/ {
-		if (current_section != "") {
-			gsub(";","");
-			if ("'$symbol'" == "all" || $1 == "'$symbol'") {
-				ret = 0;
-				if ("'$quiet'" == "") {
-					print "'$file' "current_section" "$1;
-				}
-				if ("'$symbol'" != "all") {
-					exit 0;
-				}
+		if (current_section == "") {
+			next;
+		}
+		if ("'$version'" != "" && "'$version'" != current_version) {
+			next;
+		}
+		gsub(";","");
+		if ("'$symbol'" == "all" || $1 == "'$symbol'") {
+			ret = 0;
+			if ("'$quiet'" == "") {
+				print "'$file' "current_section" "$1;
+			}
+			if ("'$symbol'" != "all") {
+				exit 0;
 			}
 		}
 	}
Signature · 1 line
2.41.0
#10 lore raw

PATCH v5 1/2 devtools: add check on symbol maps format

In reply to David Marchand

Add a check on symbol maps format.
This will be required by a next commit.

---
Changes since v4:
- rebased,
- handled next abi version in the check,

Changes since v3:
- fixed Alpine build (same issue with { in awk expression than commit e1ab26df4862 ("buildtools: fix build with busybox")),

Changes since v2:
- fixed FreeBSD build by replacing (|pattern) with (pattern)?,

Changes since v1:
- moved this check in a separate patch,
- fixed ethdev map file,

---
 devtools/check-symbol-maps.sh | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
devtools/check-symbol-maps.sh +23 -0
index 8c116bfa9c..ba2f892f56 100755
@@ -74,4 +74,27 @@ if [ -n "$empty_maps" ] ; then
     ret=1
 fi
 
+find_bad_format_maps ()
+{
+    abi_version=$(cut -d'.' -f 1 ABI_VERSION)
+    next_abi_version=$((abi_version + 1))
+    for map in $@ ; do
+        cat $map | awk '
+            /^(DPDK_('$abi_version'|'$next_abi_version')|EXPERIMENTAL|INTERNAL) \{$/ { next; } # start of a section
+            /^}( DPDK_'$abi_version')?;$/ { next; } # end of a section
+            /^$/ { next; } # empty line
+            /^\t(global:|local: \*;)$/ { next; } # qualifiers
+            /^\t[a-zA-Z_0-9]*;( # WINDOWS_NO_EXPORT)?$/ { next; } # symbols
+            /^\t# added in [0-9]*\.[0-9]*$/ { next; } # version comments
+            { print $0; }' || echo $map
+    done
+}
+
+bad_format_maps=$(find_bad_format_maps $@)
+if [ -n "$bad_format_maps" ] ; then
+    echo "Found badly formatted maps:"
+    echo "$bad_format_maps"
+    ret=1
+fi
+
 exit $ret
Signature · 1 line
2.41.0
#11 lore raw

PATCH v5 2/2 devtools: list symbols by version

Make it easier to list experimental symbols added in a certain version.

Example:

$ ./buildtools/map-list-symbol.sh -V 18.11 lib/eal/version.map
lib/eal/version.map EXPERIMENTAL rte_dev_event_callback_process
lib/eal/version.map EXPERIMENTAL rte_dev_hotplug_handle_disable
lib/eal/version.map EXPERIMENTAL rte_dev_hotplug_handle_enable
---
 buildtools/map-list-symbol.sh | 39 ++++++++++++++++++++++-------------
 1 file changed, 25 insertions(+), 14 deletions(-)
buildtools/map-list-symbol.sh +25 -14
index 3bf9bd66f8..a834399816 100755
@@ -6,7 +6,7 @@ section=all
 symbol=all
 quiet=
 
-while getopts 'S:s:q' name; do
+while getopts 'S:s:qV:' name; do
 	case $name in
 	S)
 		[ $section = 'all' ] || {
@@ -25,8 +25,11 @@ while getopts 'S:s:q' name; do
 	q)
 		quiet='y'
 	;;
+	V)
+		version=$OPTARG
+	;;
 	?)
-		echo 'usage: $0 [-S section] [-s symbol] [-q]'
+		echo 'usage: $0 [-S section] [-s symbol] [-V version] [-q]'
 		exit 1
 	;;
 	esac
@@ -38,7 +41,8 @@ for file in $@; do
 	cat "$file" |awk '
 	BEGIN {
 		current_section = "";
-		if ("'$section'" == "all" && "'$symbol'" == "all") {
+		current_version = "";
+		if ("'$section'" == "all" && "'$symbol'" == "all" && "'$version'" == "") {
 			ret = 0;
 		} else {
 			ret = 1;
@@ -49,18 +53,25 @@ for file in $@; do
 			current_section = $1;
 		}
 	}
-	/.*}/ { current_section = ""; }
+	/.*}/ { current_section = ""; current_version = ""; }
+	/^\t# added in / {
+		current_version=$4;
+	}
 	/^[^}].*[^:*];/ {
-		if (current_section != "") {
-			gsub(";","");
-			if ("'$symbol'" == "all" || $1 == "'$symbol'") {
-				ret = 0;
-				if ("'$quiet'" == "") {
-					print "'$file' "current_section" "$1;
-				}
-				if ("'$symbol'" != "all") {
-					exit 0;
-				}
+		if (current_section == "") {
+			next;
+		}
+		if ("'$version'" != "" && "'$version'" != current_version) {
+			next;
+		}
+		gsub(";","");
+		if ("'$symbol'" == "all" || $1 == "'$symbol'") {
+			ret = 0;
+			if ("'$quiet'" == "") {
+				print "'$file' "current_section" "$1;
+			}
+			if ("'$symbol'" != "all") {
+				exit 0;
 			}
 		}
 	}
Signature · 1 line
2.41.0
#12 lore raw
Quoted 11 lines · David Marchand

Make it easier to list experimental symbols added in a certain version.

Example:

$ ./buildtools/map-list-symbol.sh -V 18.11 lib/eal/version.map
lib/eal/version.map EXPERIMENTAL rte_dev_event_callback_process
lib/eal/version.map EXPERIMENTAL rte_dev_hotplug_handle_disable
lib/eal/version.map EXPERIMENTAL rte_dev_hotplug_handle_enable

Series applied, thanks.

Signature · 1 line
David Marchand