aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2006-09-27 21:43:33 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2006-09-28 21:02:26 -0400
commitfb99c848e5ae6b8b2bc11f0f90c9e2bb3d702c0d (patch)
tree843afd532897b2034769c7260436c49455f0d34d
parent4f765d842fa6e6fe15d555b247b640118d65b4dd (diff)
[IPV4]: annotate inet_lookup() and friends
inet_lookup() annotated along with helper functions (__inet_lookup(), __inet_lookup_established(), inet_lookup_established(), inet_lookup_listener(), __inet_lookup_listener() and inet_ehashfn()) Signed-off-by: Al Viro <viro@zeniv.linux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--include/net/inet_hashtables.h20
-rw-r--r--include/net/inet_sock.h12
-rw-r--r--net/ipv4/inet_hashtables.c10
3 files changed, 21 insertions, 21 deletions
diff --git a/include/net/inet_hashtables.h b/include/net/inet_hashtables.h
index fb0c09c7090c..a9eb2eaf094e 100644
--- a/include/net/inet_hashtables.h
+++ b/include/net/inet_hashtables.h
@@ -272,12 +272,12 @@ static inline int inet_iif(const struct sk_buff *skb)
272} 272}
273 273
274extern struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo, 274extern struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo,
275 const u32 daddr, 275 const __be32 daddr,
276 const unsigned short hnum, 276 const unsigned short hnum,
277 const int dif); 277 const int dif);
278 278
279static inline struct sock *inet_lookup_listener(struct inet_hashinfo *hashinfo, 279static inline struct sock *inet_lookup_listener(struct inet_hashinfo *hashinfo,
280 u32 daddr, u16 dport, int dif) 280 __be32 daddr, __be16 dport, int dif)
281{ 281{
282 return __inet_lookup_listener(hashinfo, daddr, ntohs(dport), dif); 282 return __inet_lookup_listener(hashinfo, daddr, ntohs(dport), dif);
283} 283}
@@ -347,8 +347,8 @@ typedef __u64 __bitwise __addrpair;
347 */ 347 */
348static inline struct sock * 348static inline struct sock *
349 __inet_lookup_established(struct inet_hashinfo *hashinfo, 349 __inet_lookup_established(struct inet_hashinfo *hashinfo,
350 const u32 saddr, const u16 sport, 350 const __be32 saddr, const __be16 sport,
351 const u32 daddr, const u16 hnum, 351 const __be32 daddr, const u16 hnum,
352 const int dif) 352 const int dif)
353{ 353{
354 INET_ADDR_COOKIE(acookie, saddr, daddr) 354 INET_ADDR_COOKIE(acookie, saddr, daddr)
@@ -384,8 +384,8 @@ hit:
384 384
385static inline struct sock * 385static inline struct sock *
386 inet_lookup_established(struct inet_hashinfo *hashinfo, 386 inet_lookup_established(struct inet_hashinfo *hashinfo,
387 const u32 saddr, const u16 sport, 387 const __be32 saddr, const __be16 sport,
388 const u32 daddr, const u16 dport, 388 const __be32 daddr, const __be16 dport,
389 const int dif) 389 const int dif)
390{ 390{
391 return __inet_lookup_established(hashinfo, saddr, sport, daddr, 391 return __inet_lookup_established(hashinfo, saddr, sport, daddr,
@@ -393,8 +393,8 @@ static inline struct sock *
393} 393}
394 394
395static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo, 395static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo,
396 const u32 saddr, const u16 sport, 396 const __be32 saddr, const __be16 sport,
397 const u32 daddr, const u16 dport, 397 const __be32 daddr, const __be16 dport,
398 const int dif) 398 const int dif)
399{ 399{
400 u16 hnum = ntohs(dport); 400 u16 hnum = ntohs(dport);
@@ -404,8 +404,8 @@ static inline struct sock *__inet_lookup(struct inet_hashinfo *hashinfo,
404} 404}
405 405
406static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo, 406static inline struct sock *inet_lookup(struct inet_hashinfo *hashinfo,
407 const u32 saddr, const u16 sport, 407 const __be32 saddr, const __be16 sport,
408 const u32 daddr, const u16 dport, 408 const __be32 daddr, const __be16 dport,
409 const int dif) 409 const int dif)
410{ 410{
411 struct sock *sk; 411 struct sock *sk;
diff --git a/include/net/inet_sock.h b/include/net/inet_sock.h
index a448bb226bb3..ce6da97bc848 100644
--- a/include/net/inet_sock.h
+++ b/include/net/inet_sock.h
@@ -167,10 +167,10 @@ static inline void inet_sk_copy_descendant(struct sock *sk_to,
167 167
168extern int inet_sk_rebuild_header(struct sock *sk); 168extern int inet_sk_rebuild_header(struct sock *sk);
169 169
170static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport, 170static inline unsigned int inet_ehashfn(const __be32 laddr, const __u16 lport,
171 const __u32 faddr, const __u16 fport) 171 const __be32 faddr, const __be16 fport)
172{ 172{
173 unsigned int h = (laddr ^ lport) ^ (faddr ^ fport); 173 unsigned int h = ((__force __u32)laddr ^ lport) ^ ((__force __u32)faddr ^ (__force __u32)fport);
174 h ^= h >> 16; 174 h ^= h >> 16;
175 h ^= h >> 8; 175 h ^= h >> 8;
176 return h; 176 return h;
@@ -179,10 +179,10 @@ static inline unsigned int inet_ehashfn(const __u32 laddr, const __u16 lport,
179static inline int inet_sk_ehashfn(const struct sock *sk) 179static inline int inet_sk_ehashfn(const struct sock *sk)
180{ 180{
181 const struct inet_sock *inet = inet_sk(sk); 181 const struct inet_sock *inet = inet_sk(sk);
182 const __u32 laddr = inet->rcv_saddr; 182 const __be32 laddr = inet->rcv_saddr;
183 const __u16 lport = inet->num; 183 const __u16 lport = inet->num;
184 const __u32 faddr = inet->daddr; 184 const __be32 faddr = inet->daddr;
185 const __u16 fport = inet->dport; 185 const __be16 fport = inet->dport;
186 186
187 return inet_ehashfn(laddr, lport, faddr, fport); 187 return inet_ehashfn(laddr, lport, faddr, fport);
188} 188}
diff --git a/net/ipv4/inet_hashtables.c b/net/ipv4/inet_hashtables.c
index 729d1eb39483..244c4f445c7d 100644
--- a/net/ipv4/inet_hashtables.c
+++ b/net/ipv4/inet_hashtables.c
@@ -125,7 +125,7 @@ EXPORT_SYMBOL(inet_listen_wlock);
125 * wildcarded during the search since they can never be otherwise. 125 * wildcarded during the search since they can never be otherwise.
126 */ 126 */
127static struct sock *inet_lookup_listener_slow(const struct hlist_head *head, 127static struct sock *inet_lookup_listener_slow(const struct hlist_head *head,
128 const u32 daddr, 128 const __be32 daddr,
129 const unsigned short hnum, 129 const unsigned short hnum,
130 const int dif) 130 const int dif)
131{ 131{
@@ -137,7 +137,7 @@ static struct sock *inet_lookup_listener_slow(const struct hlist_head *head,
137 const struct inet_sock *inet = inet_sk(sk); 137 const struct inet_sock *inet = inet_sk(sk);
138 138
139 if (inet->num == hnum && !ipv6_only_sock(sk)) { 139 if (inet->num == hnum && !ipv6_only_sock(sk)) {
140 const __u32 rcv_saddr = inet->rcv_saddr; 140 const __be32 rcv_saddr = inet->rcv_saddr;
141 int score = sk->sk_family == PF_INET ? 1 : 0; 141 int score = sk->sk_family == PF_INET ? 1 : 0;
142 142
143 if (rcv_saddr) { 143 if (rcv_saddr) {
@@ -163,7 +163,7 @@ static struct sock *inet_lookup_listener_slow(const struct hlist_head *head,
163 163
164/* Optimize the common listener case. */ 164/* Optimize the common listener case. */
165struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo, 165struct sock *__inet_lookup_listener(struct inet_hashinfo *hashinfo,
166 const u32 daddr, const unsigned short hnum, 166 const __be32 daddr, const unsigned short hnum,
167 const int dif) 167 const int dif)
168{ 168{
169 struct sock *sk = NULL; 169 struct sock *sk = NULL;
@@ -197,8 +197,8 @@ static int __inet_check_established(struct inet_timewait_death_row *death_row,
197{ 197{
198 struct inet_hashinfo *hinfo = death_row->hashinfo; 198 struct inet_hashinfo *hinfo = death_row->hashinfo;
199 struct inet_sock *inet = inet_sk(sk); 199 struct inet_sock *inet = inet_sk(sk);
200 u32 daddr = inet->rcv_saddr; 200 __be32 daddr = inet->rcv_saddr;
201 u32 saddr = inet->daddr; 201 __be32 saddr = inet->daddr;
202 int dif = sk->sk_bound_dev_if; 202 int dif = sk->sk_bound_dev_if;
203 INET_ADDR_COOKIE(acookie, saddr, daddr) 203 INET_ADDR_COOKIE(acookie, saddr, daddr)
204 const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport); 204 const __portpair ports = INET_COMBINED_PORTS(inet->dport, lport);