Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 146005
b: refs/heads/master
c: 0a19e53
h: refs/heads/master
i:
  146003: f1abfca
v: v3
  • Loading branch information
Tom Zanussi authored and Ingo Molnar committed Apr 13, 2009
1 parent dc96b40 commit bd26d9b
Show file tree
Hide file tree
Showing 7 changed files with 151 additions and 129 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: b5c851a88a369854c04e511cefb84ea2d0cfa209
refs/heads/master: 0a19e53c1514ad8e9c3cbab40c6c3f52c86f403d
14 changes: 9 additions & 5 deletions trunk/kernel/trace/trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,7 @@ struct ftrace_event_call {
int (*show_format)(struct trace_seq *s);
int (*define_fields)(void);
struct list_head fields;
int n_preds;
struct filter_pred **preds;

#ifdef CONFIG_EVENT_PROFILE
Expand All @@ -826,6 +827,7 @@ struct event_subsystem {
struct list_head list;
const char *name;
struct dentry *entry;
int n_preds;
struct filter_pred **preds;
};

Expand All @@ -834,7 +836,8 @@ struct event_subsystem {
(unsigned long)event < (unsigned long)__stop_ftrace_events; \
event++)

#define MAX_FILTER_PRED 8
#define MAX_FILTER_PRED 8
#define MAX_FILTER_STR_VAL 128

struct filter_pred;

Expand All @@ -843,7 +846,7 @@ typedef int (*filter_pred_fn_t) (struct filter_pred *pred, void *event);
struct filter_pred {
filter_pred_fn_t fn;
u64 val;
char *str_val;
char str_val[MAX_FILTER_STR_VAL];
int str_len;
char *field_name;
int offset;
Expand All @@ -855,13 +858,14 @@ struct filter_pred {

int trace_define_field(struct ftrace_event_call *call, char *type,
char *name, int offset, int size);
extern int init_preds(struct ftrace_event_call *call);
extern void filter_free_pred(struct filter_pred *pred);
extern void filter_print_preds(struct filter_pred **preds,
extern void filter_print_preds(struct filter_pred **preds, int n_preds,
struct trace_seq *s);
extern int filter_parse(char **pbuf, struct filter_pred *pred);
extern int filter_add_pred(struct ftrace_event_call *call,
struct filter_pred *pred);
extern void filter_free_preds(struct ftrace_event_call *call);
extern void filter_disable_preds(struct ftrace_event_call *call);
extern int filter_match_preds(struct ftrace_event_call *call, void *rec);
extern void filter_free_subsystem_preds(struct event_subsystem *system);
extern int filter_add_subsystem_pred(struct event_subsystem *system,
Expand All @@ -875,7 +879,7 @@ filter_check_discard(struct ftrace_event_call *call, void *rec,
struct ring_buffer *buffer,
struct ring_buffer_event *event)
{
if (unlikely(call->preds) && !filter_match_preds(call, rec)) {
if (unlikely(call->n_preds) && !filter_match_preds(call, rec)) {
ring_buffer_discard_commit(buffer, event);
return 1;
}
Expand Down
9 changes: 6 additions & 3 deletions trunk/kernel/trace/trace_events.c
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ event_filter_read(struct file *filp, char __user *ubuf, size_t cnt,

trace_seq_init(s);

filter_print_preds(call->preds, s);
filter_print_preds(call->preds, call->n_preds, s);
r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, s->len);

kfree(s);
Expand Down Expand Up @@ -516,7 +516,7 @@ event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt,
}

if (pred->clear) {
filter_free_preds(call);
filter_disable_preds(call);
filter_free_pred(pred);
return cnt;
}
Expand All @@ -527,6 +527,8 @@ event_filter_write(struct file *filp, const char __user *ubuf, size_t cnt,
return err;
}

filter_free_pred(pred);

*ppos += cnt;

return cnt;
Expand All @@ -549,7 +551,7 @@ subsystem_filter_read(struct file *filp, char __user *ubuf, size_t cnt,

trace_seq_init(s);

filter_print_preds(system->preds, s);
filter_print_preds(system->preds, system->n_preds, s);
r = simple_read_from_buffer(ubuf, cnt, ppos, s->buffer, s->len);

kfree(s);
Expand Down Expand Up @@ -712,6 +714,7 @@ event_subsystem_dir(const char *name, struct dentry *d_events)
list_add(&system->list, &event_subsystems);

system->preds = NULL;
system->n_preds = 0;

entry = debugfs_create_file("filter", 0644, system->entry, system,
&ftrace_subsystem_filter_fops);
Expand Down
Loading

0 comments on commit bd26d9b

Please sign in to comment.