xdr_truncate_encode(9)
π NAME π
okay bestie, welcome to xdr_truncate_encode(9) from the Kernel API Manual β and yes, the manual name is literally right there in the title, slay. π
xdr_truncate_encode β truncate an encode buffer
β¨ SYNOPSIS β¨
void xdr_truncate_encode (struct xdr_stream *xdr , size_t len );
π ARGUMENTS π
xdrβ pointer toxdr_streamlenβ new length of buffer
π¦ DESCRIPTION π¦
So what this does is truncate the xdr stream so that xdr->buf->len == len, and xdr->p points at offset len from the start of the buffer, and the head, tail, and page lengths are adjusted to correspond. periodt. β¨
If this means moving xdr->p to a different buffer, we assume that the end pointer should be set to the end of the current page β except in the case of the head buffer, where 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. π
π SEE ALSO π
Kernel file ./net/sunrpc/xdr.c β plus the whole friend group:
xdr_encode_opaque_fixed(9)xdr_encode_opaque(9)xdr_terminate_string(9)xdr_buf_to_bvec(9)xdr_buf_to_sg(9)xdr_buf_to_sg_alloc(9)xdr_inline_pages(9)_shift_data_left_pages(9)_shift_data_right_pages(9)_copy_to_pages(9)_copy_from_pages(9)xdr_buf_pages_zero(9)xdr_shrink_bufhead(9)xdr_shrink_pagelen(9)xdr_stream_pos(9)xdr_page_pos(9)xdr_init_encode(9)xdr_init_encode_pages(9)__xdr_commit_encode(9)xdr_reserve_space(9)xdr_reserve_space_vec(9)xdr_truncate_decode(9)xdr_restrict_buflen(9)xdr_write_pages(9)xdr_init_decode(9)xdr_init_decode_pages(9)xdr_finish_decode(9)xdr_inline_decode(9)xdr_read_pages(9)xdr_set_pagelen(9)xdr_enter_page(9)xdr_buf_subsegment(9)xdr_stream_subsegment(9)xdr_stream_move_subsegment(9)xdr_stream_zero(9)xdr_buf_trim(9)xdr_stream_decode_string_dup(9)xdr_stream_decode_opaque_auth(9)xdr_stream_encode_opaque_auth(9)
Bye bestie! π This pageβs source/version line is ./net/sunrpc, dated October 2026, and itβs the xdr_truncate_encode(9) page. β¨
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms