From: Eugene Syromyatnikov <evgsyr@gmail.com>
Date: Sun, 8 Apr 2018 18:09:06 +0000 (+0200)
Subject: bpf: add support for array fields
X-Git-Tag: v4.23~360
X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a3509bac24a01d0d46c142821b520f2e63e96163;p=strace

bpf: add support for array fields

* gen_bpf_attr_check.sh: Ignore field array size definition.
* m4/gen_bpf_attr_m4.sh (filter_entries): Likewise.

Co-Authored-by: Dmitry V. Levin <ldv@altlinux.org>
---

diff --git a/gen_bpf_attr_check.sh b/gen_bpf_attr_check.sh
index 9da75ad9..1a52c217 100755
--- a/gen_bpf_attr_check.sh
+++ b/gen_bpf_attr_check.sh
@@ -44,7 +44,7 @@ for struct in $(sed -n 's/^struct \(BPF_[^[:space:]]\+_struct\) .*/\1/p' < "$inp
 	enum="$enum${enum:+.}"
 	ENUM="$ENUM${ENUM:+_}"
 	sed -n '/^struct '"$struct"' [^{]*{/,/^};$/p' < "$input" |
-	sed -n 's/^[[:space:]]\+[^;]*[[:space:]]\([^[:space:];]\+\);$/\1/p' |
+	sed -n 's/^[[:space:]]\+[^][;]*[[:space:]]\([^][[:space:];]\+\)\(\[[^;]*\]\)\?;$/\1/p' |
 	while read field; do
 		FIELD="$(printf %s "$field" |tr '[:lower:]' '[:upper:]')"
 		cat <<EOF
diff --git a/m4/gen_bpf_attr_m4.sh b/m4/gen_bpf_attr_m4.sh
index f3dc3072..188d6628 100755
--- a/m4/gen_bpf_attr_m4.sh
+++ b/m4/gen_bpf_attr_m4.sh
@@ -50,7 +50,7 @@ filter_entries()
 	local subtype=
 	[ -z "$name" ] ||
 		subtype=".$name"
-	local search='^[[:space:]]\+[^;]*[[:space:]]\([^[:space:];]\+\);$'
+	local search='^[[:space:]]\+[^][;]*[[:space:]]\([^][[:space:];]\+\)\(\[[^;]*\]\)\?;$'
 	local replacement='\t\tunion bpf_attr'"$subtype"'.\1,'
 	sed -n "s/$search/$replacement/p" |
 		sort -u