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