Re: [PATCH 11/14] nfsd: add user xattr RPC XDR encoding/decoding logic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 12, 2020 at 12:24:18PM -0400, Chuck Lever wrote:
> > +static inline u32 nfsd4_getxattr_rsize(struct svc_rqst *rqstp,
> > +                                    struct nfsd4_op *op)
> > +{
> > +     u32 maxcount, rlen;
> > +
> > +     maxcount = svc_max_payload(rqstp);
> > +     rlen = min_t(u32, XATTR_SIZE_MAX, maxcount);
> > +
> > +     return (op_encode_hdr_size + 1 + XDR_QUADLEN(rlen)) * sizeof(__be32);
> 
> These should be added in the same patch that adds OP_GETXATTR and friends.
> 
> Also, Trond recently added xdr_align_size which I prefer over the
> use of XDR_QUADLEN in new code.

Thanks, I've squashed together those patches for this and the other reasons
you pointed out.

As for XDR_QUADLEN: that returns the 32bit-word rounded up lenghth - in words.
xdr_aligned_size returns the 32bit-word rounded up length - in bytes.

So, the result would then look something like:

	return xdr_align_size((op_encode_hdr_size * 4) + 4 + rlen);

Is that what you're suggesting?

- Frank



[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux