Merge tag 'sound-5.7-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
[sfrench/cifs-2.6.git] / arch / x86 / entry / syscalls / syscallhdr.sh
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
3
4 in="$1"
5 out="$2"
6 my_abis=`echo "($3)" | tr ',' '|'`
7 prefix="$4"
8 offset="$5"
9
10 fileguard=_ASM_X86_`basename "$out" | sed \
11     -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
12     -e 's/[^A-Z0-9_]/_/g' -e 's/__/_/g'`
13 grep -E "^[0-9A-Fa-fXx]+[[:space:]]+${my_abis}" "$in" | sort -n | (
14     echo "#ifndef ${fileguard}"
15     echo "#define ${fileguard} 1"
16     echo ""
17
18     max=0
19     while read nr abi name entry ; do
20         if [ -z "$offset" ]; then
21             echo "#define __NR_${prefix}${name} $nr"
22         else
23             echo "#define __NR_${prefix}${name} ($offset + $nr)"
24         fi
25
26         max=$nr
27     done
28
29     echo ""
30     echo "#ifdef __KERNEL__"
31     echo "#define __NR_${prefix}syscall_max $max"
32     echo "#endif"
33     echo ""
34     echo "#endif /* ${fileguard} */"
35 ) > "$out"