Merge tag 'trace-printf-v6.13' of git://git.kernel.org/pub/scm/linux/kernel/git/trace...
[drm/drm-misc.git] / tools / perf / trace / beauty / statx_mask.sh
blob18c802ed0c71578f7268328930123d652cf4ba57
1 #!/bin/sh
2 # SPDX-License-Identifier: LGPL-2.1
4 if [ $# -ne 1 ] ; then
5 beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/
6 else
7 beauty_uapi_linux_dir=$1
8 fi
10 linux_stat=${beauty_uapi_linux_dir}/stat.h
12 printf "static const char *statx_mask[] = {\n"
13 regex='^[[: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
17 grep -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"
23 printf "};\n"