File tree Expand file tree Collapse file tree 2 files changed +29
-30
lines changed
Expand file tree Collapse file tree 2 files changed +29
-30
lines changed Original file line number Diff line number Diff line change 1+ /^ struct ([^ [:space :] ]+ )_struct([[:space :] ]+ \/\* ([^ [:space :] ]+ ) \*\/ )? [[:space :] ]+ { / {
2+ match ($0 , /^ struct ([^ [:space :] ]+ )_struct([[:space :] ]+ \/\* ([^ [:space :] ]+ ) \*\/ )? [[:space :] ]+ { /, a)
3+
4+ struct_name = a[ 1 ]
5+ subtype_name = a[ 3 ]
6+
7+ if (struct_name ~ /^ BPF_ /)
8+ prefix = " union bpf_attr"
9+ else
10+ prefix = " struct " struct_name
11+
12+ if (subtype_name != " " )
13+ prefix = prefix " ." subtype_name
14+
15+ in_struct = 1
16+ next
17+ }
18+
19+ /^ }( ATTRIBUTE_ALIGNED\( . * \) )? ; / {
20+ in_struct = 0
21+ next
22+ }
23+
24+ (in_struct == 1 ) {
25+ if (match ($0 , /^ [[:space :] ]+ [^ ; \[\] ]+ [[:space :] ]+ ([^ [:space :] \[\] ; ]+ )(\[ [^ ; ]* \] )? ;$ /, a)) {
26+ print " \t\t " prefix " ." a[ 1 ] " ,"
27+ }
28+ }
Original file line number Diff line number Diff line change @@ -34,36 +34,7 @@ AC_DEFUN([st_BPF_ATTR], [dnl
3434 AC_CHECK_MEMBERS(m4_normalize([
3535EOF
3636
37- gawk -e '
38- /^struct ([^[:space:]]+)_struct([[:space:]]+\/\* ([^[:space:]]+) \*\/)?[[:space:]]+{/ {
39- match($0, /^struct ([^[:space:]]+)_struct([[:space:]]+\/\* ([^[:space:]]+) \*\/)?[[:space:]]+{/, a)
40-
41- struct_name = a[1]
42- subtype_name = a[3]
43-
44- if (struct_name ~ /^BPF_/)
45- prefix = "union bpf_attr"
46- else
47- prefix = "struct " struct_name
48-
49- if (subtype_name != "")
50- prefix = prefix "." subtype_name
51-
52- in_struct = 1
53- next
54- }
55-
56- /^}( ATTRIBUTE_ALIGNED\(.*\))?;/ {
57- in_struct = 0
58- next
59- }
60-
61- (in_struct == 1) {
62- if (match($0, /^[[:space:]]+[^;\[\]]+[[:space:]]+([^[:space:]\[\];]+)(\[[^;]*\])?;$/, a)) {
63- print "\t\t" prefix "." a[1] ","
64- }
65- }
66- ' < " $input " | sort -u
37+ gawk -f " ${0%/* } " /gen_bpf_attr_m4.awk < " $input " | sort -u
6738
6839cat << 'EOF '
6940 union bpf_attr.dummy
You can’t perform that action at this time.
0 commit comments