xdr_buf_to_sg(9)
π xdr_buf_to_sg β like, the kernel-API-manual energy, but make it make sense
okay so bestie, the manual name here is xdr_buf_to_sg(9) β a kernel API page, section 9, and honestly? she's a little workhorse and we're gonna give her main character energy. β¨
πΈ NAME πΈ
xdr_buf_to_sg β populate a scatterlist from an xdr_buf range. that's the whole vibe. one job, does it well, periodt. π
π SYNOPSIS π
int xdr_buf_to_sg (const struct xdr_buf *buf , unsigned int offset ,
unsigned int len , struct scatterlist *sg , unsigned int nsg );
yes she takes five arguments and yes every single one of them matters, we're getting to that π«Ά
β¨ ARGUMENTS β¨
bufβ thexdr_bufwe're mapping. the source of truth, the moment, the blueprint πoffsetβ starting byte offset withinbuf. like where in the buf we're starting, bestie, not where in the worldlenβ number of bytes to cover. exactly this many, no more no less π―sgβ the scatterlist array, and ngl it has to be pre-initialized withsg_init_tableβ do not skip that step, it's giving prerequisitesnsgβ how many entries you actually have available insg. the budget. the limit. respect it π
π¦ DESCRIPTION π¦
so the thing to know, and this is the iconique detail: sg is traversed with sg_next, which means callers can absolutely pass a list that was assembled with sg_chain. like, chained lists? valid. welcome. we love that for you. π
π₯ RETURN π₯
- success β you get back the number of scatterlist entries used, and the last used entry is marked with
sg_mark_endso everyone knows where the party ends π - failure β a negative
errno. that's it. that's the whole sad moment π
π SEE ALSO π
okay this list is literally the entire xdr.c friend group, no cap. the kernel file is ./net/sunrpc/xdr.c and here's everybody:
xdr_encode_opaque_fixed(9), xdr_encode_opaque(9), xdr_terminate_string(9), xdr_buf_to_bvec(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_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β¦ that's the whole group chat. say hi. π
also a tiny reminder to my fellow scatterlist girlies:sg_init_tableonsgbefore you call, and keepnsghonest, because this function is not here to save you from yourself π
πΈ okay bye bestie, go populate some scatterlists πΈ
source/version: ./net/sunrpc Β· date: October 2026 β and that's the sign-off, mwah π π
π¦ 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