Merge tag 'auxdisplay-v6.9-1' of git://git.kernel.org/pub/scm/linux/kernel/git/andy...
[linux-2.6-microblaze.git] / tools / perf / trace / beauty / socket.sh
1 #!/bin/sh
2 # SPDX-License-Identifier: LGPL-2.1
3
4 if [ $# -gt 0 ] ; then
5         uapi_header_dir=$1
6         beauty_header_dir=$2
7 else
8         uapi_header_dir=tools/include/uapi/linux/
9         beauty_header_dir=tools/perf/trace/beauty/include/linux/
10 fi
11
12 printf "static const char *socket_ipproto[] = {\n"
13 ipproto_regex='^[[:space:]]+IPPROTO_(\w+)[[:space:]]+=[[:space:]]+([[:digit:]]+),.*'
14
15 grep -E $ipproto_regex ${uapi_header_dir}/in.h | \
16         sed -r "s/$ipproto_regex/\2 \1/g"       | \
17         sort -n | xargs printf "\t[%s] = \"%s\",\n"
18 printf "};\n\n"
19
20 printf "static const char *socket_level[] = {\n"
21 socket_level_regex='^#define[[:space:]]+SOL_(\w+)[[:space:]]+([[:digit:]]+)([[:space:]]+/.*)?'
22
23 grep -E $socket_level_regex ${beauty_header_dir}/socket.h | \
24         sed -E "s%$socket_level_regex%\2 \1%g"  | \
25         sort -n | xargs printf "\t[%s] = \"%s\",\n"
26 printf "};\n\n"
27
28 printf 'DEFINE_STRARRAY(socket_level, "SOL_");\n'