All of lore.kernel.org
 help / color / mirror / Atom feed
From: Akinobu Mita <mita@miraclelinux.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@osdl.org
Subject: [PATCH] use hlist_unhashed()
Date: Mon, 24 Apr 2006 16:36:49 +0800	[thread overview]
Message-ID: <20060424083649.GA6227@miraclelinux.com> (raw)

Use hlist_unhashed() rather than accessing inside data structure.

Signed-off-by: Akinobu Mita <mita@miraclelinux.com>
CC: "David S. Miller" <davem@davemloft.net>

 include/linux/list.h             |    2 +-
 include/net/inet_timewait_sock.h |    2 +-
 include/net/sock.h               |    2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

Index: 2.6-git/include/net/inet_timewait_sock.h
===================================================================
--- 2.6-git.orig/include/net/inet_timewait_sock.h
+++ 2.6-git/include/net/inet_timewait_sock.h
@@ -150,7 +150,7 @@ static inline void inet_twsk_add_bind_no
 
 static inline int inet_twsk_dead_hashed(const struct inet_timewait_sock *tw)
 {
-	return tw->tw_death_node.pprev != NULL;
+	return !hlist_unhashed(&tw->tw_death_node);
 }
 
 static inline void inet_twsk_dead_node_init(struct inet_timewait_sock *tw)
Index: 2.6-git/include/net/sock.h
===================================================================
--- 2.6-git.orig/include/net/sock.h
+++ 2.6-git/include/net/sock.h
@@ -279,7 +279,7 @@ static inline int sk_unhashed(const stru
 
 static inline int sk_hashed(const struct sock *sk)
 {
-	return sk->sk_node.pprev != NULL;
+	return !sk_unhashed(sk);
 }
 
 static __inline__ void sk_node_init(struct hlist_node *node)
Index: 2.6-git/include/linux/list.h
===================================================================
--- 2.6-git.orig/include/linux/list.h
+++ 2.6-git/include/linux/list.h
@@ -619,7 +619,7 @@ static inline void hlist_del_rcu(struct 
 
 static inline void hlist_del_init(struct hlist_node *n)
 {
-	if (n->pprev)  {
+	if (!hlist_unhashed(n)) {
 		__hlist_del(n);
 		INIT_HLIST_NODE(n);
 	}

                 reply	other threads:[~2006-04-24  8:36 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20060424083649.GA6227@miraclelinux.com \
    --to=mita@miraclelinux.com \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@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.