All of lore.kernel.org
 help / color / mirror / Atom feed
From: Amos Jeffries <squid3@treenet.co.nz>
To: netfilter-devel <netfilter-devel@vger.kernel.org>
Subject: Re: [PATCH 1/6] netfilter: xtables: replace XT_ENTRY_ITERATE macro
Date: Sat, 13 Feb 2010 23:42:54 +1300	[thread overview]
Message-ID: <4B76822E.5090306@treenet.co.nz> (raw)
In-Reply-To: <alpine.LSU.2.01.1002131137310.1587@obet.zrqbmnf.qr>

Jan Engelhardt wrote:
> On Saturday 2010-02-13 11:29, Amos Jeffries wrote:
>> Jan Engelhardt wrote:
>>> The macro is replaced by a list.h-like foreach loop. This makes
>>> the code much more inspectable.
>>>
>> <snip>
>>> 	if (IS_ERR(counters))
>>> @@ -1967,9 +2009,12 @@ compat_copy_entries_to_user(unsigned int total_size,
>>> struct xt_table *table,
>>> 	loc_cpu_entry = private->entries[raw_smp_processor_id()];
>>> 	pos = userptr;
>>> 	size = total_size;
>>> -	ret = IP6T_ENTRY_ITERATE(loc_cpu_entry, total_size,
>>> -				 compat_copy_entry_to_user,
>>> -				 &pos, &size, counters, &i);
>>> +	xt_entry_foreach(iter, loc_cpu_entry, total_size) {
>>> +		ret = compat_copy_entry_to_user(iter, &pos,
>>> +		      &size, counters, &i);
>>> +		if (ret != 0)
>>> +			break;
>>> +	}
>>>
>> <snip>
>>
>>> 	loc_cpu_entry = private->entries[raw_smp_processor_id()];
>>> -	IP6T_ENTRY_ITERATE(loc_cpu_entry, private->size, cleanup_entry, net,
>>> NULL);
>>> +	xt_entry_foreach(iter, loc_cpu_entry, private->size)
>>> +		if (cleanup_entry(iter, net, NULL) != 0)
>>> +			break;
>>> 	if (private->number > private->initial_entries)
>>> 		module_put(table_owner);
>>> 	xt_free_table_info(private);
>> Just my 2c, but you seem to be floating between several coding styles on this
>> one.
> 
> What, where? It goes by two simple rules:
> - no assignments in if()
> - only use {} where needed


Oh I see. ret being used later. nevermind.

AYJ

  reply	other threads:[~2010-02-13 10:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-12 10:20 ip_tables: foreachs and reentrancy Jan Engelhardt
2010-02-12 10:20 ` [PATCH 1/6] netfilter: xtables: replace XT_ENTRY_ITERATE macro Jan Engelhardt
2010-02-13 10:29   ` Amos Jeffries
2010-02-13 10:39     ` Jan Engelhardt
2010-02-13 10:42       ` Amos Jeffries [this message]
2010-02-12 10:20 ` [PATCH 2/6] netfilter: xtables: optimize call flow around xt_entry_foreach Jan Engelhardt
2010-02-12 10:20 ` [PATCH 3/6] netfilter: xtables: replace XT_MATCH_ITERATE macro Jan Engelhardt
2010-02-12 10:20 ` [PATCH 4/6] netfilter: xtables: optimize call flow around xt_ematch_foreach Jan Engelhardt
2010-02-12 10:20 ` [PATCH 5/6] netfilter: xtables: reduce arguments to translate_table Jan Engelhardt
2010-02-12 10:20 ` [PATCH 6/6] netfilter: xtables2: make ip_tables reentrant Jan Engelhardt
2010-02-24 17:40 ` ip_tables: foreachs and reentrancy Patrick McHardy
2010-02-24 19:33   ` Jan Engelhardt
2010-02-25 10:24     ` Patrick McHardy
2010-02-25 11:07       ` Jan Engelhardt
2010-02-25 11:09         ` Patrick McHardy
2010-02-26 16:54     ` Patrick McHardy

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=4B76822E.5090306@treenet.co.nz \
    --to=squid3@treenet.co.nz \
    --cc=netfilter-devel@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.