xdr_truncate_encode (9) - Linux Man Pages
xdr_truncate_encode: truncate an encode buffer
xdr_truncate_encode - truncate an encode buffer
void xdr_truncate_encode(struct xdr_stream
*xdr, size_t len);
- pointer to xdr_stream
- new length of buffer
Truncates the xdr stream, so that xdr->buf->len == len, and xdr->p points at offset len from the start of the buffer, and head, tail, and page lengths are adjusted to correspond.
If this means moving xdr->p to a different buffer, we assume that that the end pointer should be set to the end of the current page, except in the case of the head buffer when we assume the head buffer's current length represents the end of the available buffer.
This is *not* safe to use on a buffer that already has inlined page cache pages (as in a zero-copy server read reply), except for the simple case of truncating from one position in the tail to another.