Re: [GIT PULL v2] bkl tracepoints + filter regex support

Frederic Weisbecker
2009-09-24T20:44:08Z

On Thu, Sep 24, 2009 at 10:30:00PM +0200, Peter Zijlstra wrote:
> On Thu, 2009-09-24 at 22:16 +0200, Ingo Molnar wrote:
>
> > There's one thing Peter noticed: this is not C syntax anymore. It would
> > be really nice to keep filter expressions a subset of C.
>
> Also:
>
> > 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
>
> It says regex, but its not.
>
> Regex would look like: "^.*reiserfs.*$", or simply "reiserfs"
>
> What you implemented is called glob-matching.

Ouch, right...

> If you want to keep this C syntax, you could consider something like:
>
> glob_match(file, "*reiserfs*")
>
> or something.
>

I don't quite understand why.

Typing file == "*reiserfs*" looks more intuitive.

It's true that the filters should stay tight to the C syntax,
but following this guideline up to the point that we are forced to
use function expressions to do something that can be expressed
much more easily and more intuitively (IMHO), that all sounds like
an overkill.

The use of glob is a very primary need for filters, it's
so much a basic requirement for it that it should be native
in its language.