diff options
author | Pavel Emelyanov <xemul@parallels.com> | 2010-09-27 05:57:36 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2010-09-27 10:16:11 -0400 |
commit | bf18ab32ff2a50a3d13d559f26f94ecfba131f24 (patch) | |
tree | 9d4ee72228c3b0c71a1de93d3cf5ed33adb1e33b /net/sunrpc/svcauth_unix.c | |
parent | 74ec1e1269eba65b5f8e810cf0363ddb7aa64de5 (diff) |
sunrpc: Pass the ip_map_parse's cd to lower calls
The target is to have many ip_map_cache-s in the system. This particular
patch handles its usage by the ip_map_parse callback.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'net/sunrpc/svcauth_unix.c')
-rw-r--r-- | net/sunrpc/svcauth_unix.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/net/sunrpc/svcauth_unix.c b/net/sunrpc/svcauth_unix.c index e91b550bc836..31b99c599e7e 100644 --- a/net/sunrpc/svcauth_unix.c +++ b/net/sunrpc/svcauth_unix.c | |||
@@ -178,8 +178,8 @@ static int ip_map_upcall(struct cache_detail *cd, struct cache_head *h) | |||
178 | return sunrpc_cache_pipe_upcall(cd, h, ip_map_request); | 178 | return sunrpc_cache_pipe_upcall(cd, h, ip_map_request); |
179 | } | 179 | } |
180 | 180 | ||
181 | static struct ip_map *ip_map_lookup(char *class, struct in6_addr *addr); | 181 | static struct ip_map *__ip_map_lookup(struct cache_detail *cd, char *class, struct in6_addr *addr); |
182 | static int ip_map_update(struct ip_map *ipm, struct unix_domain *udom, time_t expiry); | 182 | static int __ip_map_update(struct cache_detail *cd, struct ip_map *ipm, struct unix_domain *udom, time_t expiry); |
183 | 183 | ||
184 | static int ip_map_parse(struct cache_detail *cd, | 184 | static int ip_map_parse(struct cache_detail *cd, |
185 | char *mesg, int mlen) | 185 | char *mesg, int mlen) |
@@ -249,9 +249,9 @@ static int ip_map_parse(struct cache_detail *cd, | |||
249 | dom = NULL; | 249 | dom = NULL; |
250 | 250 | ||
251 | /* IPv6 scope IDs are ignored for now */ | 251 | /* IPv6 scope IDs are ignored for now */ |
252 | ipmp = ip_map_lookup(class, &sin6.sin6_addr); | 252 | ipmp = __ip_map_lookup(cd, class, &sin6.sin6_addr); |
253 | if (ipmp) { | 253 | if (ipmp) { |
254 | err = ip_map_update(ipmp, | 254 | err = __ip_map_update(cd, ipmp, |
255 | container_of(dom, struct unix_domain, h), | 255 | container_of(dom, struct unix_domain, h), |
256 | expiry); | 256 | expiry); |
257 | } else | 257 | } else |
@@ -309,14 +309,15 @@ struct cache_detail ip_map_cache = { | |||
309 | .alloc = ip_map_alloc, | 309 | .alloc = ip_map_alloc, |
310 | }; | 310 | }; |
311 | 311 | ||
312 | static struct ip_map *ip_map_lookup(char *class, struct in6_addr *addr) | 312 | static struct ip_map *__ip_map_lookup(struct cache_detail *cd, char *class, |
313 | struct in6_addr *addr) | ||
313 | { | 314 | { |
314 | struct ip_map ip; | 315 | struct ip_map ip; |
315 | struct cache_head *ch; | 316 | struct cache_head *ch; |
316 | 317 | ||
317 | strcpy(ip.m_class, class); | 318 | strcpy(ip.m_class, class); |
318 | ipv6_addr_copy(&ip.m_addr, addr); | 319 | ipv6_addr_copy(&ip.m_addr, addr); |
319 | ch = sunrpc_cache_lookup(&ip_map_cache, &ip.h, | 320 | ch = sunrpc_cache_lookup(cd, &ip.h, |
320 | hash_str(class, IP_HASHBITS) ^ | 321 | hash_str(class, IP_HASHBITS) ^ |
321 | hash_ip6(*addr)); | 322 | hash_ip6(*addr)); |
322 | 323 | ||
@@ -326,7 +327,13 @@ static struct ip_map *ip_map_lookup(char *class, struct in6_addr *addr) | |||
326 | return NULL; | 327 | return NULL; |
327 | } | 328 | } |
328 | 329 | ||
329 | static int ip_map_update(struct ip_map *ipm, struct unix_domain *udom, time_t expiry) | 330 | static inline struct ip_map *ip_map_lookup(char *class, struct in6_addr *addr) |
331 | { | ||
332 | return __ip_map_lookup(&ip_map_cache, class, addr); | ||
333 | } | ||
334 | |||
335 | static int __ip_map_update(struct cache_detail *cd, struct ip_map *ipm, | ||
336 | struct unix_domain *udom, time_t expiry) | ||
330 | { | 337 | { |
331 | struct ip_map ip; | 338 | struct ip_map ip; |
332 | struct cache_head *ch; | 339 | struct cache_head *ch; |
@@ -344,16 +351,20 @@ static int ip_map_update(struct ip_map *ipm, struct unix_domain *udom, time_t ex | |||
344 | ip.m_add_change++; | 351 | ip.m_add_change++; |
345 | } | 352 | } |
346 | ip.h.expiry_time = expiry; | 353 | ip.h.expiry_time = expiry; |
347 | ch = sunrpc_cache_update(&ip_map_cache, | 354 | ch = sunrpc_cache_update(cd, &ip.h, &ipm->h, |
348 | &ip.h, &ipm->h, | ||
349 | hash_str(ipm->m_class, IP_HASHBITS) ^ | 355 | hash_str(ipm->m_class, IP_HASHBITS) ^ |
350 | hash_ip6(ipm->m_addr)); | 356 | hash_ip6(ipm->m_addr)); |
351 | if (!ch) | 357 | if (!ch) |
352 | return -ENOMEM; | 358 | return -ENOMEM; |
353 | cache_put(ch, &ip_map_cache); | 359 | cache_put(ch, cd); |
354 | return 0; | 360 | return 0; |
355 | } | 361 | } |
356 | 362 | ||
363 | static inline int ip_map_update(struct ip_map *ipm, struct unix_domain *udom, time_t expiry) | ||
364 | { | ||
365 | return __ip_map_update(&ip_map_cache, ipm, udom, expiry); | ||
366 | } | ||
367 | |||
357 | int auth_unix_add_addr(struct in6_addr *addr, struct auth_domain *dom) | 368 | int auth_unix_add_addr(struct in6_addr *addr, struct auth_domain *dom) |
358 | { | 369 | { |
359 | struct unix_domain *udom; | 370 | struct unix_domain *udom; |