Merge tag 'ntb-5.11' of git://github.com/jonmason/ntb
[linux/fpc-iii.git] / tools / perf / trace / beauty / sync_file_range.c
blob1c425f04047dbb24b7cbc52b767ef138a356126e
1 // SPDX-License-Identifier: LGPL-2.1
2 /*
3 * trace/beauty/sync_file_range.c
5 * Copyright (C) 2019, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
6 */
8 #include "trace/beauty/beauty.h"
9 #include <linux/log2.h>
10 #include <uapi/linux/fs.h>
12 static size_t sync_file_range__scnprintf_flags(unsigned long flags, char *bf, size_t size, bool show_prefix)
14 #include "trace/beauty/generated/sync_file_range_arrays.c"
15 static DEFINE_STRARRAY(sync_file_range_flags, "SYNC_FILE_RANGE_");
16 size_t printed = 0;
18 if ((flags & SYNC_FILE_RANGE_WRITE_AND_WAIT) == SYNC_FILE_RANGE_WRITE_AND_WAIT) {
19 printed += scnprintf(bf + printed, size - printed, "%s%s", show_prefix ? "SYNC_FILE_RANGE_" : "", "WRITE_AND_WAIT");
20 flags &= ~SYNC_FILE_RANGE_WRITE_AND_WAIT;
23 return printed + strarray__scnprintf_flags(&strarray__sync_file_range_flags, bf + printed, size - printed, show_prefix, flags);
26 size_t syscall_arg__scnprintf_sync_file_range_flags(char *bf, size_t size, struct syscall_arg *arg)
28 unsigned long flags = arg->val;
30 return sync_file_range__scnprintf_flags(flags, bf, size, arg->show_string_prefix);