mirror of
https://github.com/torvalds/linux.git
synced 2026-06-02 19:43:40 +02:00
And move the existing one to fsmount_attr.sh to be more precise.
Now the fsmount_flags[] is generated from the mount.h like below.
The ilog2() + 1 is an existing pattern to handle bit flags.
$ cat tools/perf/trace/beauty/generated/fsmount_arrays.c
static const char *fsmount_flags[] = {
[ilog2(0x00000001) + 1] = "CLOEXEC",
[ilog2(0x00000002) + 1] = "NAMESPACE",
};
It was found by Sashiko during the review.
Reviewed-by: Ian Rogers <irogers@google.com>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
18 lines
523 B
Bash
Executable File
18 lines
523 B
Bash
Executable File
#!/bin/sh
|
|
# SPDX-License-Identifier: LGPL-2.1
|
|
|
|
if [ $# -ne 1 ] ; then
|
|
beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/
|
|
else
|
|
beauty_uapi_linux_dir=$1
|
|
fi
|
|
|
|
linux_mount=${beauty_uapi_linux_dir}/mount.h
|
|
|
|
printf "static const char *fsmount_flags[] = {\n"
|
|
regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+FSMOUNT_([[:alnum:]][[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
|
|
grep -E $regex ${linux_mount} | \
|
|
sed -r "s/$regex/\2 \1/g" | \
|
|
xargs printf "\t[ilog2(%s) + 1] = \"%s\",\n"
|
|
printf "};\n"
|