From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Ian Rogers <irogers@google.com>
Cc: Jiri Olsa <jolsa@kernel.org>, Namhyung Kim <namhyung@kernel.org>,
Adrian Hunter <adrian.hunter@intel.com>,
linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org,
Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: [PATCH 1/3] perf beauty: Move uapi/linux/usbdevice_fs.h copy out of the directory used to build perf
Date: Thu, 14 Mar 2024 11:43:18 -0300 [thread overview]
Message-ID: <20240314144320.743217-2-acme@kernel.org> (raw)
In-Reply-To: <20240314144320.743217-1-acme@kernel.org>
From: Arnaldo Carvalho de Melo <acme@redhat.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/usbdevice_fs.h> coming
from either 'make install_headers' or from the system /usr/include/
directory.
Suggested-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>
---
tools/perf/Makefile.perf | 4 ++--
| 2 +-
.../trace/beauty}/include/uapi/linux/usbdevice_fs.h | 0
tools/perf/trace/beauty/usbdevfs_ioctl.sh | 6 +++---
4 files changed, 6 insertions(+), 6 deletions(-)
rename tools/{ => perf/trace/beauty}/include/uapi/linux/usbdevice_fs.h (100%)
diff --git a/tools/perf/Makefile.perf b/tools/perf/Makefile.perf
index 523c3b7d6c9d3f51..53ec3765b4b2bd1b 100644
--- a/tools/perf/Makefile.perf
+++ b/tools/perf/Makefile.perf
@@ -623,8 +623,8 @@ $(prctl_option_array): $(prctl_hdr_dir)/prctl.h $(prctl_option_tbl)
usbdevfs_ioctl_array := $(beauty_ioctl_outdir)/usbdevfs_ioctl_array.c
usbdevfs_ioctl_tbl := $(srctree)/tools/perf/trace/beauty/usbdevfs_ioctl.sh
-$(usbdevfs_ioctl_array): $(linux_uapi_dir)/usbdevice_fs.h $(usbdevfs_ioctl_tbl)
- $(Q)$(SHELL) '$(usbdevfs_ioctl_tbl)' $(linux_uapi_dir) > $@
+$(usbdevfs_ioctl_array): $(beauty_uapi_linux_dir)/usbdevice_fs.h $(usbdevfs_ioctl_tbl)
+ $(Q)$(SHELL) '$(usbdevfs_ioctl_tbl)' $(beauty_uapi_linux_dir) > $@
x86_arch_prctl_code_array := $(beauty_outdir)/x86_arch_prctl_code_array.c
x86_arch_prctl_code_tbl := $(srctree)/tools/perf/trace/beauty/x86_arch_prctl.sh
--git a/tools/perf/check-headers.sh b/tools/perf/check-headers.sh
index c2c26d6b87ef52f9..356ddb76a9541018 100755
--- a/tools/perf/check-headers.sh
+++ b/tools/perf/check-headers.sh
@@ -21,7 +21,6 @@ FILES=(
"include/uapi/linux/sched.h"
"include/uapi/linux/seccomp.h"
"include/uapi/linux/stat.h"
- "include/uapi/linux/usbdevice_fs.h"
"include/uapi/linux/vhost.h"
"include/uapi/sound/asound.h"
"include/linux/bits.h"
@@ -98,6 +97,7 @@ BEAUTY_FILES=(
"include/linux/socket.h"
"include/uapi/linux/fs.h"
"include/uapi/linux/mount.h"
+ "include/uapi/linux/usbdevice_fs.h"
)
declare -a FAILURES
diff --git a/tools/include/uapi/linux/usbdevice_fs.h b/tools/perf/trace/beauty/include/uapi/linux/usbdevice_fs.h
similarity index 100%
rename from tools/include/uapi/linux/usbdevice_fs.h
rename to tools/perf/trace/beauty/include/uapi/linux/usbdevice_fs.h
diff --git a/tools/perf/trace/beauty/usbdevfs_ioctl.sh b/tools/perf/trace/beauty/usbdevfs_ioctl.sh
index b39cfb3720b80624..12a30a9a8e0c8f44 100755
--- a/tools/perf/trace/beauty/usbdevfs_ioctl.sh
+++ b/tools/perf/trace/beauty/usbdevfs_ioctl.sh
@@ -1,21 +1,21 @@
#!/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/
# also as:
# #define USBDEVFS_CONNINFO_EX(len) _IOC(_IOC_READ, 'U', 32, len)
printf "static const char *usbdevfs_ioctl_cmds[] = {\n"
regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)(\(\w+\))?[[:space:]]+_IO[CWR]{0,2}\([[:space:]]*(_IOC_\w+,[[:space:]]*)?'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
-grep -E "$regex" ${header_dir}/usbdevice_fs.h | grep -E -v 'USBDEVFS_\w+32[[:space:]]' | \
+grep -E "$regex" ${beauty_uapi_linux_dir}/usbdevice_fs.h | grep -E -v 'USBDEVFS_\w+32[[:space:]]' | \
sed -r "s/$regex/\4 \1/g" | \
sort | xargs printf "\t[%s] = \"%s\",\n"
printf "};\n\n"
printf "#if 0\n"
printf "static const char *usbdevfs_ioctl_32_cmds[] = {\n"
regex="^#[[:space:]]*define[[:space:]]+USBDEVFS_(\w+)[[:space:]]+_IO[WR]{0,2}\([[:space:]]*'U'[[:space:]]*,[[:space:]]*([[:digit:]]+).*"
-grep -E $regex ${header_dir}/usbdevice_fs.h | grep -E 'USBDEVFS_\w+32[[:space:]]' | \
+grep -E $regex ${beauty_uapi_linux_dir}/usbdevice_fs.h | grep -E 'USBDEVFS_\w+32[[:space:]]' | \
sed -r "s/$regex/\2 \1/g" | \
sort | xargs printf "\t[%s] = \"%s\",\n"
printf "};\n"
--
2.43.2
next prev parent reply other threads:[~2024-03-14 14:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-14 14:43 [PATCH 0/3] Move some more header copies to tools/perf/trace/beauty/ Arnaldo Carvalho de Melo
2024-03-14 14:43 ` Arnaldo Carvalho de Melo [this message]
2024-03-14 14:43 ` [PATCH 2/3] perf beauty: Move uapi/sound/asound.h copy out of the directory used to build perf Arnaldo Carvalho de Melo
2024-03-14 14:43 ` [PATCH 3/3] perf beauty: Move arch/x86/include/asm/irq_vectors.h " Arnaldo Carvalho de Melo
2024-03-14 15:00 ` [PATCH 0/3] Move some more header copies to tools/perf/trace/beauty/ Ian Rogers
[not found] ` <CA+JHD93osaLDZurWep=ie5Rnshk-T8i8ZnLrneVfeQ6eNAaKJA@mail.gmail.com>
2024-03-14 16:55 ` Ian Rogers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240314144320.743217-2-acme@kernel.org \
--to=acme@kernel.org \
--cc=acme@redhat.com \
--cc=adrian.hunter@intel.com \
--cc=irogers@google.com \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=namhyung@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.