aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/trace/trace.h
diff options
context:
space:
mode:
authorFrederic Weisbecker <fweisbec@gmail.com>2009-09-24 15:10:44 -0400
committerFrederic Weisbecker <fweisbec@gmail.com>2009-09-24 15:39:27 -0400
commit1889d20922d14a97b2099fa4d47587217c0ba48b (patch)
tree5980f8473f3482aff577ad262e00d06d0745dcf1 /kernel/trace/trace.h
parentf3f3f0092477d0165f3f1bf0fd518550b2abd097 (diff)
tracing/filters: Provide basic regex support
This patch provides basic support for regular expressions in filters. It supports the following types of regexp: - *match_beginning - *match_middle* - match_end* - !don't match Example: cd /debug/tracing/events/bkl/lock_kernel echo 'file == "*reiserfs*"' > filter echo 1 > enable gedit-4941 [000] 457.735437: lock_kernel: depth: 0, fs/reiserfs/namei.c:334 reiserfs_lookup() sync_supers-227 [001] 461.379985: lock_kernel: depth: 0, fs/reiserfs/super.c:69 reiserfs_sync_fs() sync_supers-227 [000] 461.383096: lock_kernel: depth: 0, fs/reiserfs/journal.c:1069 flush_commit_list() reiserfs/1-1369 [001] 461.479885: lock_kernel: depth: 0, fs/reiserfs/journal.c:3509 flush_async_commits() Every string is now handled as a regexp in the filter framework, which helps to factorize the code for handling both simple strings and regexp comparisons. (The regexp parsing code has been wildly cherry picked from ftrace.c written by Steve.) v2: Simplify the whole and drop the filter_regex file Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Tom Zanussi <tzanussi@gmail.com> Cc: Li Zefan <lizf@cn.fujitsu.com>
Diffstat (limited to 'kernel/trace/trace.h')
-rw-r--r--kernel/trace/trace.h27
1 files changed, 18 insertions, 9 deletions
diff --git a/kernel/trace/trace.h b/kernel/trace/trace.h
index 86bcff94791a..8d0db6018fe4 100644
--- a/kernel/trace/trace.h
+++ b/kernel/trace/trace.h
@@ -702,20 +702,29 @@ struct event_subsystem {
702}; 702};
703 703
704struct filter_pred; 704struct filter_pred;
705struct regex;
705 706
706typedef int (*filter_pred_fn_t) (struct filter_pred *pred, void *event, 707typedef int (*filter_pred_fn_t) (struct filter_pred *pred, void *event,
707 int val1, int val2); 708 int val1, int val2);
708 709
710typedef int (*regex_match_func)(char *str, struct regex *r, int len);
711
712struct regex {
713 char pattern[MAX_FILTER_STR_VAL];
714 int len;
715 int field_len;
716 regex_match_func match;
717};
718
709struct filter_pred { 719struct filter_pred {
710 filter_pred_fn_t fn; 720 filter_pred_fn_t fn;
711 u64 val; 721 u64 val;
712 char str_val[MAX_FILTER_STR_VAL]; 722 struct regex regex;
713 int str_len; 723 char *field_name;
714 char *field_name; 724 int offset;
715 int offset; 725 int not;
716 int not; 726 int op;
717 int op; 727 int pop_n;
718 int pop_n;
719}; 728};
720 729
721extern void print_event_filter(struct ftrace_event_call *call, 730extern void print_event_filter(struct ftrace_event_call *call,