/* * Encode result of a TEST/TEST_MSG call */ static __be32 * nlm_encode_testres(__be32 *p, struct nlm_res *resp) { s32 start, len; if (!(p = nlm_encode_cookie(p, &resp->cookie))) return NULL; *p++ = resp->status; if (resp->status == nlm_lck_denied) { struct file_lock *fl = &resp->lock.fl; *p++ = (fl->fl_type == F_RDLCK)? xdr_zero : xdr_one; *p++ = htonl(resp->lock.svid); /* Encode owner handle. */ if (!(p = xdr_encode_netobj(p, &resp->lock.oh))) return NULL; start = loff_t_to_s32(fl->fl_start); if (fl->fl_end == OFFSET_MAX) len = 0; else len = loff_t_to_s32(fl->fl_end - fl->fl_start + 1); *p++ = htonl(start); *p++ = htonl(len); } return p; }
/* * Encode result of a TEST/TEST_MSG call */ static __be32 * nlm4_encode_testres(__be32 *p, struct nlm_res *resp) { s64 start, len; dprintk("xdr: before encode_testres (p %p resp %p)\n", p, resp); if (!(p = nlm4_encode_cookie(p, &resp->cookie))) return NULL; *p++ = resp->status; if (resp->status == nlm_lck_denied) { struct file_lock *fl = &resp->lock.fl; *p++ = (fl->fl_type == F_RDLCK)? xdr_zero : xdr_one; *p++ = htonl(resp->lock.svid); /* Encode owner handle. */ if (!(p = xdr_encode_netobj(p, &resp->lock.oh))) return NULL; start = loff_t_to_s64(fl->fl_start); if (fl->fl_end == OFFSET_MAX) len = 0; else len = loff_t_to_s64(fl->fl_end - fl->fl_start + 1); p = xdr_encode_hyper(p, start); p = xdr_encode_hyper(p, len); dprintk("xdr: encode_testres (status %u pid %d type %d start %Ld end %Ld)\n", resp->status, (int)resp->lock.svid, fl->fl_type, (long long)fl->fl_start, (long long)fl->fl_end); } dprintk("xdr: after encode_testres (p %p resp %p)\n", p, resp); return p; }
static inline __be32 * nlm_encode_oh(__be32 *p, struct xdr_netobj *oh) { return xdr_encode_netobj(p, oh); }
static u32 * nlm4_encode_oh(u32 *p, struct xdr_netobj *oh) { return xdr_encode_netobj(p, oh); }