perf beauty: Introduce faccessat2 flags scnprintf routine

The fsaccessat and fsaccessat2 now have beautifiers for its arguments.
Reviewed-by: default avatarIan 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.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent f122b3d6
......@@ -947,6 +947,15 @@ static const struct syscall_fmt syscall_fmts[] = {
.arg = { [1] = STRARRAY(op, epoll_ctl_ops), }, },
{ .name = "eventfd2",
.arg = { [1] = { .scnprintf = SCA_EFD_FLAGS, /* flags */ }, }, },
{ .name = "faccessat",
.arg = { [0] = { .scnprintf = SCA_FDAT, /* dirfd */ },
[1] = { .scnprintf = SCA_FILENAME, /* pathname */ },
[2] = { .scnprintf = SCA_ACCMODE, /* mode */ }, }, },
{ .name = "faccessat2",
.arg = { [0] = { .scnprintf = SCA_FDAT, /* dirfd */ },
[1] = { .scnprintf = SCA_FILENAME, /* pathname */ },
[2] = { .scnprintf = SCA_ACCMODE, /* mode */ },
[3] = { .scnprintf = SCA_FACCESSAT2_FLAGS, /* flags */ }, }, },
{ .name = "fchmodat",
.arg = { [0] = { .scnprintf = SCA_FDAT, /* fd */ }, }, },
{ .name = "fchownat",
......
......@@ -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
......
......@@ -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);
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment