xref: /linux/tools/perf/trace/beauty/statx_mask.sh (revision 8e1bb4a41aa78d6105e59186af3dcd545fc66e70)
1#!/bin/sh
2# SPDX-License-Identifier: LGPL-2.1
3
4if [ $# -ne 1 ] ; then
5	beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/
6else
7	beauty_uapi_linux_dir=$1
8fi
9
10linux_stat=${beauty_uapi_linux_dir}/stat.h
11
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 struct
15# STATX_ALL is another bitmask and deprecated
16# STATX_ATTR_*: Attributes to be found in stx_attributes and masked in stx_attributes_mask
17grep -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