diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2024-03-19 18:49:32 +0100 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2024-03-21 17:54:40 +0100 |
commit | b8171a84061d0201886530800c6e1c0d2fae68a5 (patch) | |
tree | 8286327575b7076b50348b870f0e3d23951a0da7 /tools/perf/trace | |
parent | perf beauty: Introduce scrape script for the 'statx' syscall 'mask' argument (diff) | |
download | linux-b8171a84061d0201886530800c6e1c0d2fae68a5.tar.xz linux-b8171a84061d0201886530800c6e1c0d2fae68a5.zip |
perf beauty: Introduce faccessat2 flags scnprintf routine
The fsaccessat and fsaccessat2 now have beautifiers for its arguments.
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/20240320193115.811899-4-acme@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/trace')
-rw-r--r-- | tools/perf/trace/beauty/beauty.h | 3 | ||||
-rw-r--r-- | tools/perf/trace/beauty/fs_at_flags.c | 24 |
2 files changed, 27 insertions, 0 deletions
diff --git a/tools/perf/trace/beauty/beauty.h b/tools/perf/trace/beauty/beauty.h index c94ae8701bc6..78d10d92d351 100644 --- a/tools/perf/trace/beauty/beauty.h +++ b/tools/perf/trace/beauty/beauty.h @@ -237,6 +237,9 @@ size_t syscall_arg__scnprintf_socket_level(char *bf, size_t size, struct syscall size_t syscall_arg__scnprintf_fs_at_flags(char *bf, size_t size, struct syscall_arg *arg); #define SCA_FS_AT_FLAGS syscall_arg__scnprintf_fs_at_flags +size_t syscall_arg__scnprintf_faccessat2_flags(char *bf, size_t size, struct syscall_arg *arg); +#define SCA_FACCESSAT2_FLAGS syscall_arg__scnprintf_faccessat2_flags + size_t syscall_arg__scnprintf_statx_mask(char *bf, size_t size, struct syscall_arg *arg); #define SCA_STATX_MASK syscall_arg__scnprintf_statx_mask diff --git a/tools/perf/trace/beauty/fs_at_flags.c b/tools/perf/trace/beauty/fs_at_flags.c index 2a099953d993..c1365e8f0b96 100644 --- a/tools/perf/trace/beauty/fs_at_flags.c +++ b/tools/perf/trace/beauty/fs_at_flags.c @@ -7,6 +7,7 @@ #include "trace/beauty/beauty.h" #include <sys/types.h> +#include <linux/fcntl.h> #include <linux/log2.h> #include "trace/beauty/generated/fs_at_flags_array.c" @@ -24,3 +25,26 @@ size_t syscall_arg__scnprintf_fs_at_flags(char *bf, size_t size, struct syscall_ return fs_at__scnprintf_flags(flags, bf, size, show_prefix); } + +static size_t faccessat2__scnprintf_flags(unsigned long flags, char *bf, size_t size, bool show_prefix) +{ + int printed = 0; + + // AT_EACCESS is the same as AT_REMOVEDIR, that is in fs_at_flags_array, + // special case it here. + if (flags & AT_EACCESS) { + flags &= ~AT_EACCESS; + printed += scnprintf(bf + printed, size - printed, "%sEACCESS%s", + show_prefix ? strarray__fs_at_flags.prefix : "", flags ? "|" : ""); + } + + return strarray__scnprintf_flags(&strarray__fs_at_flags, bf + printed, size - printed, show_prefix, flags); +} + +size_t syscall_arg__scnprintf_faccessat2_flags(char *bf, size_t size, struct syscall_arg *arg) +{ + bool show_prefix = arg->show_string_prefix; + int flags = arg->val; + + return faccessat2__scnprintf_flags(flags, bf, size, show_prefix); +} |