Merge tag 'amd-drm-next-6.3-2023-01-06' of https://gitlab.freedesktop.org/agd5f/linux...
[linux-2.6-microblaze.git] / tools / perf / trace / beauty / rename_flags.sh
1 #!/bin/sh
2 # Copyright (C) 2018, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
3 # SPDX-License-Identifier: LGPL-2.1
4
5 [ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/
6
7 fs_header=${header_dir}/fs.h
8
9 printf "static const char *rename_flags[] = {\n"
10 regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+RENAME_([[:alnum:]_]+)[[:space:]]+\(1[[:space:]]*<<[[:space:]]*([[:xdigit:]]+)[[:space:]]*\)[[:space:]]*.*'
11 grep -E -q $regex ${fs_header} && \
12 (grep -E $regex ${fs_header} | \
13         sed -r "s/$regex/\2 \1/g"       | \
14         xargs printf "\t[%d + 1] = \"%s\",\n")
15 printf "};\n"