aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/lockd/svclock.c30
-rw-r--r--fs/lockd/xdr.c29
-rw-r--r--include/linux/lockd/debug.h10
3 files changed, 30 insertions, 39 deletions
diff --git a/fs/lockd/svclock.c b/fs/lockd/svclock.c
index ef5659b211e9..9266c4600208 100644
--- a/fs/lockd/svclock.c
+++ b/fs/lockd/svclock.c
@@ -46,6 +46,7 @@ static void nlmsvc_remove_block(struct nlm_block *block);
46static int nlmsvc_setgrantargs(struct nlm_rqst *call, struct nlm_lock *lock); 46static int nlmsvc_setgrantargs(struct nlm_rqst *call, struct nlm_lock *lock);
47static void nlmsvc_freegrantargs(struct nlm_rqst *call); 47static void nlmsvc_freegrantargs(struct nlm_rqst *call);
48static const struct rpc_call_ops nlmsvc_grant_ops; 48static const struct rpc_call_ops nlmsvc_grant_ops;
49static const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie);
49 50
50/* 51/*
51 * The list of blocked locks to retry 52 * The list of blocked locks to retry
@@ -934,3 +935,32 @@ nlmsvc_retry_blocked(void)
934 935
935 return timeout; 936 return timeout;
936} 937}
938
939#ifdef RPC_DEBUG
940static 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/fs/lockd/xdr.c b/fs/lockd/xdr.c
index 0eb694dc497b..964666c68a86 100644
--- a/fs/lockd/xdr.c
+++ b/fs/lockd/xdr.c
@@ -341,32 +341,3 @@ nlmsvc_encode_void(struct svc_rqst *rqstp, __be32 *p, void *dummy)
341{ 341{
342 return xdr_ressize_check(rqstp, p); 342 return xdr_ressize_check(rqstp, p);
343} 343}
344
345#ifdef RPC_DEBUG
346const char *nlmdbg_cookie2a(const struct nlm_cookie *cookie)
347{
348 /*
349 * We can get away with a static buffer because we're only
350 * called with BKL held.
351 */
352 static char buf[2*NLM_MAXCOOKIELEN+1];
353 unsigned int i, len = sizeof(buf);
354 char *p = buf;
355
356 len--; /* allow for trailing \0 */
357 if (len < 3)
358 return "???";
359 for (i = 0 ; i < cookie->len ; i++) {
360 if (len < 2) {
361 strcpy(p-3, "...");
362 break;
363 }
364 sprintf(p, "%02x", cookie->data[i]);
365 p += 2;
366 len -= 2;
367 }
368 *p = '\0';
369
370 return buf;
371}
372#endif
diff --git a/include/linux/lockd/debug.h b/include/linux/lockd/debug.h
index 34b2b7f33c3b..257d3779f2ab 100644
--- a/include/linux/lockd/debug.h
+++ b/include/linux/lockd/debug.h
@@ -44,14 +44,4 @@
44#define NLMDBG_XDR 0x0100 44#define NLMDBG_XDR 0x0100
45#define NLMDBG_ALL 0x7fff 45#define NLMDBG_ALL 0x7fff
46 46
47
48/*
49 * Support for printing NLM cookies in dprintk()
50 */
51#ifdef RPC_DEBUG
52struct nlm_cookie;
53/* Call this function with the BKL held (it uses a static buffer) */
54extern const char *nlmdbg_cookie2a(const struct nlm_cookie *);
55#endif
56
57#endif /* LINUX_LOCKD_DEBUG_H */ 47#endif /* LINUX_LOCKD_DEBUG_H */