aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace.h3
-rw-r--r--kernel/trace/trace_events.c8
-rw-r--r--kernel/trace/trace_events_filter.c25
3 files changed, 15 insertions, 21 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 54fd9bcd0a65..90a848debcba 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -840,7 +840,8 @@ struct filter_pred {
840int trace_define_field(struct ftrace_event_call *call, char *type, 840int trace_define_field(struct ftrace_event_call *call, char *type,
841 char *name, int offset, int size); 841 char *name, int offset, int size);
842extern void filter_free_pred(struct filter_pred *pred); 842extern void filter_free_pred(struct filter_pred *pred);
843extern int filter_print_preds(struct filter_pred **preds, char *buf); 843extern void filter_print_preds(struct filter_pred **preds,
844 struct trace_seq *s);
844extern int filter_parse(char **pbuf, struct filter_pred *pred); 845extern int filter_parse(char **pbuf, struct filter_pred *pred);
845extern int filter_add_pred(struct ftrace_event_call *call, 846extern int filter_add_pred(struct ftrace_event_call *call,
846 struct filter_pred *pred); 847 struct filter_pred *pred);
diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c
index a9381384aa9e..d132997ab756 100644
--- a/kernel/trace/trace_events.c
+++ b/kernel/trace/trace_events.c
@@ -481,8 +481,8 @@ event_filter_read(struct file *filp, char __user *ubuf, size_t cnt,
481 481
482 trace_seq_init(s); 482 trace_seq_init(s);
483 483
484 r = filter_print_preds(call->preds, s->buffer); 484 filter_print_preds(call->preds, s);
485 r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, r); 485 r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, s->len);
486 486
487 kfree(s); 487 kfree(s);
488 488
@@ -547,8 +547,8 @@ subsystem_filter_read(struct file *filp, char __user *ubuf, size_t cnt,
547 547
548 trace_seq_init(s); 548 trace_seq_init(s);
549 549
550 r = filter_print_preds(system->preds, s->buffer); 550 filter_print_preds(system->preds, s);
551 r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, r); 551 r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, s->len);
552 552
553 kfree(s); 553 kfree(s);
554 554
diff --git a/kernel/trace/trace_events_filter.c b/kernel/trace/trace_events_filter.c
index 3f0b79f8a4bc..9fca8bb1c06b 100644
--- a/kernel/trace/trace_events_filter.c
+++ b/kernel/trace/trace_events_filter.c
@@ -24,6 +24,7 @@
24#include <linux/ctype.h> 24#include <linux/ctype.h>
25 25
26#include "trace.h" 26#include "trace.h"
27#include "trace_output.h"
27 28
28static int filter_pred_64(struct filter_pred *pred, void *event) 29static int filter_pred_64(struct filter_pred *pred, void *event)
29{ 30{
@@ -108,16 +109,15 @@ int filter_match_preds(struct ftrace_event_call *call, void *rec)
108 return 1; 109 return 1;
109} 110}
110 111
111int filter_print_preds(struct filter_pred **preds, char *buf) 112void filter_print_preds(struct filter_pred **preds, struct trace_seq *s)
112{ 113{
113 ssize_t this_len = 0;
114 char *field_name; 114 char *field_name;
115 struct filter_pred *pred; 115 struct filter_pred *pred;
116 int i; 116 int i;
117 117
118 if (!preds) { 118 if (!preds) {
119 this_len += sprintf(buf + this_len, "none\n"); 119 trace_seq_printf(s, "none\n");
120 return this_len; 120 return;
121 } 121 }
122 122
123 for (i = 0; i < MAX_FILTER_PRED; i++) { 123 for (i = 0; i < MAX_FILTER_PRED; i++) {
@@ -125,23 +125,16 @@ int filter_print_preds(struct filter_pred **preds, char *buf)
125 pred = preds[i]; 125 pred = preds[i];
126 field_name = pred->field_name; 126 field_name = pred->field_name;
127 if (i) 127 if (i)
128 this_len += sprintf(buf + this_len, 128 trace_seq_printf(s, pred->or ? "|| " : "&& ");
129 pred->or ? "|| " : "&& "); 129 trace_seq_printf(s, "%s ", field_name);
130 this_len += sprintf(buf + this_len, 130 trace_seq_printf(s, pred->not ? "!= " : "== ");
131 "%s ", field_name);
132 this_len += sprintf(buf + this_len,
133 pred->not ? "!= " : "== ");
134 if (pred->str_val) 131 if (pred->str_val)
135 this_len += sprintf(buf + this_len, 132 trace_seq_printf(s, "%s\n", pred->str_val);
136 "%s\n", pred->str_val);
137 else 133 else
138 this_len += sprintf(buf + this_len, 134 trace_seq_printf(s, "%llu\n", pred->val);
139 "%llu\n", pred->val);
140 } else 135 } else
141 break; 136 break;
142 } 137 }
143
144 return this_len;
145} 138}
146 139
147static struct ftrace_event_field * 140static struct ftrace_event_field *