summaryrefslogtreecommitdiffstats
path: root/tools/perf/trace/beauty/statx.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/trace/beauty/statx.c')
-rw-r--r--tools/perf/trace/beauty/statx.c67
1 files changed, 7 insertions, 60 deletions
diff --git a/tools/perf/trace/beauty/statx.c b/tools/perf/trace/beauty/statx.c
index dc5943a635..24843e614b 100644
--- a/tools/perf/trace/beauty/statx.c
+++ b/tools/perf/trace/beauty/statx.c
@@ -6,73 +6,20 @@
*/
#include "trace/beauty/beauty.h"
-#include <linux/kernel.h>
#include <sys/types.h>
-#include <uapi/linux/fcntl.h>
-#include <uapi/linux/stat.h>
+#include <linux/log2.h>
-size_t syscall_arg__scnprintf_statx_flags(char *bf, size_t size, struct syscall_arg *arg)
+static size_t statx__scnprintf_mask(unsigned long mask, char *bf, size_t size, bool show_prefix)
{
- bool show_prefix = arg->show_string_prefix;
- const char *prefix = "AT_";
- int printed = 0, flags = arg->val;
-
- if (flags == 0)
- return scnprintf(bf, size, "%s%s", show_prefix ? "AT_STATX_" : "", "SYNC_AS_STAT");
-#define P_FLAG(n) \
- if (flags & AT_##n) { \
- printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \
- flags &= ~AT_##n; \
- }
-
- P_FLAG(SYMLINK_NOFOLLOW);
- P_FLAG(REMOVEDIR);
- P_FLAG(SYMLINK_FOLLOW);
- P_FLAG(NO_AUTOMOUNT);
- P_FLAG(EMPTY_PATH);
- P_FLAG(STATX_FORCE_SYNC);
- P_FLAG(STATX_DONT_SYNC);
-
-#undef P_FLAG
-
- if (flags)
- printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags);
-
- return printed;
+ #include "trace/beauty/generated/statx_mask_array.c"
+ static DEFINE_STRARRAY(statx_mask, "STATX_");
+ return strarray__scnprintf_flags(&strarray__statx_mask, bf, size, show_prefix, mask);
}
size_t syscall_arg__scnprintf_statx_mask(char *bf, size_t size, struct syscall_arg *arg)
{
bool show_prefix = arg->show_string_prefix;
- const char *prefix = "STATX_";
- int printed = 0, flags = arg->val;
-
-#define P_FLAG(n) \
- if (flags & STATX_##n) { \
- printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", show_prefix ? prefix : "", #n); \
- flags &= ~STATX_##n; \
- }
-
- P_FLAG(TYPE);
- P_FLAG(MODE);
- P_FLAG(NLINK);
- P_FLAG(UID);
- P_FLAG(GID);
- P_FLAG(ATIME);
- P_FLAG(MTIME);
- P_FLAG(CTIME);
- P_FLAG(INO);
- P_FLAG(SIZE);
- P_FLAG(BLOCKS);
- P_FLAG(BTIME);
- P_FLAG(MNT_ID);
- P_FLAG(DIOALIGN);
- P_FLAG(MNT_ID_UNIQUE);
-
-#undef P_FLAG
-
- if (flags)
- printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags);
+ int mask = arg->val;
- return printed;
+ return statx__scnprintf_mask(mask, bf, size, show_prefix);
}