public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Li Zefan <lizf@cn.fujitsu.com>
To: Frederic Weisbecker <fweisbec@gmail.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: Mon, 20 Jul 2009 08:59:18 +0800	[thread overview]
Message-ID: <4A63C166.8010201@cn.fujitsu.com> (raw)
In-Reply-To: <20090717203422.GA7136@nowhere>

>> -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.

> Otherwise, the rest looks good.
> 

Thanks!

  reply	other threads:[~2009-07-20  1:00 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 [this message]
2009-07-20  1:24     ` Frederic Weisbecker
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=4A63C166.8010201@cn.fujitsu.com \
    --to=lizf@cn.fujitsu.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --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