Move more stuff to tools/perf/trace/beauty/include
Arnaldo Carvalho de Melo
maintainercover Move more stuff to tools/perf/trace/beauty/include
Hi,
Move one more file that is used by multiple scrappers.
- Arnaldo
Arnaldo Carvalho de Melo (2):
perf beauty: Don't include uapi/linux/mount.h, use sys/mount.h instead perf beauty: Move uapi/linux/mount.h copy out of the directory used to
build perf
tools/perf/Makefile.perf | 21 +++++++++----------
tools/perf/check-headers.sh | 2 +-
tools/perf/trace/beauty/fsconfig.sh | 6 +++---
tools/perf/trace/beauty/fsmount.c | 9 +++++++-
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 +++---
9 files changed, 34 insertions(+), 28 deletions(-)
rename tools/{ => perf/trace/beauty}/include/uapi/linux/mount.h (100%)Signature · 1 line
2.43.0
Arnaldo Carvalho de Melo
maintainerPATCH 1/2 perf beauty: Don't include uapi/linux/mount.h, use sys/mount.h instead
From: Arnaldo Carvalho de Melo <[email protected]>
The tools/include/uapi/linux/mount.h file is mostly used for scrapping defines into id->string tables, this is the only place were it is being directly used, stop doing so.
Define MOUNT_ATTR_RELATIME and MOUNT_ATTR__ATIME if not available in the system's headers.
--- tools/perf/trace/beauty/fsmount.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
tools/perf/trace/beauty/fsmount.c +8 -1
@@ -7,7 +7,14 @@#include "trace/beauty/beauty.h" #include <linux/log2.h> -#include <uapi/linux/mount.h> +#include <sys/mount.h> + +#ifndef MOUNT_ATTR__ATIME +#define MOUNT_ATTR__ATIME 0x00000070/* Setting on how atime should be updated */ +#endif +#ifndef MOUNT_ATTR_RELATIME +#define MOUNT_ATTR_RELATIME 0x00000000/* - Update atime relative to mtime/ctime. */ +#endif static size_t fsmount__scnprintf_attr_flags (unsigned long flags,char *bf,size_t size,bool show_prefix) {
Signature · 1 line
2.43.0
Arnaldo Carvalho de Melo
maintainerPATCH 2/2 perf beauty: Move uapi/linux/mount.h copy out of the directory used to build perf
In reply to Arnaldo Carvalho de MeloFrom: Arnaldo Carvalho de Melo <[email protected]>
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.
---
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%)tools/perf/Makefile.perf +10 -11
@@ -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
tools/perf/check-headers.sh +1 -1
@@ -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
tools/perf/trace/beauty/fsconfig.sh +3 -3
@@ -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:]]*'
tools/perf/trace/beauty/fsmount.sh +3 -3
@@ -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
tools/perf/trace/beauty/fspick.sh +3 -3
@@ -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:]]*.*'
tools/perf/trace/beauty/include/uapi/linux/mount.h renamed from tools/include/uapi/linux/mount.h +0 -0
tools/perf/trace/beauty/mount_flags.sh +3 -3
@@ -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"
tools/perf/trace/beauty/move_mount_flags.sh +3 -3
@@ -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:]]*.*'
Signature · 1 line
2.43.0