1ceaf8e5bSArnaldo Carvalho de Melo#!/bin/sh 2ceaf8e5bSArnaldo Carvalho de Melo# SPDX-License-Identifier: LGPL-2.1 3ceaf8e5bSArnaldo Carvalho de Melo 4ceaf8e5bSArnaldo Carvalho de Melo[ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/ 5ceaf8e5bSArnaldo Carvalho de Melo 6ceaf8e5bSArnaldo Carvalho de Meloprintf "static const char *mount_flags[] = {\n" 7ceaf8e5bSArnaldo Carvalho de Meloregex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MS_([[:alnum:]_]+)[[:space:]]+([[:digit:]]+)[[:space:]]*.*' 8*818448e9STiezhu Yanggrep -E $regex ${header_dir}/mount.h | grep -E -v '(MSK|VERBOSE|MGC_VAL)\>' | \ 9ceaf8e5bSArnaldo Carvalho de Melo sed -r "s/$regex/\2 \2 \1/g" | sort -n | \ 10ceaf8e5bSArnaldo Carvalho de Melo xargs printf "\t[%s ? (ilog2(%s) + 1) : 0] = \"%s\",\n" 11ceaf8e5bSArnaldo Carvalho de Meloregex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MS_([[:alnum:]_]+)[[:space:]]+\(1<<([[:digit:]]+)\)[[:space:]]*.*' 12*818448e9STiezhu Yanggrep -E $regex ${header_dir}/mount.h | \ 13ceaf8e5bSArnaldo Carvalho de Melo sed -r "s/$regex/\2 \1/g" | \ 14ceaf8e5bSArnaldo Carvalho de Melo xargs printf "\t[%s + 1] = \"%s\",\n" 15ceaf8e5bSArnaldo Carvalho de Meloprintf "};\n" 16