aboutsummaryrefslogtreecommitdiffstats
path: root/fs/lockd/host.c
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2008-09-03 14:36:16 -0400
committerJ. Bruce Fields <bfields@citi.umich.edu>2008-09-29 18:13:39 -0400
commitbc48e4d6371137b1b06e985ea76c1254e9c06e83 (patch)
tree29cfa2b2116206f472b562839f98c9d202c50d72 /fs/lockd/host.c
parentede2fea099cf1dabe41e5b9563558bc7aee82248 (diff)
lockd: Combine __nsm_find() and nsm_find().
Clean up: Having two separate functions doesn't add clarity, so eliminate one of them. Use contemporary kernel coding conventions where appropriate. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'fs/lockd/host.c')
-rw-r--r--fs/lockd/host.c32
1 files changed, 11 insertions, 21 deletions
diff --git a/fs/lockd/host.c b/fs/lockd/host.c
index 1f9d72a7a030..b9eeafe99a66 100644
--- a/fs/lockd/host.c
+++ b/fs/lockd/host.c
@@ -31,13 +31,11 @@ static unsigned long next_gc;
31static int nrhosts; 31static int nrhosts;
32static DEFINE_MUTEX(nlm_host_mutex); 32static DEFINE_MUTEX(nlm_host_mutex);
33 33
34
35static void nlm_gc_hosts(void); 34static void nlm_gc_hosts(void);
36static struct nsm_handle * __nsm_find(const struct sockaddr_in *, 35static struct nsm_handle *nsm_find(const struct sockaddr_in *sin,
37 const char *, unsigned int, int); 36 const char *hostname,
38static struct nsm_handle * nsm_find(const struct sockaddr_in *sin, 37 const size_t hostname_len,
39 const char *hostname, 38 const int create);
40 unsigned int hostname_len);
41 39
42/* 40/*
43 * Hash function must work well on big- and little-endian platforms 41 * Hash function must work well on big- and little-endian platforms
@@ -187,7 +185,7 @@ static struct nlm_host *nlm_lookup_host(int server,
187 atomic_inc(&nsm->sm_count); 185 atomic_inc(&nsm->sm_count);
188 else { 186 else {
189 host = NULL; 187 host = NULL;
190 nsm = nsm_find(sin, hostname, hostname_len); 188 nsm = nsm_find(sin, hostname, hostname_len, 1);
191 if (!nsm) { 189 if (!nsm) {
192 dprintk("lockd: nlm_lookup_host failed; " 190 dprintk("lockd: nlm_lookup_host failed; "
193 "no nsm handle\n"); 191 "no nsm handle\n");
@@ -419,8 +417,7 @@ void nlm_host_rebooted(const struct sockaddr_in *sin,
419 struct nsm_handle *nsm; 417 struct nsm_handle *nsm;
420 struct nlm_host *host; 418 struct nlm_host *host;
421 419
422 /* Find the NSM handle for this peer */ 420 nsm = nsm_find(sin, hostname, hostname_len, 0);
423 nsm = __nsm_find(sin, hostname, hostname_len, 0);
424 if (nsm == NULL) { 421 if (nsm == NULL) {
425 dprintk("lockd: never saw rebooted peer '%.*s' before\n", 422 dprintk("lockd: never saw rebooted peer '%.*s' before\n",
426 hostname_len, hostname); 423 hostname_len, hostname);
@@ -560,10 +557,10 @@ nlm_gc_hosts(void)
560static LIST_HEAD(nsm_handles); 557static LIST_HEAD(nsm_handles);
561static DEFINE_SPINLOCK(nsm_lock); 558static DEFINE_SPINLOCK(nsm_lock);
562 559
563static struct nsm_handle * 560static struct nsm_handle *nsm_find(const struct sockaddr_in *sin,
564__nsm_find(const struct sockaddr_in *sin, 561 const char *hostname,
565 const char *hostname, unsigned int hostname_len, 562 const size_t hostname_len,
566 int create) 563 const int create)
567{ 564{
568 struct nsm_handle *nsm = NULL; 565 struct nsm_handle *nsm = NULL;
569 struct nsm_handle *pos; 566 struct nsm_handle *pos;
@@ -575,7 +572,7 @@ __nsm_find(const struct sockaddr_in *sin,
575 if (printk_ratelimit()) { 572 if (printk_ratelimit()) {
576 printk(KERN_WARNING "Invalid hostname \"%.*s\" " 573 printk(KERN_WARNING "Invalid hostname \"%.*s\" "
577 "in NFS lock request\n", 574 "in NFS lock request\n",
578 hostname_len, hostname); 575 (int)hostname_len, hostname);
579 } 576 }
580 return NULL; 577 return NULL;
581 } 578 }
@@ -623,13 +620,6 @@ found:
623 return nsm; 620 return nsm;
624} 621}
625 622
626static struct nsm_handle *
627nsm_find(const struct sockaddr_in *sin, const char *hostname,
628 unsigned int hostname_len)
629{
630 return __nsm_find(sin, hostname, hostname_len, 1);
631}
632
633/* 623/*
634 * Release an NSM handle 624 * Release an NSM handle
635 */ 625 */