|
13 | 13 | #include <linux/rculist.h>
|
14 | 14 | #include <linux/tracefs.h>
|
15 | 15 |
|
| 16 | +/* for gfp flag names */ |
| 17 | +#include <linux/trace_events.h> |
| 18 | +#include <trace/events/mmflags.h> |
| 19 | + |
16 | 20 | #include "tracing_map.h"
|
17 | 21 | #include "trace.h"
|
18 | 22 | #include "trace_dynevent.h"
|
@@ -752,6 +756,8 @@ static int synth_field_size(char *type)
|
752 | 756 | size = sizeof(unsigned long);
|
753 | 757 | else if (strcmp(type, "pid_t") == 0)
|
754 | 758 | size = sizeof(pid_t);
|
| 759 | + else if (strcmp(type, "gfp_t") == 0) |
| 760 | + size = sizeof(gfp_t); |
755 | 761 | else if (synth_field_is_string(type))
|
756 | 762 | size = synth_field_string_size(type);
|
757 | 763 |
|
@@ -792,6 +798,8 @@ static const char *synth_field_fmt(char *type)
|
792 | 798 | fmt = "%lu";
|
793 | 799 | else if (strcmp(type, "pid_t") == 0)
|
794 | 800 | fmt = "%d";
|
| 801 | + else if (strcmp(type, "gfp_t") == 0) |
| 802 | + fmt = "%x"; |
795 | 803 | else if (synth_field_is_string(type))
|
796 | 804 | fmt = "%s";
|
797 | 805 |
|
@@ -834,9 +842,20 @@ static enum print_line_t print_synth_event(struct trace_iterator *iter,
|
834 | 842 | i == se->n_fields - 1 ? "" : " ");
|
835 | 843 | n_u64 += STR_VAR_LEN_MAX / sizeof(u64);
|
836 | 844 | } else {
|
| 845 | + struct trace_print_flags __flags[] = { |
| 846 | + __def_gfpflag_names, {-1, NULL} }; |
| 847 | + |
837 | 848 | trace_seq_printf(s, print_fmt, se->fields[i]->name,
|
838 | 849 | entry->fields[n_u64],
|
839 | 850 | i == se->n_fields - 1 ? "" : " ");
|
| 851 | + |
| 852 | + if (strcmp(se->fields[i]->type, "gfp_t") == 0) { |
| 853 | + trace_seq_puts(s, " ("); |
| 854 | + trace_print_flags_seq(s, "|", |
| 855 | + entry->fields[n_u64], |
| 856 | + __flags); |
| 857 | + trace_seq_putc(s, ')'); |
| 858 | + } |
840 | 859 | n_u64++;
|
841 | 860 | }
|
842 | 861 | }
|
|
0 commit comments