diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-11-08 03:22:34 -0500 |
---|---|---|
committer | David S. Miller <davem@sunset.davemloft.net> | 2006-12-03 00:21:16 -0500 |
commit | 4806126d78345ad8a99bca1367a8a39c08e19393 (patch) | |
tree | 2bd37dc5fe23535be684195cf43a6fa967a0b2e1 /net/sunrpc/svcauth_unix.c | |
parent | 8a74ff7770f4795d7580392890fdf06821c78769 (diff) |
[SUNRPC]: annotate hash_ip()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sunrpc/svcauth_unix.c')
-rw-r--r-- | net/sunrpc/svcauth_unix.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index e1bd933629fe..a0a953a430c2 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c | |||
@@ -101,9 +101,9 @@ static void ip_map_put(struct kref *kref) | |||
101 | * IP addresses in reverse-endian (i.e. on a little-endian machine). | 101 | * IP addresses in reverse-endian (i.e. on a little-endian machine). |
102 | * So use a trivial but reliable hash instead | 102 | * So use a trivial but reliable hash instead |
103 | */ | 103 | */ |
104 | static inline int hash_ip(unsigned long ip) | 104 | static inline int hash_ip(__be32 ip) |
105 | { | 105 | { |
106 | int hash = ip ^ (ip>>16); | 106 | int hash = (__force u32)ip ^ ((__force u32)ip>>16); |
107 | return (hash ^ (hash>>8)) & 0xff; | 107 | return (hash ^ (hash>>8)) & 0xff; |
108 | } | 108 | } |
109 | #endif | 109 | #endif |
@@ -284,7 +284,7 @@ static struct ip_map *ip_map_lookup(char *class, struct in_addr addr) | |||
284 | ip.m_addr = addr; | 284 | ip.m_addr = addr; |
285 | ch = sunrpc_cache_lookup(&ip_map_cache, &ip.h, | 285 | ch = sunrpc_cache_lookup(&ip_map_cache, &ip.h, |
286 | hash_str(class, IP_HASHBITS) ^ | 286 | hash_str(class, IP_HASHBITS) ^ |
287 | hash_ip((unsigned long)addr.s_addr)); | 287 | hash_ip(addr.s_addr)); |
288 | 288 | ||
289 | if (ch) | 289 | if (ch) |
290 | return container_of(ch, struct ip_map, h); | 290 | return container_of(ch, struct ip_map, h); |
@@ -313,7 +313,7 @@ static int ip_map_update(struct ip_map *ipm, struct unix_domain *udom, time_t ex | |||
313 | ch = sunrpc_cache_update(&ip_map_cache, | 313 | ch = sunrpc_cache_update(&ip_map_cache, |
314 | &ip.h, &ipm->h, | 314 | &ip.h, &ipm->h, |
315 | hash_str(ipm->m_class, IP_HASHBITS) ^ | 315 | hash_str(ipm->m_class, IP_HASHBITS) ^ |
316 | hash_ip((unsigned long)ipm->m_addr.s_addr)); | 316 | hash_ip(ipm->m_addr.s_addr)); |
317 | if (!ch) | 317 | if (!ch) |
318 | return -ENOMEM; | 318 | return -ENOMEM; |
319 | cache_put(ch, &ip_map_cache); | 319 | cache_put(ch, &ip_map_cache); |