Commit | Line | Data |
---|---|---|
96a8fae0 | 1 | #!/bin/sh |
b2441318 | 2 | # SPDX-License-Identifier: GPL-2.0 |
96a8fae0 RK |
3 | |
4 | in="$1" | |
5 | out="$2" | |
6 | my_abis=`echo "($3)" | tr ',' '|'` | |
7 | prefix="$4" | |
8 | offset="$5" | |
9 | ||
10 | fileguard=_ASM_ARM_`basename "$out" | sed \ | |
11 | -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \ | |
12 | -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'` | |
13 | if echo $out | grep -q uapi; then | |
14 | fileguard="_UAPI$fileguard" | |
15 | fi | |
16 | grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | ( | |
17 | echo "#ifndef ${fileguard}" | |
18 | echo "#define ${fileguard} 1" | |
19 | echo "" | |
20 | ||
21 | while read nr abi name entry ; do | |
22 | if [ -z "$offset" ]; then | |
23 | echo "#define __NR_${prefix}${name} $nr" | |
24 | else | |
25 | echo "#define __NR_${prefix}${name} ($offset + $nr)" | |
26 | fi | |
27 | done | |
28 | ||
29 | echo "" | |
30 | echo "#endif /* ${fileguard} */" | |
31 | ) > "$out" |