brintos

brintos / linux-shallow public Read only

0
0
Text · 874 B · 670c6db Raw
29 lines · bash
1#!/bin/sh2# SPDX-License-Identifier: LGPL-2.13 4if [ $# -gt 0 ] ; then5	uapi_header_dir=$16	beauty_header_dir=$27else8	uapi_header_dir=tools/include/uapi/linux/9	beauty_header_dir=tools/perf/trace/beauty/include/linux/10fi11 12printf "static const char *socket_ipproto[] = {\n"13ipproto_regex='^[[:space:]]+IPPROTO_(\w+)[[:space:]]+=[[:space:]]+([[:digit:]]+),.*'14 15grep -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"18printf "};\n\n"19 20printf "static const char *socket_level[] = {\n"21socket_level_regex='^#define[[:space:]]+SOL_(\w+)[[:space:]]+([[:digit:]]+)([[:space:]]+/.*)?'22 23grep -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"26printf "};\n\n"27 28printf 'DEFINE_STRARRAY(socket_level, "SOL_");\n'29