Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf beauty: Move uapi/linux/fs.h copy out of the directory used to build perf

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 scraping.

The only case where it was being used to build was in
tools/perf/trace/beauty/sync_file_range.c, because some older systems
doesn't have the SYNC_FILE_RANGE_WRITE_AND_WAIT define, just use the
system's linux/fs.h header instead, defining it if not available.

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/fs.h> coming from
either 'make install_headers' or from the system /usr/include/
directory.

Suggested-by: Ian Rogers <irogers@google.com>
Reviewed-by: Ian Rogers <irogers@google.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/lkml/CAP-5=fWZVrpRufO4w-S4EcSi9STXcTAN2ERLwTSN7yrSSA-otQ@mail.gmail.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

+18 -8
tools/include/uapi/linux/fs.h tools/perf/trace/beauty/include/uapi/linux/fs.h
+5 -4
tools/perf/Makefile.perf
··· 472 472 clean > /dev/null 473 473 474 474 beauty_linux_dir := $(srctree)/tools/perf/trace/beauty/include/linux/ 475 + beauty_uapi_linux_dir := $(srctree)/tools/perf/trace/beauty/include/uapi/linux/ 475 476 linux_uapi_dir := $(srctree)/tools/include/uapi/linux 476 477 asm_generic_uapi_dir := $(srctree)/tools/include/uapi/asm-generic 477 478 arch_asm_uapi_dir := $(srctree)/tools/arch/$(SRCARCH)/include/uapi/asm/ ··· 648 647 rename_flags_array := $(beauty_outdir)/rename_flags_array.c 649 648 rename_flags_tbl := $(srctree)/tools/perf/trace/beauty/rename_flags.sh 650 649 651 - $(rename_flags_array): $(linux_uapi_dir)/fs.h $(rename_flags_tbl) 652 - $(Q)$(SHELL) '$(rename_flags_tbl)' $(linux_uapi_dir) > $@ 650 + $(rename_flags_array): $(beauty_uapi_linux_dir)/fs.h $(rename_flags_tbl) 651 + $(Q)$(SHELL) '$(rename_flags_tbl)' $(beauty_uapi_linux_dir) > $@ 653 652 654 653 arch_errno_name_array := $(beauty_outdir)/arch_errno_name_array.c 655 654 arch_errno_hdr_dir := $(srctree)/tools ··· 661 660 sync_file_range_arrays := $(beauty_outdir)/sync_file_range_arrays.c 662 661 sync_file_range_tbls := $(srctree)/tools/perf/trace/beauty/sync_file_range.sh 663 662 664 - $(sync_file_range_arrays): $(linux_uapi_dir)/fs.h $(sync_file_range_tbls) 665 - $(Q)$(SHELL) '$(sync_file_range_tbls)' $(linux_uapi_dir) > $@ 663 + $(sync_file_range_arrays): $(beauty_uapi_linux_dir)/fs.h $(sync_file_range_tbls) 664 + $(Q)$(SHELL) '$(sync_file_range_tbls)' $(beauty_uapi_linux_dir) > $@ 666 665 667 666 TESTS_CORESIGHT_DIR := $(srctree)/tools/perf/tests/shell/coresight 668 667
+1 -1
tools/perf/check-headers.sh
··· 11 11 "include/uapi/drm/i915_drm.h" 12 12 "include/uapi/linux/fadvise.h" 13 13 "include/uapi/linux/fcntl.h" 14 - "include/uapi/linux/fs.h" 15 14 "include/uapi/linux/fscrypt.h" 16 15 "include/uapi/linux/kcmp.h" 17 16 "include/uapi/linux/kvm.h" ··· 97 98 declare -a BEAUTY_FILES 98 99 BEAUTY_FILES=( 99 100 "include/linux/socket.h" 101 + "include/uapi/linux/fs.h" 100 102 ) 101 103 102 104 declare -a FAILURES
+1 -1
tools/perf/trace/beauty/rename_flags.sh
··· 2 2 # Copyright (C) 2018, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com> 3 3 # SPDX-License-Identifier: LGPL-2.1 4 4 5 - [ $# -eq 1 ] && header_dir=$1 || header_dir=tools/include/uapi/linux/ 5 + [ $# -eq 1 ] && header_dir=$1 || header_dir=tools/perf/trace/beauty/include/uapi/linux/ 6 6 7 7 fs_header=${header_dir}/fs.h 8 8
+10 -1
tools/perf/trace/beauty/sync_file_range.c
··· 7 7 8 8 #include "trace/beauty/beauty.h" 9 9 #include <linux/log2.h> 10 - #include <uapi/linux/fs.h> 10 + #include <linux/fs.h> 11 + 12 + #ifndef SYNC_FILE_RANGE_WRITE_AND_WAIT 13 + #define SYNC_FILE_RANGE_WAIT_BEFORE 1 14 + #define SYNC_FILE_RANGE_WRITE 2 15 + #define SYNC_FILE_RANGE_WAIT_AFTER 4 16 + #define SYNC_FILE_RANGE_WRITE_AND_WAIT (SYNC_FILE_RANGE_WRITE | \ 17 + SYNC_FILE_RANGE_WAIT_BEFORE | \ 18 + SYNC_FILE_RANGE_WAIT_AFTER) 19 + #endif 11 20 12 21 static size_t sync_file_range__scnprintf_flags(unsigned long flags, char *bf, size_t size, bool show_prefix) 13 22 {
+1 -1
tools/perf/trace/beauty/sync_file_range.sh
··· 2 2 # SPDX-License-Identifier: LGPL-2.1 3 3 4 4 if [ $# -ne 1 ] ; then 5 - linux_header_dir=tools/include/uapi/linux 5 + linux_header_dir=tools/perf/trace/beauty/include/uapi/linux/ 6 6 else 7 7 linux_header_dir=$1 8 8 fi