Commit ffa94db6 authored by Trond Myklebust's avatar Trond Myklebust

SUNRPC/LOCKD: Fix build warnings when CONFIG_SUNRPC_DEBUG is undefined

Stephen Rothwell reports:
net/sunrpc/rpcb_clnt.c: In function 'rpcb_enc_mapping':
net/sunrpc/rpcb_clnt.c:820:19: warning: unused variable 'task' [-Wunused-variable]
net/sunrpc/rpcb_clnt.c: In function 'rpcb_dec_getport':
net/sunrpc/rpcb_clnt.c:837:19: warning: unused variable 'task' [-Wunused-variable]
net/sunrpc/rpcb_clnt.c: In function 'rpcb_dec_set':
net/sunrpc/rpcb_clnt.c:860:19: warning: unused variable 'task' [-Wunused-variable]
net/sunrpc/rpcb_clnt.c: In function 'rpcb_enc_getaddr':
net/sunrpc/rpcb_clnt.c:892:19: warning: unused variable 'task' [-Wunused-variable]
net/sunrpc/rpcb_clnt.c: In function 'rpcb_dec_getaddr':
net/sunrpc/rpcb_clnt.c:914:19: warning: unused variable 'task' [-Wunused-variable]
fs/lockd/svclock.c:49:20: warning: 'nlmdbg_cookie2a' declared 'static' but never defined [-Wunused-function]
Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent 9304a812
...@@ -46,7 +46,6 @@ static void nlmsvc_remove_block(struct nlm_block *block); ...@@ -46,7 +46,6 @@ static void nlmsvc_remove_block(struct nlm_block *block);
static int nlmsvc_setgrantargs(struct nlm_rqst *call, struct nlm_lock *lock); static int nlmsvc_setgrantargs(struct nlm_rqst *call, struct nlm_lock *lock);
static void nlmsvc_freegrantargs(struct nlm_rqst *call); static void nlmsvc_freegrantargs(struct nlm_rqst *call);
static const struct rpc_call_ops nlmsvc_grant_ops; static const struct rpc_call_ops nlmsvc_grant_ops;
static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie);
/* /*
* The list of blocked locks to retry * The list of blocked locks to retry
...@@ -54,6 +53,35 @@ static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie); ...@@ -54,6 +53,35 @@ static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie);
static LIST_HEAD(nlm_blocked); static LIST_HEAD(nlm_blocked);
static DEFINE_SPINLOCK(nlm_blocked_lock); static DEFINE_SPINLOCK(nlm_blocked_lock);
#ifdef LOCKD_DEBUG
static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie)
{
/*
* We can get away with a static buffer because we're only
* called with BKL held.
*/
static char buf[2*NLM_MAXCOOKIELEN+1];
unsigned int i, len = sizeof(buf);
char *p = buf;
len--; /* allow for trailing \0 */
if (len < 3)
return "???";
for (i = 0 ; i < cookie->len ; i++) {
if (len < 2) {
strcpy(p-3, "...");
break;
}
sprintf(p, "%02x", cookie->data[i]);
p += 2;
len -= 2;
}
*p = '\0';
return buf;
}
#endif
/* /*
* Insert a blocked lock into the global list * Insert a blocked lock into the global list
*/ */
...@@ -935,32 +963,3 @@ nlmsvc_retry_blocked(void) ...@@ -935,32 +963,3 @@ nlmsvc_retry_blocked(void)
return timeout; return timeout;
} }
#ifdef RPC_DEBUG
static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie)
{
/*
* We can get away with a static buffer because we're only
* called with BKL held.
*/
static char buf[2*NLM_MAXCOOKIELEN+1];
unsigned int i, len = sizeof(buf);
char *p = buf;
len--; /* allow for trailing \0 */
if (len < 3)
return "???";
for (i = 0 ; i < cookie->len ; i++) {
if (len < 2) {
strcpy(p-3, "...");
break;
}
sprintf(p, "%02x", cookie->data[i]);
p += 2;
len -= 2;
}
*p = '\0';
return buf;
}
#endif
...@@ -817,11 +817,11 @@ static void rpcb_getport_done(struct rpc_task *child, void *data) ...@@ -817,11 +817,11 @@ static void rpcb_getport_done(struct rpc_task *child, void *data)
static void rpcb_enc_mapping(struct rpc_rqst *req, struct xdr_stream *xdr, static void rpcb_enc_mapping(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct rpcbind_args *rpcb) const struct rpcbind_args *rpcb)
{ {
struct rpc_task *task = req->rq_task;
__be32 *p; __be32 *p;
dprintk("RPC: %5u encoding PMAP_%s call (%u, %u, %d, %u)\n", dprintk("RPC: %5u encoding PMAP_%s call (%u, %u, %d, %u)\n",
task->tk_pid, task->tk_msg.rpc_proc->p_name, req->rq_task->tk_pid,
req->rq_task->tk_msg.rpc_proc->p_name,
rpcb->r_prog, rpcb->r_vers, rpcb->r_prot, rpcb->r_port); rpcb->r_prog, rpcb->r_vers, rpcb->r_prot, rpcb->r_port);
p = xdr_reserve_space(xdr, RPCB_mappingargs_sz << 2); p = xdr_reserve_space(xdr, RPCB_mappingargs_sz << 2);
...@@ -834,7 +834,6 @@ static void rpcb_enc_mapping(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -834,7 +834,6 @@ static void rpcb_enc_mapping(struct rpc_rqst *req, struct xdr_stream *xdr,
static int rpcb_dec_getport(struct rpc_rqst *req, struct xdr_stream *xdr, static int rpcb_dec_getport(struct rpc_rqst *req, struct xdr_stream *xdr,
struct rpcbind_args *rpcb) struct rpcbind_args *rpcb)
{ {
struct rpc_task *task = req->rq_task;
unsigned long port; unsigned long port;
__be32 *p; __be32 *p;
...@@ -845,8 +844,8 @@ static int rpcb_dec_getport(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -845,8 +844,8 @@ static int rpcb_dec_getport(struct rpc_rqst *req, struct xdr_stream *xdr,
return -EIO; return -EIO;
port = be32_to_cpup(p); port = be32_to_cpup(p);
dprintk("RPC: %5u PMAP_%s result: %lu\n", task->tk_pid, dprintk("RPC: %5u PMAP_%s result: %lu\n", req->rq_task->tk_pid,
task->tk_msg.rpc_proc->p_name, port); req->rq_task->tk_msg.rpc_proc->p_name, port);
if (unlikely(port > USHRT_MAX)) if (unlikely(port > USHRT_MAX))
return -EIO; return -EIO;
...@@ -857,7 +856,6 @@ static int rpcb_dec_getport(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -857,7 +856,6 @@ static int rpcb_dec_getport(struct rpc_rqst *req, struct xdr_stream *xdr,
static int rpcb_dec_set(struct rpc_rqst *req, struct xdr_stream *xdr, static int rpcb_dec_set(struct rpc_rqst *req, struct xdr_stream *xdr,
unsigned int *boolp) unsigned int *boolp)
{ {
struct rpc_task *task = req->rq_task;
__be32 *p; __be32 *p;
p = xdr_inline_decode(xdr, 4); p = xdr_inline_decode(xdr, 4);
...@@ -869,7 +867,8 @@ static int rpcb_dec_set(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -869,7 +867,8 @@ static int rpcb_dec_set(struct rpc_rqst *req, struct xdr_stream *xdr,
*boolp = 1; *boolp = 1;
dprintk("RPC: %5u RPCB_%s call %s\n", dprintk("RPC: %5u RPCB_%s call %s\n",
task->tk_pid, task->tk_msg.rpc_proc->p_name, req->rq_task->tk_pid,
req->rq_task->tk_msg.rpc_proc->p_name,
(*boolp ? "succeeded" : "failed")); (*boolp ? "succeeded" : "failed"));
return 0; return 0;
} }
...@@ -889,11 +888,11 @@ static void encode_rpcb_string(struct xdr_stream *xdr, const char *string, ...@@ -889,11 +888,11 @@ static void encode_rpcb_string(struct xdr_stream *xdr, const char *string,
static void rpcb_enc_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr, static void rpcb_enc_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr,
const struct rpcbind_args *rpcb) const struct rpcbind_args *rpcb)
{ {
struct rpc_task *task = req->rq_task;
__be32 *p; __be32 *p;
dprintk("RPC: %5u encoding RPCB_%s call (%u, %u, '%s', '%s')\n", dprintk("RPC: %5u encoding RPCB_%s call (%u, %u, '%s', '%s')\n",
task->tk_pid, task->tk_msg.rpc_proc->p_name, req->rq_task->tk_pid,
req->rq_task->tk_msg.rpc_proc->p_name,
rpcb->r_prog, rpcb->r_vers, rpcb->r_prog, rpcb->r_vers,
rpcb->r_netid, rpcb->r_addr); rpcb->r_netid, rpcb->r_addr);
...@@ -911,7 +910,6 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -911,7 +910,6 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr,
{ {
struct sockaddr_storage address; struct sockaddr_storage address;
struct sockaddr *sap = (struct sockaddr *)&address; struct sockaddr *sap = (struct sockaddr *)&address;
struct rpc_task *task = req->rq_task;
__be32 *p; __be32 *p;
u32 len; u32 len;
...@@ -928,7 +926,7 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -928,7 +926,7 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr,
*/ */
if (len == 0) { if (len == 0) {
dprintk("RPC: %5u RPCB reply: program not registered\n", dprintk("RPC: %5u RPCB reply: program not registered\n",
task->tk_pid); req->rq_task->tk_pid);
return 0; return 0;
} }
...@@ -938,8 +936,8 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -938,8 +936,8 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr,
p = xdr_inline_decode(xdr, len); p = xdr_inline_decode(xdr, len);
if (unlikely(p == NULL)) if (unlikely(p == NULL))
goto out_fail; goto out_fail;
dprintk("RPC: %5u RPCB_%s reply: %s\n", task->tk_pid, dprintk("RPC: %5u RPCB_%s reply: %s\n", req->rq_task->tk_pid,
task->tk_msg.rpc_proc->p_name, (char *)p); req->rq_task->tk_msg.rpc_proc->p_name, (char *)p);
if (rpc_uaddr2sockaddr(req->rq_xprt->xprt_net, (char *)p, len, if (rpc_uaddr2sockaddr(req->rq_xprt->xprt_net, (char *)p, len,
sap, sizeof(address)) == 0) sap, sizeof(address)) == 0)
...@@ -950,7 +948,8 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr, ...@@ -950,7 +948,8 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr,
out_fail: out_fail:
dprintk("RPC: %5u malformed RPCB_%s reply\n", dprintk("RPC: %5u malformed RPCB_%s reply\n",
task->tk_pid, task->tk_msg.rpc_proc->p_name); req->rq_task->tk_pid,
req->rq_task->tk_msg.rpc_proc->p_name);
return -EIO; return -EIO;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment