xdr_buf_subsegment(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’« xdr_buf_subsegment(9) β€” from the Kernel API Manual, bestie πŸ’«

okay so real talk, this is a kernel API page, and yes the manual calls itself xdr_buf_subsegment(9). we're doing this together. hold my iced coffee 🫢


✨ NAME ✨

xdr_buf_subsegment β€” set subbuf to a portion of buf 🎯


🌸 SYNOPSIS 🌸

int xdr_buf_subsegment (const struct xdr_buf *buf , struct xdr_buf
*subbuf , unsigned int base , unsigned int len );

literally the whole signature, no notes πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • buf β€” an xdr buffer (the source one, the main character)
  • subbuf β€” the result buffer, where the answer goes πŸ†
  • base β€” beginning of range in bytes
  • len β€” length of range in bytes

πŸ¦‹ DESCRIPTION πŸ¦‹

so what it does: it sets subbuf to an xdr buffer representing the portion of buf of length len starting at offset base. like slicing a piece of cake and putting it on a whole other plate 🍰

bestie-coded detail: buf and subbuf may be pointers to the same struct xdr_buf. yes, same pointer, no cap. iconic self-referential behavior πŸͺž

Returns -1 if base or length are out of bounds. that's the failure path, be aware 😭


🌈 SEE ALSO 🌈

Kernel file ./net/sunrpc/xdr.c β€” go read it, the whole friend group lives there πŸ‘‘

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_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_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)


that's the whole page, every single one of them, i counted twice πŸ’–

sign-off time: this one comes from ./net/sunrpc, dated October 2026, and the page itself is xdr_buf_subsegment(9). slay, go read your kernel source, mwah πŸ§šπŸ’œ

πŸ“¦ where this page comes from