aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/inet_hashtables.c
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <acme@ghostprotocols.net>2005-08-09 23:10:42 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2005-08-29 18:43:19 -0400
commit463c84b97f24010a67cd871746d6a7e4c925a5f9 (patch)
tree48df67ede4ebb5d12b3c0ae55d72531574bd51a6 /net/ipv4/inet_hashtables.c
parent87d11ceb9deb7a3f13fdee6e89d9bb6be7d27a71 (diff)
[NET]: Introduce inet_connection_sock
This creates struct inet_connection_sock, moving members out of struct tcp_sock that are shareable with other INET connection oriented protocols, such as DCCP, that in my private tree already uses most of these members. The functions that operate on these members were renamed, using a inet_csk_ prefix while not being moved yet to a new file, so as to ease the review of these changes. Signed-off-by: Arnaldo Carvalho de Melo <acme@ghostprotocols.net> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4/inet_hashtables.c')
-rw-r--r--net/ipv4/inet_hashtables.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index d94e962958a4..e8d29fe736d2 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -19,6 +19,7 @@
19#include <linux/slab.h> 19#include <linux/slab.h>
20#include <linux/wait.h> 20#include <linux/wait.h>
21 21
22#include <net/inet_connection_sock.h>
22#include <net/inet_hashtables.h> 23#include <net/inet_hashtables.h>
23 24
24/* 25/*
@@ -56,10 +57,9 @@ void inet_bind_bucket_destroy(kmem_cache_t *cachep, struct inet_bind_bucket *tb)
56void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb, 57void inet_bind_hash(struct sock *sk, struct inet_bind_bucket *tb,
57 const unsigned short snum) 58 const unsigned short snum)
58{ 59{
59 struct inet_sock *inet = inet_sk(sk); 60 inet_sk(sk)->num = snum;
60 inet->num = snum;
61 sk_add_bind_node(sk, &tb->owners); 61 sk_add_bind_node(sk, &tb->owners);
62 inet->bind_hash = tb; 62 inet_csk(sk)->icsk_bind_hash = tb;
63} 63}
64 64
65EXPORT_SYMBOL(inet_bind_hash); 65EXPORT_SYMBOL(inet_bind_hash);
@@ -69,16 +69,15 @@ EXPORT_SYMBOL(inet_bind_hash);
69 */ 69 */
70static void __inet_put_port(struct inet_hashinfo *hashinfo, struct sock *sk) 70static void __inet_put_port(struct inet_hashinfo *hashinfo, struct sock *sk)
71{ 71{
72 struct inet_sock *inet = inet_sk(sk); 72 const int bhash = inet_bhashfn(inet_sk(sk)->num, hashinfo->bhash_size);
73 const int bhash = inet_bhashfn(inet->num, hashinfo->bhash_size);
74 struct inet_bind_hashbucket *head = &hashinfo->bhash[bhash]; 73 struct inet_bind_hashbucket *head = &hashinfo->bhash[bhash];
75 struct inet_bind_bucket *tb; 74 struct inet_bind_bucket *tb;
76 75
77 spin_lock(&head->lock); 76 spin_lock(&head->lock);
78 tb = inet->bind_hash; 77 tb = inet_csk(sk)->icsk_bind_hash;
79 __sk_del_bind_node(sk); 78 __sk_del_bind_node(sk);
80 inet->bind_hash = NULL; 79 inet_csk(sk)->icsk_bind_hash = NULL;
81 inet->num = 0; 80 inet_sk(sk)->num = 0;
82 inet_bind_bucket_destroy(hashinfo->bind_bucket_cachep, tb); 81 inet_bind_bucket_destroy(hashinfo->bind_bucket_cachep, tb);
83 spin_unlock(&head->lock); 82 spin_unlock(&head->lock);
84} 83}