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 16# AT_HANDLE_FID and AT_HANDLE_MNT_ID_UNIQUE are reusing values and are valid only for name_to_handle_at() 17# AT_RENAME_NOREPLACE reuses 0x1 and is valid only for renameat2() 18grep -E $regex ${linux_fcntl} | \ 19 grep -v AT_EACCESS | \ 20 grep -v AT_STATX_SYNC_TYPE | \ 21 grep -v AT_HANDLE_FID | \ 22 grep -v AT_HANDLE_MNT_ID_UNIQUE | \ 23 grep -v AT_RENAME_NOREPLACE | \ 24 sed -r "s/$regex/\2 \1/g" | \ 25 xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n" 26printf "};\n" 27