mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 12:16:20 +00:00
tracing/filters: use trace_seq_printf() to print filters
Impact: cleanup Instead of just using the trace_seq buffer to print the filters, use trace_seq_printf() as it was intended to be used. Reported-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Tom Zanussi <tzanussi@gmail.com> Cc: =?ISO-8859-1?Q?Fr=E9d=E9ric?= Weisbecker <fweisbec@gmail.com> LKML-Reference: <1237878871.8339.59.camel@charm-linux> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
09f1f245c7
commit
4bda2d517b
3 changed files with 15 additions and 21 deletions
|
@ -840,7 +840,8 @@ struct filter_pred {
|
||||||
int trace_define_field(struct ftrace_event_call *call, char *type,
|
int trace_define_field(struct ftrace_event_call *call, char *type,
|
||||||
char *name, int offset, int size);
|
char *name, int offset, int size);
|
||||||
extern void filter_free_pred(struct filter_pred *pred);
|
extern void filter_free_pred(struct filter_pred *pred);
|
||||||
extern int filter_print_preds(struct filter_pred **preds, char *buf);
|
extern void filter_print_preds(struct filter_pred **preds,
|
||||||
|
struct trace_seq *s);
|
||||||
extern int filter_parse(char **pbuf, struct filter_pred *pred);
|
extern int filter_parse(char **pbuf, struct filter_pred *pred);
|
||||||
extern int filter_add_pred(struct ftrace_event_call *call,
|
extern int filter_add_pred(struct ftrace_event_call *call,
|
||||||
struct filter_pred *pred);
|
struct filter_pred *pred);
|
||||||
|
|
|
@ -481,8 +481,8 @@ event_filter_read(struct file *filp, char __user *ubuf, size_t cnt,
|
||||||
|
|
||||||
trace_seq_init(s);
|
trace_seq_init(s);
|
||||||
|
|
||||||
r = filter_print_preds(call->preds, s->buffer);
|
filter_print_preds(call->preds, s);
|
||||||
r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, r);
|
r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, s->len);
|
||||||
|
|
||||||
kfree(s);
|
kfree(s);
|
||||||
|
|
||||||
|
@ -547,8 +547,8 @@ subsystem_filter_read(struct file *filp, char __user *ubuf, size_t cnt,
|
||||||
|
|
||||||
trace_seq_init(s);
|
trace_seq_init(s);
|
||||||
|
|
||||||
r = filter_print_preds(system->preds, s->buffer);
|
filter_print_preds(system->preds, s);
|
||||||
r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, r);
|
r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, s->len);
|
||||||
|
|
||||||
kfree(s);
|
kfree(s);
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
#include <linux/ctype.h>
|
#include <linux/ctype.h>
|
||||||
|
|
||||||
#include "trace.h"
|
#include "trace.h"
|
||||||
|
#include "trace_output.h"
|
||||||
|
|
||||||
static int filter_pred_64(struct filter_pred *pred, void *event)
|
static int filter_pred_64(struct filter_pred *pred, void *event)
|
||||||
{
|
{
|
||||||
|
@ -108,16 +109,15 @@ int filter_match_preds(struct ftrace_event_call *call, void *rec)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int filter_print_preds(struct filter_pred **preds, char *buf)
|
void filter_print_preds(struct filter_pred **preds, struct trace_seq *s)
|
||||||
{
|
{
|
||||||
ssize_t this_len = 0;
|
|
||||||
char *field_name;
|
char *field_name;
|
||||||
struct filter_pred *pred;
|
struct filter_pred *pred;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!preds) {
|
if (!preds) {
|
||||||
this_len += sprintf(buf + this_len, "none\n");
|
trace_seq_printf(s, "none\n");
|
||||||
return this_len;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < MAX_FILTER_PRED; i++) {
|
for (i = 0; i < MAX_FILTER_PRED; i++) {
|
||||||
|
@ -125,23 +125,16 @@ int filter_print_preds(struct filter_pred **preds, char *buf)
|
||||||
pred = preds[i];
|
pred = preds[i];
|
||||||
field_name = pred->field_name;
|
field_name = pred->field_name;
|
||||||
if (i)
|
if (i)
|
||||||
this_len += sprintf(buf + this_len,
|
trace_seq_printf(s, pred->or ? "|| " : "&& ");
|
||||||
pred->or ? "|| " : "&& ");
|
trace_seq_printf(s, "%s ", field_name);
|
||||||
this_len += sprintf(buf + this_len,
|
trace_seq_printf(s, pred->not ? "!= " : "== ");
|
||||||
"%s ", field_name);
|
|
||||||
this_len += sprintf(buf + this_len,
|
|
||||||
pred->not ? "!= " : "== ");
|
|
||||||
if (pred->str_val)
|
if (pred->str_val)
|
||||||
this_len += sprintf(buf + this_len,
|
trace_seq_printf(s, "%s\n", pred->str_val);
|
||||||
"%s\n", pred->str_val);
|
|
||||||
else
|
else
|
||||||
this_len += sprintf(buf + this_len,
|
trace_seq_printf(s, "%llu\n", pred->val);
|
||||||
"%llu\n", pred->val);
|
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return this_len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct ftrace_event_field *
|
static struct ftrace_event_field *
|
||||||
|
|
Loading…
Reference in a new issue