Staging: remove wusbcore and UWB from the kernel tree.
[linux/fpc-iii.git] / arch / microblaze / kernel / syscalls / syscallhdr.sh
blob2e9062a926a3a3d591aa93d232aec8ad378c66b0
1 #!/bin/sh
2 # SPDX-License-Identifier: GPL-2.0
4 in="$1"
5 out="$2"
6 my_abis=`echo "($3)" | tr ',' '|'`
7 prefix="$4"
8 offset="$5"
10 fileguard=_UAPI_ASM_MICROBLAZE_`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 printf "#ifndef %s\n" "${fileguard}"
15 printf "#define %s\n" "${fileguard}"
16 printf "\n"
18 nxt=0
19 while read nr abi name entry ; do
20 if [ -z "$offset" ]; then
21 printf "#define __NR_%s%s\t%s\n" \
22 "${prefix}" "${name}" "${nr}"
23 else
24 printf "#define __NR_%s%s\t(%s + %s)\n" \
25 "${prefix}" "${name}" "${offset}" "${nr}"
27 nxt=$((nr+1))
28 done
30 printf "\n"
31 printf "#ifdef __KERNEL__\n"
32 printf "#define __NR_syscalls\t%s\n" "${nxt}"
33 printf "#endif\n"
34 printf "\n"
35 printf "#endif /* %s */" "${fileguard}"
36 ) > "$out"