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>
This commit is contained in:
Chuck Lever 2008-09-03 14:36:16 -04:00 коммит произвёл J. Bruce Fields
Родитель ede2fea099
Коммит bc48e4d637
1 изменённых файлов: 11 добавлений и 21 удалений

Просмотреть файл

@ -31,13 +31,11 @@ static unsigned long next_gc;
static int nrhosts; static int nrhosts;
static DEFINE_MUTEX(nlm_host_mutex); static DEFINE_MUTEX(nlm_host_mutex);
static void nlm_gc_hosts(void); static void nlm_gc_hosts(void);
static struct nsm_handle * __nsm_find(const struct sockaddr_in *, static struct nsm_handle *nsm_find(const struct sockaddr_in *sin,
const char *, unsigned int, int); const char *hostname,
static struct nsm_handle * nsm_find(const struct sockaddr_in *sin, const size_t hostname_len,
const char *hostname, const int create);
unsigned int hostname_len);
/* /*
* Hash function must work well on big- and little-endian platforms * Hash function must work well on big- and little-endian platforms
@ -187,7 +185,7 @@ static struct nlm_host *nlm_lookup_host(int server,
atomic_inc(&nsm->sm_count); atomic_inc(&nsm->sm_count);
else { else {
host = NULL; host = NULL;
nsm = nsm_find(sin, hostname, hostname_len); nsm = nsm_find(sin, hostname, hostname_len, 1);
if (!nsm) { if (!nsm) {
dprintk("lockd: nlm_lookup_host failed; " dprintk("lockd: nlm_lookup_host failed; "
"no nsm handle\n"); "no nsm handle\n");
@ -419,8 +417,7 @@ void nlm_host_rebooted(const struct sockaddr_in *sin,
struct nsm_handle *nsm; struct nsm_handle *nsm;
struct nlm_host *host; struct nlm_host *host;
/* Find the NSM handle for this peer */ nsm = nsm_find(sin, hostname, hostname_len, 0);
nsm = __nsm_find(sin, hostname, hostname_len, 0);
if (nsm == NULL) { if (nsm == NULL) {
dprintk("lockd: never saw rebooted peer '%.*s' before\n", dprintk("lockd: never saw rebooted peer '%.*s' before\n",
hostname_len, hostname); hostname_len, hostname);
@ -560,10 +557,10 @@ nlm_gc_hosts(void)
static LIST_HEAD(nsm_handles); static LIST_HEAD(nsm_handles);
static DEFINE_SPINLOCK(nsm_lock); static DEFINE_SPINLOCK(nsm_lock);
static struct nsm_handle * static struct nsm_handle *nsm_find(const struct sockaddr_in *sin,
__nsm_find(const struct sockaddr_in *sin, const char *hostname,
const char *hostname, unsigned int hostname_len, const size_t hostname_len,
int create) const int create)
{ {
struct nsm_handle *nsm = NULL; struct nsm_handle *nsm = NULL;
struct nsm_handle *pos; struct nsm_handle *pos;
@ -575,7 +572,7 @@ __nsm_find(const struct sockaddr_in *sin,
if (printk_ratelimit()) { if (printk_ratelimit()) {
printk(KERN_WARNING "Invalid hostname \"%.*s\" " printk(KERN_WARNING "Invalid hostname \"%.*s\" "
"in NFS lock request\n", "in NFS lock request\n",
hostname_len, hostname); (int)hostname_len, hostname);
} }
return NULL; return NULL;
} }
@ -623,13 +620,6 @@ found:
return nsm; return nsm;
} }
static struct nsm_handle *
nsm_find(const struct sockaddr_in *sin, const char *hostname,
unsigned int hostname_len)
{
return __nsm_find(sin, hostname, hostname_len, 1);
}
/* /*
* Release an NSM handle * Release an NSM handle
*/ */