diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2007-11-23 07:30:01 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-01-28 17:54:49 -0500 |
commit | a53eb3feb2718bf906e81be89fae823b9b6157b6 (patch) | |
tree | 4f854d526d80c8386d0212f1a12924c8d9b7fbf0 /net/unix | |
parent | c28149016c24f4399c0a1eb0ebc15c92611223f0 (diff) |
[UNIX] Move the unix sock iterators in to proper place
The first_unix_socket() and next_unix_sockets() are now used
in proc file and in forall_unix_socets macro only.
The forall_unix_sockets is not used in this file at all so
remove it. After this move the helpers to where they really
belong, i.e. closer to proc code under the #ifdef CONFIG_PROC_FS
option.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/unix')
-rw-r--r-- | net/unix/af_unix.c | 49 |
1 files changed, 23 insertions, 26 deletions
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index eacddb21a9b4..0f1ecbf86d0f 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -127,32 +127,6 @@ static atomic_t unix_nr_socks = ATOMIC_INIT(0); | |||
127 | 127 | ||
128 | #define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE) | 128 | #define UNIX_ABSTRACT(sk) (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE) |
129 | 129 | ||
130 | static struct sock *first_unix_socket(int *i) | ||
131 | { | ||
132 | for (*i = 0; *i <= UNIX_HASH_SIZE; (*i)++) { | ||
133 | if (!hlist_empty(&unix_socket_table[*i])) | ||
134 | return __sk_head(&unix_socket_table[*i]); | ||
135 | } | ||
136 | return NULL; | ||
137 | } | ||
138 | |||
139 | static struct sock *next_unix_socket(int *i, struct sock *s) | ||
140 | { | ||
141 | struct sock *next = sk_next(s); | ||
142 | /* More in this chain? */ | ||
143 | if (next) | ||
144 | return next; | ||
145 | /* Look for next non-empty chain. */ | ||
146 | for ((*i)++; *i <= UNIX_HASH_SIZE; (*i)++) { | ||
147 | if (!hlist_empty(&unix_socket_table[*i])) | ||
148 | return __sk_head(&unix_socket_table[*i]); | ||
149 | } | ||
150 | return NULL; | ||
151 | } | ||
152 | |||
153 | #define forall_unix_sockets(i, s) \ | ||
154 | for (s = first_unix_socket(&(i)); s; s = next_unix_socket(&(i),(s))) | ||
155 | |||
156 | #ifdef CONFIG_SECURITY_NETWORK | 130 | #ifdef CONFIG_SECURITY_NETWORK |
157 | static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb) | 131 | static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb) |
158 | { | 132 | { |
@@ -2017,6 +1991,29 @@ static unsigned int unix_poll(struct file * file, struct socket *sock, poll_tabl | |||
2017 | 1991 | ||
2018 | 1992 | ||
2019 | #ifdef CONFIG_PROC_FS | 1993 | #ifdef CONFIG_PROC_FS |
1994 | static struct sock *first_unix_socket(int *i) | ||
1995 | { | ||
1996 | for (*i = 0; *i <= UNIX_HASH_SIZE; (*i)++) { | ||
1997 | if (!hlist_empty(&unix_socket_table[*i])) | ||
1998 | return __sk_head(&unix_socket_table[*i]); | ||
1999 | } | ||
2000 | return NULL; | ||
2001 | } | ||
2002 | |||
2003 | static struct sock *next_unix_socket(int *i, struct sock *s) | ||
2004 | { | ||
2005 | struct sock *next = sk_next(s); | ||
2006 | /* More in this chain? */ | ||
2007 | if (next) | ||
2008 | return next; | ||
2009 | /* Look for next non-empty chain. */ | ||
2010 | for ((*i)++; *i <= UNIX_HASH_SIZE; (*i)++) { | ||
2011 | if (!hlist_empty(&unix_socket_table[*i])) | ||
2012 | return __sk_head(&unix_socket_table[*i]); | ||
2013 | } | ||
2014 | return NULL; | ||
2015 | } | ||
2016 | |||
2020 | struct unix_iter_state { | 2017 | struct unix_iter_state { |
2021 | struct seq_net_private p; | 2018 | struct seq_net_private p; |
2022 | int i; | 2019 | int i; |