Skip to content

Commit

Permalink
NLM: NLM protocol version numbers are u32
Browse files Browse the repository at this point in the history
Clean up: RPC protocol version numbers are u32.  Make sure we use an
appropriate type for NLM version numbers when calling nlm_lookup_host().

Eliminates a harmless mixed sign comparison in nlm_host_lookup().

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
  • Loading branch information
Chuck Lever authored and Trond Myklebust committed Mar 19, 2008
1 parent 90d5b18 commit eb18860
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
20 changes: 11 additions & 9 deletions fs/lockd/host.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,12 @@ static struct nsm_handle * nsm_find(const struct sockaddr_in *sin,
/*
* Common host lookup routine for server & client
*/
static struct nlm_host *
nlm_lookup_host(int server, const struct sockaddr_in *sin,
int proto, int version, const char *hostname,
unsigned int hostname_len,
const struct sockaddr_in *ssin)
static struct nlm_host *nlm_lookup_host(int server,
const struct sockaddr_in *sin,
int proto, u32 version,
const char *hostname,
unsigned int hostname_len,
const struct sockaddr_in *ssin)
{
struct hlist_head *chain;
struct hlist_node *pos;
Expand All @@ -55,7 +56,7 @@ nlm_lookup_host(int server, const struct sockaddr_in *sin,
int hash;

dprintk("lockd: nlm_lookup_host("NIPQUAD_FMT"->"NIPQUAD_FMT
", p=%d, v=%d, my role=%s, name=%.*s)\n",
", p=%d, v=%u, my role=%s, name=%.*s)\n",
NIPQUAD(ssin->sin_addr.s_addr),
NIPQUAD(sin->sin_addr.s_addr), proto, version,
server? "server" : "client",
Expand Down Expand Up @@ -175,9 +176,10 @@ nlm_destroy_host(struct nlm_host *host)
/*
* Find an NLM server handle in the cache. If there is none, create it.
*/
struct nlm_host *
nlmclnt_lookup_host(const struct sockaddr_in *sin, int proto, int version,
const char *hostname, unsigned int hostname_len)
struct nlm_host *nlmclnt_lookup_host(const struct sockaddr_in *sin,
int proto, u32 version,
const char *hostname,
unsigned int hostname_len)
{
struct sockaddr_in ssin = {0};

Expand Down
6 changes: 4 additions & 2 deletions include/linux/lockd/lockd.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,10 @@ void nlmclnt_next_cookie(struct nlm_cookie *);
/*
* Host cache
*/
struct nlm_host *nlmclnt_lookup_host(const struct sockaddr_in *, int, int,
const char *, unsigned int);
struct nlm_host *nlmclnt_lookup_host(const struct sockaddr_in *sin,
int proto, u32 version,
const char *hostname,
unsigned int hostname_len);
struct nlm_host *nlmsvc_lookup_host(struct svc_rqst *, const char *,
unsigned int);
struct rpc_clnt * nlm_bind_host(struct nlm_host *);
Expand Down

0 comments on commit eb18860

Please sign in to comment.