tracing/filters: Provide basic regex support
authorFrederic Weisbecker <fweisbec@gmail.com>
Thu, 24 Sep 2009 19:10:44 +0000 (21:10 +0200)
committerFrederic Weisbecker <fweisbec@gmail.com>
Thu, 24 Sep 2009 19:39:27 +0000 (21:39 +0200)
commit1889d20922d14a97b2099fa4d47587217c0ba48b
tree5980f8473f3482aff577ad262e00d06d0745dcf1
parentf3f3f0092477d0165f3f1bf0fd518550b2abd097
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>
kernel/trace/trace.h
kernel/trace/trace_events_filter.c