2 # SPDX-License-Identifier: LGPL-2.1
8 uapi_header_dir=tools/include/uapi/linux/
9 beauty_header_dir=tools/perf/trace/beauty/include/linux/
12 printf "static const char *socket_ipproto[] = {\n"
13 ipproto_regex='^[[:space:]]+IPPROTO_(\w+)[[:space:]]+=[[:space:]]+([[:digit:]]+),.*'
15 egrep $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"
20 printf "static const char *socket_level[] = {\n"
21 socket_level_regex='^#define[[:space:]]+SOL_(\w+)[[:space:]]+([[:digit:]]+)([[:space:]]+\/.*)?'
23 egrep $socket_level_regex ${beauty_header_dir}/socket.h | \
24 sed -r "s/$socket_level_regex/\2 \1/g" | \
25 sort -n | xargs printf "\t[%s] = \"%s\",\n"
28 printf 'DEFINE_STRARRAY(socket_level, "SOL_");\n'