9 #include <linux/types.h>
10 #include <linux/sched.h>
11 #include <linux/nfs.h>
19 #define NLMDBG_FACILITY NLMDBG_XDR
29 loff_t_to_s32(loff_t
offset)
63 dprintk(
"lockd: bad cookie size %d (only cookies under "
64 "%d bytes are supported.)\n",
76 p+=XDR_QUADLEN(c->
len);
86 dprintk(
"lockd: bad fhandle size %d (should be %d)\n",
108 nlm_decode_oh(
__be32 *p,
struct xdr_netobj *oh)
114 nlm_encode_oh(
__be32 *p,
struct xdr_netobj *oh)
128 || !(p = nlm_decode_fh(p, &lock->
fh))
129 || !(p = nlm_decode_oh(p, &lock->
oh)))
140 end = start + len - 1;
142 fl->
fl_start = s32_to_loff_t(start);
144 if (len == 0 || end < 0)
147 fl->
fl_end = s32_to_loff_t(end);
159 if (!(p = nlm_encode_cookie(p, &resp->
cookie)))
173 start = loff_t_to_s32(fl->
fl_start);
195 if (!(p = nlm_decode_cookie(p, &argp->
cookie)))
198 exclusive =
ntohl(*p++);
199 if (!(p = nlm_decode_lock(p, &argp->
lock)))
204 return xdr_argsize_check(rqstp, p);
210 if (!(p = nlm_encode_testres(p, resp)))
212 return xdr_ressize_check(rqstp, p);
220 if (!(p = nlm_decode_cookie(p, &argp->
cookie)))
223 exclusive =
ntohl(*p++);
224 if (!(p = nlm_decode_lock(p, &argp->
lock)))
232 return xdr_argsize_check(rqstp, p);
240 if (!(p = nlm_decode_cookie(p, &argp->
cookie)))
243 exclusive =
ntohl(*p++);
244 if (!(p = nlm_decode_lock(p, &argp->
lock)))
248 return xdr_argsize_check(rqstp, p);
254 if (!(p = nlm_decode_cookie(p, &argp->
cookie))
255 || !(p = nlm_decode_lock(p, &argp->
lock)))
258 return xdr_argsize_check(rqstp, p);
266 memset(lock, 0,
sizeof(*lock));
271 if (!(p = nlm_decode_cookie(p, &argp->
cookie))
274 || !(p = nlm_decode_fh(p, &lock->
fh))
275 || !(p = nlm_decode_oh(p, &lock->
oh)))
279 return xdr_argsize_check(rqstp, p);
285 if (!(p = nlm_encode_cookie(p, &resp->
cookie)))
289 return xdr_ressize_check(rqstp, p);
295 if (!(p = nlm_encode_cookie(p, &resp->
cookie)))
298 return xdr_ressize_check(rqstp, p);
310 return xdr_argsize_check(rqstp, p);
321 return xdr_argsize_check(rqstp, p);
327 if (!(p = nlm_decode_cookie(p, &resp->
cookie)))
330 return xdr_argsize_check(rqstp, p);
336 return xdr_argsize_check(rqstp, p);
342 return xdr_ressize_check(rqstp, p);