From: Andrew Morton <akpm@linux-foundation.org>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: peter.senna@gmail.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] hlist: drop the node parameter from iterators
Date: Thu, 7 Feb 2013 13:34:30 -0800 [thread overview]
Message-ID: <20130207133430.082512cc.akpm@linux-foundation.org> (raw)
In-Reply-To: <1359597622-31532-1-git-send-email-sasha.levin@oracle.com>
On Wed, 30 Jan 2013 21:00:22 -0500
Sasha Levin <sasha.levin@oracle.com> wrote:
> I'm not sure why, but the hlist for each entry iterators were conceived
> differently from the list ones. While the list ones are nice and elegant:
>
> list_for_each_entry(pos, head, member)
>
> The hlist ones were greedy and wanted an extra parameter:
>
> hlist_for_each_entry(tpos, pos, head, member)
>
> Why did they need an extra pos parameter? I'm not quite sure. Not only
> they don't really need it, it also prevents the iterator from looking
> exactly like the list iterator, which is unfortunate.
>
> ...
>
> --- a/net/ipv4/raw.c
> +++ b/net/ipv4/raw.c
> @@ -111,9 +111,7 @@ EXPORT_SYMBOL_GPL(raw_unhash_sk);
> static struct sock *__raw_v4_lookup(struct net *net, struct sock *sk,
> unsigned short num, __be32 raddr, __be32 laddr, int dif)
> {
> - struct hlist_node *node;
> -
> - sk_for_each_from(sk, node) {
> + sk_for_each_from(sk) {
> struct inet_sock *inet = inet_sk(sk);
>
> if (net_eq(sock_net(sk), net) && inet->inet_num == num &&
> @@ -122,6 +120,11 @@ static struct sock *__raw_v4_lookup(struct net *net, struct sock *sk,
> !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif))
> goto found; /* gotcha */
> }
> + sk_for_each_from (sk) {
> + struct inet_sock *inet=inet_sk(sk);
> + if (net_eq(sock_net(sk), net) && inet->inet_num == num && !(inet->inet_daddr && inet->inet_daddr != raddr) && !(inet->inet_rcv_saddr && inet->inet_rcv_saddr != laddr) && !(sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif))
> + goto found;
> + }
> sk = NULL;
> found:
> return sk;
The second hunk is bogus and I dropped it. This didn't increase my
confidence in the patch :(
next prev parent reply other threads:[~2013-02-07 21:34 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-31 2:00 [PATCH v2] hlist: drop the node parameter from iterators Sasha Levin
2013-02-07 0:55 ` Andrew Morton
2013-02-07 1:00 ` Tejun Heo
2013-02-07 1:45 ` Li Zefan
2013-02-07 1:01 ` Sasha Levin
2013-02-07 21:34 ` Andrew Morton [this message]
2013-03-04 10:41 ` Paul Bolle
2013-03-04 14:20 ` Sasha Levin
-- strict thread matches above, loose matches on Subject: below --
2013-01-13 16:31 Sasha Levin
2013-01-15 16:46 ` Paul E. McKenney
2013-01-16 20:48 ` Linus Torvalds
2013-01-16 21:58 ` Sasha Levin
2013-01-16 22:04 ` Linus Torvalds
2013-01-16 22:17 ` Sasha Levin
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=20130207133430.082512cc.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peter.senna@gmail.com \
--cc=sasha.levin@oracle.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