Back to home page

OSCL-LXR

 
 

    


0001 #!/bin/sh
0002 # SPDX-License-Identifier: LGPL-2.1
0003 
0004 if [ $# -gt 0 ] ; then
0005         uapi_header_dir=$1
0006         beauty_header_dir=$2
0007 else
0008         uapi_header_dir=tools/include/uapi/linux/
0009         beauty_header_dir=tools/perf/trace/beauty/include/linux/
0010 fi
0011 
0012 printf "static const char *socket_ipproto[] = {\n"
0013 ipproto_regex='^[[:space:]]+IPPROTO_(\w+)[[:space:]]+=[[:space:]]+([[:digit:]]+),.*'
0014 
0015 egrep $ipproto_regex ${uapi_header_dir}/in.h | \
0016         sed -r "s/$ipproto_regex/\2 \1/g"       | \
0017         sort -n | xargs printf "\t[%s] = \"%s\",\n"
0018 printf "};\n\n"
0019 
0020 printf "static const char *socket_level[] = {\n"
0021 socket_level_regex='^#define[[:space:]]+SOL_(\w+)[[:space:]]+([[:digit:]]+)([[:space:]]+\/.*)?'
0022 
0023 egrep $socket_level_regex ${beauty_header_dir}/socket.h | \
0024         sed -r "s/$socket_level_regex/\2 \1/g"  | \
0025         sort -n | xargs printf "\t[%s] = \"%s\",\n"
0026 printf "};\n\n"
0027 
0028 printf 'DEFINE_STRARRAY(socket_level, "SOL_");\n'