From: Frederic Weisbecker <fweisbec@gmail.com>
To: Li Zefan <lizf@cn.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
Tom Zanussi <tzanussi@gmail.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] tracing/filters: Improve subsystem filter
Date: Sun, 19 Jul 2009 21:24:38 -0400 [thread overview]
Message-ID: <20090720012430.GA5172@nowhere> (raw)
In-Reply-To: <4A63C166.8010201@cn.fujitsu.com>
On Mon, Jul 20, 2009 at 08:59:18AM +0800, Li Zefan wrote:
> >> -static void filter_free_subsystem_preds(struct event_subsystem *system)
> >> +/*
> >> + * flag == 0: remove all events' filter
> >> + * flag == 1: clear filter->no_reset
> >> + * flag == 2: remove all preds with no_reset == false
> >> + */
> >
> > Once an option overlap the boolean binary range, it's better
> > to start thinking about an enum type, for better self-explaining code.
> >
>
> Ok.
>
> I was lazy to think of proper names for those enums..
>
> >> +static void filter_free_subsystem_preds(struct event_subsystem *system,
> >> + int flag)
> >> {
> >> struct ftrace_event_call *call;
> >>
> >> @@ -428,6 +434,14 @@ static void filter_free_subsystem_preds(struct event_subsystem *system)
> >> if (!call->define_fields)
> >> continue;
> >>
> >> + if (flag == 1) {
> >> + call->filter->no_reset = false;
> >> + continue;
> >> + }
> >> +
> >> + if (flag == 2 && call->filter->no_reset == true)
> >
> > Or simply if (flag == 2 && call->filter->no_reset)
> >
>
> Sure.
>
> >> + continue;
> >> +
> >> if (!strcmp(call->system, system->name)) {
> >> filter_disable_preds(call);
> >> remove_filter_string(call->filter);
> >> @@ -529,7 +543,8 @@ static filter_pred_fn_t select_comparison_fn(int op, int field_size,
> >>
> >> static int filter_add_pred(struct filter_parse_state *ps,
> >> struct ftrace_event_call *call,
> >> - struct filter_pred *pred)
> >> + struct filter_pred *pred,
> >> + bool apply)
> >
> >
> > bool dry_run sounds perhaps more intuitive for what is happening there.
>
> I guess you "try_run". ;)
>
> > Because "apply" is surprising in a "add_thing" function, it's like
> > a field to confirm that we know what what we are doing :)
> >
> > (May be I start to become a PITA with my naming worries, especially
> > since I'm usually not good at it in my patches :)
> >
>
> I'll take "try_run". Naming is often hard for me.
No I really meant "dry run"
"Try run" is already a function that would implicitly fit into
every function :)
Ie, dry run means:
"Behave as if you were truly doing it, just to see if it works.
But don't really do it"
>
> > Otherwise, the rest looks good.
> >
>
> Thanks!
next prev parent reply other threads:[~2009-07-20 1:24 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-16 9:03 [PATCH] tracing/filters: Improve subsystem filter Li Zefan
2009-07-17 20:34 ` Frederic Weisbecker
2009-07-20 0:59 ` Li Zefan
2009-07-20 1:24 ` Frederic Weisbecker [this message]
2009-07-20 1:31 ` Li Zefan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090720012430.GA5172@nowhere \
--to=fweisbec@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mingo@elte.hu \
--cc=rostedt@goodmis.org \
--cc=tzanussi@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox