[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20240312205112.688776-3-acme@kernel.org>
Date: Tue, 12 Mar 2024 17:51:12 -0300
From: Arnaldo Carvalho de Melo <acme@...nel.org>
To: Ian Rogers <irogers@...gle.com>
Cc: Jiri Olsa <jolsa@...nel.org>,
Namhyung Kim <namhyung@...nel.org>,
Adrian Hunter <adrian.hunter@...el.com>,
linux-kernel@...r.kernel.org,
linux-perf-users@...r.kernel.org,
Arnaldo Carvalho de Melo <acme@...hat.com>
Subject: [PATCH 2/2] perf beauty: Move uapi/linux/mount.h copy out of the directory used to build perf
From: Arnaldo Carvalho de Melo <acme@...hat.com>
It is mostly used only to generate string tables, not to build perf, so
move it to the tools/perf/trace/beauty/include/ hierarchy, that is used
just for scrapping.
This is a something that should've have happened, as happened with the
linux/socket.h scrapper, do it now as Ian suggested while doing an
audit/refactor session in the headers used by perf.
No other tools/ living code uses it, just <linux/mount.h> coming from
either 'make install_headers' or from the system /usr/include/
directory.
Suggested-by: Ian Rogers <irogers@...gle.com>
Cc: Adrian Hunter <adrian.hunter@...el.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Namhyung Kim <namhyung@...nel.org>
Link: https://lore.kernel.org/lkml/CAP-5=fWZVrpRufO4w-S4EcSi9STXcTAN2ERLwTSN7yrSSA-otQ@mail.gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/Makefile.perf | 21 +++++++++----------
tools/perf/check-headers.sh | 2 +-
tools/perf/trace/beauty/fsconfig.sh | 6 +++---
tools/perf/trace/beauty/fsmount.sh | 6 +++---
tools/perf/trace/beauty/fspick.sh | 6 +++---
.../trace/beauty}/include/uapi/linux/mount.h | 0
tools/perf/trace/beauty/mount_flags.sh | 6 +++---
tools/perf/trace/beauty/move_mount_flags.sh | 6 +++---
8 files changed, 26 insertions(+), 27 deletions(-)
rename tools/{ => perf/trace/beauty}/include/uapi/linux/mount.h (100%)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 643e9fa6ec89c58c..523c3b7d6c9d3f51 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -500,20 +500,20 @@ $(fadvise_advice_array): $(linux_uapi_dir)/in.h $(fadvise_advice_tbl)
fsmount_arrays := $(beauty_outdir)/fsmount_arrays.c
fsmount_tbls := $(srctree)/tools/perf/trace/beauty/fsmount.sh
-$(fsmount_arrays): $(linux_uapi_dir)/mount.h $(fsmount_tbls)
- $(Q)$(SHELL) '$(fsmount_tbls)' $(linux_uapi_dir) > $@
+$(fsmount_arrays): $(beauty_uapi_linux_dir)/mount.h $(fsmount_tbls)
+ $(Q)$(SHELL) '$(fsmount_tbls)' $(beauty_uapi_linux_dir) > $@
fspick_arrays := $(beauty_outdir)/fspick_arrays.c
fspick_tbls := $(srctree)/tools/perf/trace/beauty/fspick.sh
-$(fspick_arrays): $(linux_uapi_dir)/mount.h $(fspick_tbls)
- $(Q)$(SHELL) '$(fspick_tbls)' $(linux_uapi_dir) > $@
+$(fspick_arrays): $(beauty_uapi_linux_dir)/mount.h $(fspick_tbls)
+ $(Q)$(SHELL) '$(fspick_tbls)' $(beauty_uapi_linux_dir) > $@
fsconfig_arrays := $(beauty_outdir)/fsconfig_arrays.c
fsconfig_tbls := $(srctree)/tools/perf/trace/beauty/fsconfig.sh
-$(fsconfig_arrays): $(linux_uapi_dir)/mount.h $(fsconfig_tbls)
- $(Q)$(SHELL) '$(fsconfig_tbls)' $(linux_uapi_dir) > $@
+$(fsconfig_arrays): $(beauty_uapi_linux_dir)/mount.h $(fsconfig_tbls)
+ $(Q)$(SHELL) '$(fsconfig_tbls)' $(beauty_uapi_linux_dir) > $@
pkey_alloc_access_rights_array := $(beauty_outdir)/pkey_alloc_access_rights_array.c
asm_generic_hdr_dir := $(srctree)/tools/include/uapi/asm-generic/
@@ -598,15 +598,14 @@ $(mremap_flags_array): $(linux_uapi_dir)/mman.h $(mremap_flags_tbl)
mount_flags_array := $(beauty_outdir)/mount_flags_array.c
mount_flags_tbl := $(srctree)/tools/perf/trace/beauty/mount_flags.sh
-$(mount_flags_array): $(linux_uapi_dir)/mount.h $(mount_flags_tbl)
- $(Q)$(SHELL) '$(mount_flags_tbl)' $(linux_uapi_dir) > $@
+$(mount_flags_array): $(beauty_uapi_linux_dir)/mount.h $(mount_flags_tbl)
+ $(Q)$(SHELL) '$(mount_flags_tbl)' $(beauty_uapi_linux_dir) > $@
move_mount_flags_array := $(beauty_outdir)/move_mount_flags_array.c
move_mount_flags_tbl := $(srctree)/tools/perf/trace/beauty/move_mount_flags.sh
-$(move_mount_flags_array): $(linux_uapi_dir)/mount.h $(move_mount_flags_tbl)
- $(Q)$(SHELL) '$(move_mount_flags_tbl)' $(linux_uapi_dir) > $@
-
+$(move_mount_flags_array): $(beauty_uapi_linux_dir)/mount.h $(move_mount_flags_tbl)
+ $(Q)$(SHELL) '$(move_mount_flags_tbl)' $(beauty_uapi_linux_dir) > $@
mmap_prot_array := $(beauty_outdir)/mmap_prot_array.c
mmap_prot_tbl := $(srctree)/tools/perf/trace/beauty/mmap_prot.sh
diff --git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
index 015f74137b755eaf..c2c26d6b87ef52f9 100755
--- a/tools/perf/check-headers.sh
+++ b/tools/perf/check-headers.sh
@@ -15,7 +15,6 @@ FILES=(
"include/uapi/linux/kcmp.h"
"include/uapi/linux/kvm.h"
"include/uapi/linux/in.h"
- "include/uapi/linux/mount.h"
"include/uapi/linux/openat2.h"
"include/uapi/linux/perf_event.h"
"include/uapi/linux/prctl.h"
@@ -98,6 +97,7 @@ declare -a BEAUTY_FILES
BEAUTY_FILES=(
"include/linux/socket.h"
"include/uapi/linux/fs.h"
+ "include/uapi/linux/mount.h"
)
declare -a FAILURES
diff --git a/tools/perf/trace/beauty/fsconfig.sh b/tools/perf/trace/beauty/fsconfig.sh
index bc6ef7bb7a5f93c2..09cee79de00ca35d 100755
--- a/tools/perf/trace/beauty/fsconfig.sh
+++ b/tools/perf/trace/beauty/fsconfig.sh
@@ -2,12 +2,12 @@
# SPDX-License-Identifier: LGPL-2.1
if [ $# -ne 1 ] ; then
- linux_header_dir=tools/include/uapi/linux
+ beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/
else
- linux_header_dir=$1
+ beauty_uapi_linux_dir=$1
fi
-linux_mount=${linux_header_dir}/mount.h
+linux_mount=${beauty_uapi_linux_dir}/mount.h
printf "static const char *fsconfig_cmds[] = {\n"
ms='[[:space:]]*'
diff --git a/tools/perf/trace/beauty/fsmount.sh b/tools/perf/trace/beauty/fsmount.sh
index cba8897a751fd487..6b67a54cdeee64b3 100755
--- a/tools/perf/trace/beauty/fsmount.sh
+++ b/tools/perf/trace/beauty/fsmount.sh
@@ -2,12 +2,12 @@
# SPDX-License-Identifier: LGPL-2.1
if [ $# -ne 1 ] ; then
- linux_header_dir=tools/include/uapi/linux
+ beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/
else
- linux_header_dir=$1
+ beauty_uapi_linux_dir=$1
fi
-linux_mount=${linux_header_dir}/mount.h
+linux_mount=${beauty_uapi_linux_dir}/mount.h
# Remove MOUNT_ATTR_RELATIME as it is zeros, handle it a special way in the beautifier
# Only handle MOUNT_ATTR_ followed by a capital letter/num as __ is special case
diff --git a/tools/perf/trace/beauty/fspick.sh b/tools/perf/trace/beauty/fspick.sh
index 1f088329b96ef0f2..0d9951c22b952ed1 100755
--- a/tools/perf/trace/beauty/fspick.sh
+++ b/tools/perf/trace/beauty/fspick.sh
@@ -2,12 +2,12 @@
# SPDX-License-Identifier: LGPL-2.1
if [ $# -ne 1 ] ; then
- linux_header_dir=tools/include/uapi/linux
+ beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/
else
- linux_header_dir=$1
+ beauty_uapi_linux_dir=$1
fi
-linux_mount=${linux_header_dir}/mount.h
+linux_mount=${beauty_uapi_linux_dir}/mount.h
printf "static const char *fspick_flags[] = {\n"
regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+FSPICK_([[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
diff --git a/tools/include/uapi/linux/mount.h b/tools/perf/trace/beauty/include/uapi/linux/mount.h
similarity index 100%
rename from tools/include/uapi/linux/mount.h
rename to tools/perf/trace/beauty/include/uapi/linux/mount.h
diff --git a/tools/perf/trace/beauty/mount_flags.sh b/tools/perf/trace/beauty/mount_flags.sh
index 730099a9a67c1e57..ff578f7b451b5a1d 100755
--- a/tools/perf/trace/beauty/mount_flags.sh
+++ b/tools/perf/trace/beauty/mount_flags.sh
@@ -1,15 +1,15 @@
#!/bin/sh
# SPDX-License-Identifier: LGPL-2.1
-[ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/
+[ $# -eq 1 ] && beauty_uapi_linux_dir=$1 || beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/
printf "static const char *mount_flags[] = {\n"
regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MS_([[:alnum:]_]+)[[:space:]]+([[:digit:]]+)[[:space:]]*.*'
-grep -E $regex ${header_dir}/mount.h | grep -E -v '(MSK|VERBOSE|MGC_VAL)\>' | \
+grep -E $regex ${beauty_uapi_linux_dir}/mount.h | grep -E -v '(MSK|VERBOSE|MGC_VAL)\>' | \
sed -r "s/$regex/\2 \2 \1/g" | sort -n | \
xargs printf "\t[%s ? (ilog2(%s) + 1) : 0] = \"%s\",\n"
regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MS_([[:alnum:]_]+)[[:space:]]+\(1<<([[:digit:]]+)\)[[:space:]]*.*'
-grep -E $regex ${header_dir}/mount.h | \
+grep -E $regex ${beauty_uapi_linux_dir}/mount.h | \
sed -r "s/$regex/\2 \1/g" | \
xargs printf "\t[%s + 1] = \"%s\",\n"
printf "};\n"
diff --git a/tools/perf/trace/beauty/move_mount_flags.sh b/tools/perf/trace/beauty/move_mount_flags.sh
index ce5e632d14484bd2..c0dde9020bc38c21 100755
--- a/tools/perf/trace/beauty/move_mount_flags.sh
+++ b/tools/perf/trace/beauty/move_mount_flags.sh
@@ -2,12 +2,12 @@
# SPDX-License-Identifier: LGPL-2.1
if [ $# -ne 1 ] ; then
- linux_header_dir=tools/include/uapi/linux
+ beauty_uapi_linux_dir=tools/perf/trace/beauty/include/uapi/linux/
else
- linux_header_dir=$1
+ beauty_uapi_linux_dir=$1
fi
-linux_mount=${linux_header_dir}/mount.h
+linux_mount=${beauty_uapi_linux_dir}/mount.h
printf "static const char *move_mount_flags[] = {\n"
regex='^[[:space:]]*#[[:space:]]*define[[:space:]]+MOVE_MOUNT_([^_]+[[:alnum:]_]+)[[:space:]]+(0x[[:xdigit:]]+)[[:space:]]*.*'
--
2.43.0
Powered by blists - more mailing lists