xdr_reserve_space(9)
β¨ xdr_reserve_space β¨
Okay bestie, so this one is a kernel API manual page β section 9, the whole "Kernel API Manual" vibe β and it's literally called xdr_reserve_space. It's giving "I just need a little room to write" energy, and honestly? Same.
πΈ SYNOPSIS πΈ
__be32 * xdr_reserve_space (struct xdr_stream *xdr , size_t nbytes );
That's the whole signature, no cap. It hands you back a __be32 * β a pointer you're gonna want to hold onto for approximately five seconds. π
π ARGUMENTS π
xdrβ pointer toxdr_stream. That's your stream, your main character. Everything revolves around her.nbytesβ number of bytes to reserve. How much space you're asking for, in bytes, fr fr.
π¦ DESCRIPTION π¦
So what it does is: it checks that we have enough buffer space to encode nbytes more bytes of data. That's the vibe check. If it passes β if there's room β then it updates the total xdr_buf length, and adjusts the length of the current kvec. Slay.
β οΈ Important bestie warning: the returned pointer is valid only until the next call toxdr_reserve_spaceorxdr_commit_encodeonxdr. So don't go hoarding it. It expires faster than a Snapchat streak. π
And then there's this little detail that is so important I'm putting it in its own paragraph:
The current implementation of this API guarantees that space reserved for a four-byte data item remains valid until xdr is destroyed β but that might not always be true in the future. So it's a "today yes, tomorrow maybe" kind of guarantee. Not a forever promise. Highkey a situationship. π
π₯ SEE ALSO π₯
So much lore here β the whole XDR family tree. Kernel file ./net/sunrpc/xdr.c and honestly like thirty other functions:
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_vec(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)
Like I said. The whole family. Every single one. Go read them, iykyk. π
π Okay that's the page!! It lives in ./net/sunrpc, the version tag says October 2026, and it's all xdr_reserve_space(9) from the Kernel API Manual. Mwah. Go reserve some space bestie, you've earned it. π«Άβ¨
π¦ 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