qed: Fix static checker warning
[linux/fpc-iii.git] / tools / perf / trace / beauty / statx.c
blob5643b692af4cf60c6a791a148e1c35b30567d002
1 /*
2 * trace/beauty/statx.c
4 * Copyright (C) 2017, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
6 * Released under the GPL v2. (and only v2, not any later version)
7 */
9 #include "trace/beauty/beauty.h"
10 #include <linux/kernel.h>
11 #include <sys/types.h>
12 #include <uapi/linux/fcntl.h>
13 #include <uapi/linux/stat.h>
15 size_t syscall_arg__scnprintf_statx_flags(char *bf, size_t size, struct syscall_arg *arg)
17 int printed = 0, flags = arg->val;
19 if (flags == 0)
20 return scnprintf(bf, size, "SYNC_AS_STAT");
21 #define P_FLAG(n) \
22 if (flags & AT_##n) { \
23 printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \
24 flags &= ~AT_##n; \
27 P_FLAG(SYMLINK_NOFOLLOW);
28 P_FLAG(REMOVEDIR);
29 P_FLAG(SYMLINK_FOLLOW);
30 P_FLAG(NO_AUTOMOUNT);
31 P_FLAG(EMPTY_PATH);
32 P_FLAG(STATX_FORCE_SYNC);
33 P_FLAG(STATX_DONT_SYNC);
35 #undef P_FLAG
37 if (flags)
38 printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags);
40 return printed;
43 size_t syscall_arg__scnprintf_statx_mask(char *bf, size_t size, struct syscall_arg *arg)
45 int printed = 0, flags = arg->val;
47 #define P_FLAG(n) \
48 if (flags & STATX_##n) { \
49 printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #n); \
50 flags &= ~STATX_##n; \
53 P_FLAG(TYPE);
54 P_FLAG(MODE);
55 P_FLAG(NLINK);
56 P_FLAG(UID);
57 P_FLAG(GID);
58 P_FLAG(ATIME);
59 P_FLAG(MTIME);
60 P_FLAG(CTIME);
61 P_FLAG(INO);
62 P_FLAG(SIZE);
63 P_FLAG(BLOCKS);
64 P_FLAG(BTIME);
66 #undef P_FLAG
68 if (flags)
69 printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", flags);
71 return printed;