18c2ecf20Sopenharmony_ci#!/bin/sh 28c2ecf20Sopenharmony_ci# SPDX-License-Identifier: LGPL-2.1 38c2ecf20Sopenharmony_ci 48c2ecf20Sopenharmony_ciif [ $# -ne 1 ] ; then 58c2ecf20Sopenharmony_ci linux_header_dir=tools/include/uapi/linux 68c2ecf20Sopenharmony_cielse 78c2ecf20Sopenharmony_ci linux_header_dir=$1 88c2ecf20Sopenharmony_cifi 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_cilinux_mount=${linux_header_dir}/mount.h 118c2ecf20Sopenharmony_ci 128c2ecf20Sopenharmony_ci# Remove MOUNT_ATTR_RELATIME as it is zeros, handle it a special way in the beautifier 138c2ecf20Sopenharmony_ci# Only handle MOUNT_ATTR_ followed by a capital letter/num as __ is special case 148c2ecf20Sopenharmony_ci# for things like MOUNT_ATTR__ATIME that is a mask for the possible ATIME handling 158c2ecf20Sopenharmony_ci# bits. Special case it as well in the beautifier 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ciprintf "static const char *fsmount_attr_flags[] = {\n" 188c2ecf20Sopenharmony_ciregex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MOUNT_ATTR_([[:alnum:]][[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*' 198c2ecf20Sopenharmony_ciegrep $regex ${linux_mount} | grep -v MOUNT_ATTR_RELATIME | \ 208c2ecf20Sopenharmony_ci sed -r "s/$regex/\2 \1/g" | \ 218c2ecf20Sopenharmony_ci xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n" 228c2ecf20Sopenharmony_ciprintf "};\n" 23