diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-03-20 09:22:00 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-03-21 09:31:44 -0400 |
commit | ffa94db6042e6fd014ae0bed8832ac707ef2afe9 (patch) | |
tree | c2e98dc23546be53b311bf4eb010e824709e4d76 | |
parent | 9304a8120a6ac06d08874d2aec76f52d3376dfe4 (diff) |
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: Stephen Rothwell <sfr@canb.auug.org.au>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/lockd/svclock.c | 59 | ||||
-rw-r--r-- | net/sunrpc/rpcb_clnt.c | 27 |
2 files changed, 42 insertions, 44 deletions
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c index f0179c3745d2..e46353f41a42 100644 --- a/fs/lockd/svclock.c +++ b/fs/lockd/svclock.c | |||
@@ -46,7 +46,6 @@ static void nlmsvc_remove_block(struct nlm_block *block); | |||
46 | static int nlmsvc_setgrantargs(struct nlm_rqst *call, struct nlm_lock *lock); | 46 | static int nlmsvc_setgrantargs(struct nlm_rqst *call, struct nlm_lock *lock); |
47 | static void nlmsvc_freegrantargs(struct nlm_rqst *call); | 47 | static void nlmsvc_freegrantargs(struct nlm_rqst *call); |
48 | static const struct rpc_call_ops nlmsvc_grant_ops; | 48 | static const struct rpc_call_ops nlmsvc_grant_ops; |
49 | static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie); | ||
50 | 49 | ||
51 | /* | 50 | /* |
52 | * The list of blocked locks to retry | 51 | * The list of blocked locks to retry |
@@ -54,6 +53,35 @@ static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie); | |||
54 | static LIST_HEAD(nlm_blocked); | 53 | static LIST_HEAD(nlm_blocked); |
55 | static DEFINE_SPINLOCK(nlm_blocked_lock); | 54 | static DEFINE_SPINLOCK(nlm_blocked_lock); |
56 | 55 | ||
56 | #ifdef LOCKD_DEBUG | ||
57 | static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie) | ||
58 | { | ||
59 | /* | ||
60 | * We can get away with a static buffer because we're only | ||
61 | * called with BKL held. | ||
62 | */ | ||
63 | static char buf[2*NLM_MAXCOOKIELEN+1]; | ||
64 | unsigned int i, len = sizeof(buf); | ||
65 | char *p = buf; | ||
66 | |||
67 | len--; /* allow for trailing \0 */ | ||
68 | if (len < 3) | ||
69 | return "???"; | ||
70 | for (i = 0 ; i < cookie->len ; i++) { | ||
71 | if (len < 2) { | ||
72 | strcpy(p-3, "..."); | ||
73 | break; | ||
74 | } | ||
75 | sprintf(p, "%02x", cookie->data[i]); | ||
76 | p += 2; | ||
77 | len -= 2; | ||
78 | } | ||
79 | *p = '\0'; | ||
80 | |||
81 | return buf; | ||
82 | } | ||
83 | #endif | ||
84 | |||
57 | /* | 85 | /* |
58 | * Insert a blocked lock into the global list | 86 | * Insert a blocked lock into the global list |
59 | */ | 87 | */ |
@@ -935,32 +963,3 @@ nlmsvc_retry_blocked(void) | |||
935 | 963 | ||
936 | return timeout; | 964 | return timeout; |
937 | } | 965 | } |
938 | |||
939 | #ifdef RPC_DEBUG | ||
940 | static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie) | ||
941 | { | ||
942 | /* | ||
943 | * We can get away with a static buffer because we're only | ||
944 | * called with BKL held. | ||
945 | */ | ||
946 | static char buf[2*NLM_MAXCOOKIELEN+1]; | ||
947 | unsigned int i, len = sizeof(buf); | ||
948 | char *p = buf; | ||
949 | |||
950 | len--; /* allow for trailing \0 */ | ||
951 | if (len < 3) | ||
952 | return "???"; | ||
953 | for (i = 0 ; i < cookie->len ; i++) { | ||
954 | if (len < 2) { | ||
955 | strcpy(p-3, "..."); | ||
956 | break; | ||
957 | } | ||
958 | sprintf(p, "%02x", cookie->data[i]); | ||
959 | p += 2; | ||
960 | len -= 2; | ||
961 | } | ||
962 | *p = '\0'; | ||
963 | |||
964 | return buf; | ||
965 | } | ||
966 | #endif | ||
diff --git a/net/sunrpc/rpcb_clnt.c b/net/sunrpc/rpcb_clnt.c index e699ff0ce909..207a74696c9f 100644 --- a/net/sunrpc/rpcb_clnt.c +++ b/net/sunrpc/rpcb_clnt.c | |||
@@ -817,11 +817,11 @@ static void rpcb_getport_done(struct rpc_task *child, void *data) | |||
817 | static void rpcb_enc_mapping(struct rpc_rqst *req, struct xdr_stream *xdr, | 817 | static void rpcb_enc_mapping(struct rpc_rqst *req, struct xdr_stream *xdr, |
818 | const struct rpcbind_args *rpcb) | 818 | const struct rpcbind_args *rpcb) |
819 | { | 819 | { |
820 | struct rpc_task *task = req->rq_task; | ||
821 | __be32 *p; | 820 | __be32 *p; |
822 | 821 | ||
823 | dprintk("RPC: %5u encoding PMAP_%s call (%u, %u, %d, %u)\n", | 822 | dprintk("RPC: %5u encoding PMAP_%s call (%u, %u, %d, %u)\n", |
824 | task->tk_pid, task->tk_msg.rpc_proc->p_name, | 823 | req->rq_task->tk_pid, |
824 | req->rq_task->tk_msg.rpc_proc->p_name, | ||
825 | rpcb->r_prog, rpcb->r_vers, rpcb->r_prot, rpcb->r_port); | 825 | rpcb->r_prog, rpcb->r_vers, rpcb->r_prot, rpcb->r_port); |
826 | 826 | ||
827 | p = xdr_reserve_space(xdr, RPCB_mappingargs_sz << 2); | 827 | 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 | static int rpcb_dec_getport(struct rpc_rqst *req, struct xdr_stream *xdr, | 834 | static int rpcb_dec_getport(struct rpc_rqst *req, struct xdr_stream *xdr, |
835 | struct rpcbind_args *rpcb) | 835 | struct rpcbind_args *rpcb) |
836 | { | 836 | { |
837 | struct rpc_task *task = req->rq_task; | ||
838 | unsigned long port; | 837 | unsigned long port; |
839 | __be32 *p; | 838 | __be32 *p; |
840 | 839 | ||
@@ -845,8 +844,8 @@ static int rpcb_dec_getport(struct rpc_rqst *req, struct xdr_stream *xdr, | |||
845 | return -EIO; | 844 | return -EIO; |
846 | 845 | ||
847 | port = be32_to_cpup(p); | 846 | port = be32_to_cpup(p); |
848 | dprintk("RPC: %5u PMAP_%s result: %lu\n", task->tk_pid, | 847 | dprintk("RPC: %5u PMAP_%s result: %lu\n", req->rq_task->tk_pid, |
849 | task->tk_msg.rpc_proc->p_name, port); | 848 | req->rq_task->tk_msg.rpc_proc->p_name, port); |
850 | if (unlikely(port > USHRT_MAX)) | 849 | if (unlikely(port > USHRT_MAX)) |
851 | return -EIO; | 850 | return -EIO; |
852 | 851 | ||
@@ -857,7 +856,6 @@ static int rpcb_dec_getport(struct rpc_rqst *req, struct xdr_stream *xdr, | |||
857 | static int rpcb_dec_set(struct rpc_rqst *req, struct xdr_stream *xdr, | 856 | static int rpcb_dec_set(struct rpc_rqst *req, struct xdr_stream *xdr, |
858 | unsigned int *boolp) | 857 | unsigned int *boolp) |
859 | { | 858 | { |
860 | struct rpc_task *task = req->rq_task; | ||
861 | __be32 *p; | 859 | __be32 *p; |
862 | 860 | ||
863 | p = xdr_inline_decode(xdr, 4); | 861 | p = xdr_inline_decode(xdr, 4); |
@@ -869,7 +867,8 @@ static int rpcb_dec_set(struct rpc_rqst *req, struct xdr_stream *xdr, | |||
869 | *boolp = 1; | 867 | *boolp = 1; |
870 | 868 | ||
871 | dprintk("RPC: %5u RPCB_%s call %s\n", | 869 | dprintk("RPC: %5u RPCB_%s call %s\n", |
872 | task->tk_pid, task->tk_msg.rpc_proc->p_name, | 870 | req->rq_task->tk_pid, |
871 | req->rq_task->tk_msg.rpc_proc->p_name, | ||
873 | (*boolp ? "succeeded" : "failed")); | 872 | (*boolp ? "succeeded" : "failed")); |
874 | return 0; | 873 | return 0; |
875 | } | 874 | } |
@@ -889,11 +888,11 @@ static void encode_rpcb_string(struct xdr_stream *xdr, const char *string, | |||
889 | static void rpcb_enc_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr, | 888 | static void rpcb_enc_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr, |
890 | const struct rpcbind_args *rpcb) | 889 | const struct rpcbind_args *rpcb) |
891 | { | 890 | { |
892 | struct rpc_task *task = req->rq_task; | ||
893 | __be32 *p; | 891 | __be32 *p; |
894 | 892 | ||
895 | dprintk("RPC: %5u encoding RPCB_%s call (%u, %u, '%s', '%s')\n", | 893 | dprintk("RPC: %5u encoding RPCB_%s call (%u, %u, '%s', '%s')\n", |
896 | task->tk_pid, task->tk_msg.rpc_proc->p_name, | 894 | req->rq_task->tk_pid, |
895 | req->rq_task->tk_msg.rpc_proc->p_name, | ||
897 | rpcb->r_prog, rpcb->r_vers, | 896 | rpcb->r_prog, rpcb->r_vers, |
898 | rpcb->r_netid, rpcb->r_addr); | 897 | rpcb->r_netid, rpcb->r_addr); |
899 | 898 | ||
@@ -911,7 +910,6 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr, | |||
911 | { | 910 | { |
912 | struct sockaddr_storage address; | 911 | struct sockaddr_storage address; |
913 | struct sockaddr *sap = (struct sockaddr *)&address; | 912 | struct sockaddr *sap = (struct sockaddr *)&address; |
914 | struct rpc_task *task = req->rq_task; | ||
915 | __be32 *p; | 913 | __be32 *p; |
916 | u32 len; | 914 | u32 len; |
917 | 915 | ||
@@ -928,7 +926,7 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr, | |||
928 | */ | 926 | */ |
929 | if (len == 0) { | 927 | if (len == 0) { |
930 | dprintk("RPC: %5u RPCB reply: program not registered\n", | 928 | dprintk("RPC: %5u RPCB reply: program not registered\n", |
931 | task->tk_pid); | 929 | req->rq_task->tk_pid); |
932 | return 0; | 930 | return 0; |
933 | } | 931 | } |
934 | 932 | ||
@@ -938,8 +936,8 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr, | |||
938 | p = xdr_inline_decode(xdr, len); | 936 | p = xdr_inline_decode(xdr, len); |
939 | if (unlikely(p == NULL)) | 937 | if (unlikely(p == NULL)) |
940 | goto out_fail; | 938 | goto out_fail; |
941 | dprintk("RPC: %5u RPCB_%s reply: %s\n", task->tk_pid, | 939 | dprintk("RPC: %5u RPCB_%s reply: %s\n", req->rq_task->tk_pid, |
942 | task->tk_msg.rpc_proc->p_name, (char *)p); | 940 | req->rq_task->tk_msg.rpc_proc->p_name, (char *)p); |
943 | 941 | ||
944 | if (rpc_uaddr2sockaddr(req->rq_xprt->xprt_net, (char *)p, len, | 942 | if (rpc_uaddr2sockaddr(req->rq_xprt->xprt_net, (char *)p, len, |
945 | sap, sizeof(address)) == 0) | 943 | sap, sizeof(address)) == 0) |
@@ -950,7 +948,8 @@ static int rpcb_dec_getaddr(struct rpc_rqst *req, struct xdr_stream *xdr, | |||
950 | 948 | ||
951 | out_fail: | 949 | out_fail: |
952 | dprintk("RPC: %5u malformed RPCB_%s reply\n", | 950 | dprintk("RPC: %5u malformed RPCB_%s reply\n", |
953 | task->tk_pid, task->tk_msg.rpc_proc->p_name); | 951 | req->rq_task->tk_pid, |
952 | req->rq_task->tk_msg.rpc_proc->p_name); | ||
954 | return -EIO; | 953 | return -EIO; |
955 | } | 954 | } |
956 | 955 | ||