netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH][UNIX] Move the unix sock iterators in to proper place
@ 2007-11-22 13:22 Pavel Emelyanov
  2007-11-23 12:30 ` Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Emelyanov @ 2007-11-22 13:22 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Linux Netdev List, devel

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>

---

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 6be6d87..b62a271 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);
 
 #define UNIX_ABSTRACT(sk)	(unix_sk(sk)->addr->hash != UNIX_HASH_SIZE)
 
-static struct sock *first_unix_socket(int *i)
-{
-	for (*i = 0; *i <= UNIX_HASH_SIZE; (*i)++) {
-		if (!hlist_empty(&unix_socket_table[*i]))
-			return __sk_head(&unix_socket_table[*i]);
-	}
-	return NULL;
-}
-
-static struct sock *next_unix_socket(int *i, struct sock *s)
-{
-	struct sock *next = sk_next(s);
-	/* More in this chain? */
-	if (next)
-		return next;
-	/* Look for next non-empty chain. */
-	for ((*i)++; *i <= UNIX_HASH_SIZE; (*i)++) {
-		if (!hlist_empty(&unix_socket_table[*i]))
-			return __sk_head(&unix_socket_table[*i]);
-	}
-	return NULL;
-}
-
-#define forall_unix_sockets(i, s) \
-	for (s = first_unix_socket(&(i)); s; s = next_unix_socket(&(i),(s)))
-
 #ifdef CONFIG_SECURITY_NETWORK
 static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb)
 {
@@ -2010,6 +1984,29 @@ static unsigned int unix_poll(struct file * file, struct socket *sock, poll_tabl
 
 
 #ifdef CONFIG_PROC_FS
+static struct sock *first_unix_socket(int *i)
+{
+	for (*i = 0; *i <= UNIX_HASH_SIZE; (*i)++) {
+		if (!hlist_empty(&unix_socket_table[*i]))
+			return __sk_head(&unix_socket_table[*i]);
+	}
+	return NULL;
+}
+
+static struct sock *next_unix_socket(int *i, struct sock *s)
+{
+	struct sock *next = sk_next(s);
+	/* More in this chain? */
+	if (next)
+		return next;
+	/* Look for next non-empty chain. */
+	for ((*i)++; *i <= UNIX_HASH_SIZE; (*i)++) {
+		if (!hlist_empty(&unix_socket_table[*i]))
+			return __sk_head(&unix_socket_table[*i]);
+	}
+	return NULL;
+}
+
 struct unix_iter_state {
 	struct seq_net_private p;
 	int i;

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH][UNIX] Move the unix sock iterators in to proper place
  2007-11-22 13:22 [PATCH][UNIX] Move the unix sock iterators in to proper place Pavel Emelyanov
@ 2007-11-23 12:30 ` Herbert Xu
  2007-11-23 13:10   ` Pavel Emelyanov
  0 siblings, 1 reply; 4+ messages in thread
From: Herbert Xu @ 2007-11-23 12:30 UTC (permalink / raw)
  To: Pavel Emelyanov; +Cc: Linux Netdev List, devel

On Thu, Nov 22, 2007 at 04:22:30PM +0300, Pavel Emelyanov wrote:
> 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>

Patch applied.  Thanks Pavel!
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][UNIX] Move the unix sock iterators in to proper place
  2007-11-23 12:30 ` Herbert Xu
@ 2007-11-23 13:10   ` Pavel Emelyanov
  2007-11-23 13:37     ` Herbert Xu
  0 siblings, 1 reply; 4+ messages in thread
From: Pavel Emelyanov @ 2007-11-23 13:10 UTC (permalink / raw)
  To: Herbert Xu; +Cc: Linux Netdev List, devel

Herbert Xu wrote:
> On Thu, Nov 22, 2007 at 04:22:30PM +0300, Pavel Emelyanov wrote:
>> 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>
> 
> Patch applied.  Thanks Pavel!

I'm afraid to become importunate, but is the net-2.6 (not 25)
tree is currently the David's tree (unlike net-2.6.25, which
has temporary switched to your one)?

Thanks,
Pavel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH][UNIX] Move the unix sock iterators in to proper place
  2007-11-23 13:10   ` Pavel Emelyanov
@ 2007-11-23 13:37     ` Herbert Xu
  0 siblings, 0 replies; 4+ messages in thread
From: Herbert Xu @ 2007-11-23 13:37 UTC (permalink / raw)
  To: Pavel Emelyanov; +Cc: Linux Netdev List, devel

On Fri, Nov 23, 2007 at 04:10:08PM +0300, Pavel Emelyanov wrote:
>
> I'm afraid to become importunate, but is the net-2.6 (not 25)
> tree is currently the David's tree (unlike net-2.6.25, which
> has temporary switched to your one)?

I'm about to do a push soon which will create net-2.6 in the
same place as my net-2.6.25 tree.

Cheers,
-- 
Visit Openswan at http://www.openswan.org/
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-11-23 13:37 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-11-22 13:22 [PATCH][UNIX] Move the unix sock iterators in to proper place Pavel Emelyanov
2007-11-23 12:30 ` Herbert Xu
2007-11-23 13:10   ` Pavel Emelyanov
2007-11-23 13:37     ` Herbert Xu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).