xdr_reserve_space_vec(9)
π xdr_reserve_space_vec(9) β from the Kernel API Manual
okay so bestie, buckle up, we're doing kernel XDR today β¨ this one lives in the 9 section of the kernel API manual and it's genuinely so straightforward you'll be obsessed π«Ά
β¨ NAME β¨
xdr_reserve_space_vec β reserves a large amount of buffer space for sending π
π SYNOPSIS π
int xdr_reserve_space_vec (struct xdr_stream *xdr , size_t nbytes );
πΈ ARGUMENTS πΈ
xdrβ pointer toxdr_stream(the stream bestie in question π )nbytesβ number of bytes to reserve
π¦ DESCRIPTION π¦
so here's the vibe π the size argument that gets passed to xdr_reserve_space is determined based on the number of bytes remaining in the current page β and the whole reason for that is to avoid invalidating iov_base pointers when xdr_commit_encode is called. no cap, that's the entire point of this little guy π
Return values, fr fr:
0β success, slay π-EMSGSIZEβ not enough space is available inxdrπ
β SEE ALSO β
Kernel file ./net/sunrpc/xdr.c β plus the whole ensemble cast, and yes I'm listing every single one because they all ate π₯
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_truncate_encode(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)
π reminder bestie:-EMSGSIZEisn't a moral failure, it just means thexdrbuffer literally had no room. check your space before you go reserving, iykyk π
anyway, that's the whole page π§ this cutie is from ./net/sunrpc, dated October 2026 β go forth and reserve responsibly, periodt π
π
π¦ 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