Linux Audio

Check our new training course

Loading...
v4.17
 1#!/bin/sh
 
 2
 3header_dir=$1
 4
 5printf "static const char *madvise_advices[] = {\n"
 6regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MADV_([[:alnum:]_]+)[[:space:]]+([[:digit:]]+)[[:space:]]*.*'
 7egrep $regex ${header_dir}/mman-common.h | \
 8	sed -r "s/$regex/\2 \1/g"	| \
 9	sort -n | xargs printf "\t[%s] = \"%s\",\n"
10printf "};\n"
v6.8
 1#!/bin/sh
 2# SPDX-License-Identifier: LGPL-2.1
 3
 4[ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/asm-generic/
 5
 6printf "static const char *madvise_advices[] = {\n"
 7regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MADV_([[:alnum:]_]+)[[:space:]]+([[:digit:]]+)[[:space:]]*.*'
 8grep -E $regex ${header_dir}/mman-common.h | \
 9	sed -r "s/$regex/\2 \1/g"	| \
10	sort -n | xargs printf "\t[%s] = \"%s\",\n"
11printf "};\n"