NFS: Kill the obsolete NFS_PARANOIA
[powerpc.git] / fs / lockd / xdr4.c
index f4c0b2b..ce1efdb 100644 (file)
@@ -367,7 +367,7 @@ nlm4svc_decode_res(struct svc_rqst *rqstp, __be32 *p, struct nlm_res *resp)
 {
        if (!(p = nlm4_decode_cookie(p, &resp->cookie)))
                return 0;
-       resp->status = ntohl(*p++);
+       resp->status = *p++;
        return xdr_argsize_check(rqstp, p);
 }
 
@@ -413,8 +413,8 @@ nlm4clt_decode_testres(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
 {
        if (!(p = nlm4_decode_cookie(p, &resp->cookie)))
                return -EIO;
-       resp->status = ntohl(*p++);
-       if (resp->status == NLM_LCK_DENIED) {
+       resp->status = *p++;
+       if (resp->status == nlm_lck_denied) {
                struct file_lock        *fl = &resp->lock.fl;
                u32                     excl;
                s64                     start, end, len;
@@ -512,21 +512,28 @@ nlm4clt_decode_res(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
 {
        if (!(p = nlm4_decode_cookie(p, &resp->cookie)))
                return -EIO;
-       resp->status = ntohl(*p++);
+       resp->status = *p++;
        return 0;
 }
 
+#if (NLMCLNT_OHSIZE > XDR_MAX_NETOBJ)
+#  error "NLM host name cannot be larger than XDR_MAX_NETOBJ!"
+#endif
+
+#if (NLMCLNT_OHSIZE > NLM_MAXSTRLEN)
+#  error "NLM host name cannot be larger than NLM's maximum string length!"
+#endif
+
 /*
  * Buffer requirements for NLM
  */
 #define NLM4_void_sz           0
 #define NLM4_cookie_sz         1+XDR_QUADLEN(NLM_MAXCOOKIELEN)
-#define NLM4_caller_sz         1+XDR_QUADLEN(NLM_MAXSTRLEN)
-#define NLM4_netobj_sz         1+XDR_QUADLEN(XDR_MAX_NETOBJ)
-/* #define NLM4_owner_sz               1+XDR_QUADLEN(NLM4_MAXOWNER) */
+#define NLM4_caller_sz         1+XDR_QUADLEN(NLMCLNT_OHSIZE)
+#define NLM4_owner_sz          1+XDR_QUADLEN(NLMCLNT_OHSIZE)
 #define NLM4_fhandle_sz                1+XDR_QUADLEN(NFS3_FHSIZE)
-#define NLM4_lock_sz           5+NLM4_caller_sz+NLM4_netobj_sz+NLM4_fhandle_sz
-#define NLM4_holder_sz         6+NLM4_netobj_sz
+#define NLM4_lock_sz           5+NLM4_caller_sz+NLM4_owner_sz+NLM4_fhandle_sz
+#define NLM4_holder_sz         6+NLM4_owner_sz
 
 #define NLM4_testargs_sz       NLM4_cookie_sz+1+NLM4_lock_sz
 #define NLM4_lockargs_sz       NLM4_cookie_sz+4+NLM4_lock_sz
@@ -537,10 +544,6 @@ nlm4clt_decode_res(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
 #define NLM4_res_sz            NLM4_cookie_sz+1
 #define NLM4_norep_sz          0
 
-#ifndef MAX
-# define MAX(a,b)              (((a) > (b))? (a) : (b))
-#endif
-
 /*
  * For NLM, a void procedure really returns nothing
  */
@@ -551,7 +554,8 @@ nlm4clt_decode_res(struct rpc_rqst *req, __be32 *p, struct nlm_res *resp)
        .p_proc      = NLMPROC_##proc,                                  \
        .p_encode    = (kxdrproc_t) nlm4clt_encode_##argtype,           \
        .p_decode    = (kxdrproc_t) nlm4clt_decode_##restype,           \
-       .p_bufsiz    = MAX(NLM4_##argtype##_sz, NLM4_##restype##_sz) << 2,      \
+       .p_arglen    = NLM4_##argtype##_sz,                             \
+       .p_replen    = NLM4_##restype##_sz,                             \
        .p_statidx   = NLMPROC_##proc,                                  \
        .p_name      = #proc,                                           \
        }