18c2ecf20Sopenharmony_ci#!/bin/sh
28c2ecf20Sopenharmony_ci# SPDX-License-Identifier: LGPL-2.1
38c2ecf20Sopenharmony_ci
48c2ecf20Sopenharmony_ci[ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/asm-generic/
58c2ecf20Sopenharmony_ci
68c2ecf20Sopenharmony_ciprintf "static const char *madvise_advices[] = {\n"
78c2ecf20Sopenharmony_ciregex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MADV_([[:alnum:]_]+)[[:space:]]+([[:digit:]]+)[[:space:]]*.*'
88c2ecf20Sopenharmony_ciegrep $regex ${header_dir}/mman-common.h | \
98c2ecf20Sopenharmony_ci	sed -r "s/$regex/\2 \1/g"	| \
108c2ecf20Sopenharmony_ci	sort -n | xargs printf "\t[%s] = \"%s\",\n"
118c2ecf20Sopenharmony_ciprintf "};\n"
12