xref: /linux/tools/perf/trace/beauty/flock.c (revision 0883c2c06fb5bcf5b9e008270827e63c09a88c1e)
1 
2 static size_t syscall_arg__scnprintf_flock(char *bf, size_t size,
3 					   struct syscall_arg *arg)
4 {
5 	int printed = 0, op = arg->val;
6 
7 	if (op == 0)
8 		return scnprintf(bf, size, "NONE");
9 #define	P_CMD(cmd) \
10 	if ((op & LOCK_##cmd) == LOCK_##cmd) { \
11 		printed += scnprintf(bf + printed, size - printed, "%s%s", printed ? "|" : "", #cmd); \
12 		op &= ~LOCK_##cmd; \
13 	}
14 
15 	P_CMD(SH);
16 	P_CMD(EX);
17 	P_CMD(NB);
18 	P_CMD(UN);
19 	P_CMD(MAND);
20 	P_CMD(RW);
21 	P_CMD(READ);
22 	P_CMD(WRITE);
23 #undef P_OP
24 
25 	if (op)
26 		printed += scnprintf(bf + printed, size - printed, "%s%#x", printed ? "|" : "", op);
27 
28 	return printed;
29 }
30 
31 #define SCA_FLOCK syscall_arg__scnprintf_flock
32