xref: /linux/tools/perf/trace/beauty/fs_at_flags.sh (revision d53b8e36925256097a08d7cb749198d85cbf9b2b)
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_fcntl=${beauty_uapi_linux_dir}/fcntl.h
11
12printf "static const char *fs_at_flags[] = {\n"
13regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+AT_([^_]+[[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
14# AT_EACCESS is only meaningful to faccessat, so we will special case it there...
15# AT_STATX_SYNC_TYPE is not a bit, its a mask of AT_STATX_SYNC_AS_STAT, AT_STATX_FORCE_SYNC and AT_STATX_DONT_SYNC
16grep -E $regex ${linux_fcntl} | \
17	grep -v AT_EACCESS | \
18	grep -v AT_STATX_SYNC_TYPE | \
19	sed -r "s/$regex/\2 \1/g"	| \
20	xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n"
21printf "};\n"
22