24 lines · bash
1#!/bin/sh2# SPDX-License-Identifier: LGPL-2.13 4if [ $# -ne 1 ] ; then5 beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/6else7 beauty_uapi_linux_dir=$18fi9 10linux_stat=${beauty_uapi_linux_dir}/stat.h11 12printf "static const char *statx_mask[] = {\n"13regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+STATX_([^_]+[[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'14# STATX_BASIC_STATS its a bitmask formed by the mask in the normal stat struct15# STATX_ALL is another bitmask and deprecated16# STATX_ATTR_*: Attributes to be found in stx_attributes and masked in stx_attributes_mask17grep -E $regex ${linux_stat} | \18 grep -v STATX_ALL | \19 grep -v STATX_BASIC_STATS | \20 grep -v '\<STATX_ATTR_' | \21 sed -r "s/$regex/\2 \1/g" | \22 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n"23printf "};\n"24