summaryrefslogtreecommitdiff
path: root/include/linux/lockd/xdr.h
diff options
context:
space:
mode:
authorEd Schouten <ed@il.fontys.nl>2004-10-19 18:40:45 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-10-19 18:40:45 -0700
commitfc29938dabf736b88f7f2ae3e18efbb01b1fbcb8 (patch)
treef434f27e58f59d5f3c05bf02a86519525faf6f1b /include/linux/lockd/xdr.h
parent47387472176f51d2f84548a353204029daf6cf91 (diff)
[PATCH] lockd: remove hardcoded maximum NLM cookie length
At the moment, the NLM cookie length is fixed to 8 bytes, while 1024 is the theoretical maximum. FreeBSD uses 16 bytes, Mac OS X uses 20 bytes. Therefore we need to make the length dynamic (which I set to 32 bytes). This patch is based on an old patch for Linux 2.4.23-pre9, which I changed to patch properly (also added some stylish NIPQUAD fixes). From: Neil Brown <neilb@cse.unsw.edu.au> Further lockd tidyups. - NIPQUAD everywhere that is appropriate - use XDR_QUADLEN in more places as appropriate - discard QUADLEN which is a lockd-specific version of XDR_QUADLEN Signed-off-by: Neil Brown <neilb@cse.unsw.edu.au> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/linux/lockd/xdr.h')
-rw-r--r--include/linux/lockd/xdr.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/include/linux/lockd/xdr.h b/include/linux/lockd/xdr.h
index ef14dbd2a67c..d7a5cc4cfa97 100644
--- a/include/linux/lockd/xdr.h
+++ b/include/linux/lockd/xdr.h
@@ -13,10 +13,9 @@
#include <linux/nfs.h>
#include <linux/sunrpc/xdr.h>
+#define NLM_MAXCOOKIELEN 32
#define NLM_MAXSTRLEN 1024
-#define QUADLEN(len) (((len) + 3) >> 2)
-
#define nlm_granted __constant_htonl(NLM_LCK_GRANTED)
#define nlm_lck_denied __constant_htonl(NLM_LCK_DENIED)
#define nlm_lck_denied_nolocks __constant_htonl(NLM_LCK_DENIED_NOLOCKS)
@@ -33,13 +32,14 @@ struct nlm_lock {
};
/*
- * NLM cookies. Technically they can be 1K, Nobody uses over 8 bytes
- * however.
+ * NLM cookies. Technically they can be 1K, but Linux only uses 8 bytes.
+ * FreeBSD uses 16, Apple Mac OS X 10.3 uses 20. Therefore we set it to
+ * 32 bytes.
*/
struct nlm_cookie
{
- unsigned char data[8];
+ unsigned char data[NLM_MAXCOOKIELEN];
unsigned int len;
};