_shift_data_left_pages(9)
πΈ _shift_data_left_pages β a Kernel API Manual moment πΈ
okay bestie, so this is a page from the Kernel API Manual (that's the (9) bit, section 9, kernel developer vibes π
). It's called _shift_data_left_pages and honestly? It's giving "small but mighty helper function" energy. Let's get into it π«Ά
β¨ NAME β¨
_shift_data_left_pages β
so likeβ¦ the original page literally leaves this blank after the dash π no cap, there's no description here. We move on. Main character energy is elsewhere, iykyk.
π¦ SYNOPSIS π¦
void _shift_data_left_pages (struct page **pages , size_t pgto_base ,
size_t pgfrom_base , size_t len );
that's the whole vibe: returns void, so it's not gonna hand you anything back. It just does the thing π«
π ARGUMENTS π
pagesβ the vector of pages holding both the source and the dest memory area. like, one big friend group of pages, both sides living in it πpgto_baseβ the page vector address of the destination (where the data is heading πββοΈ)pgfrom_baseβ the page vector address of the source (where the data's coming from β¨)lenβ the number of bytes to copy, bestie. count 'em. π
π NOTE π
okay this part matters, so listen up π
the addresses pgto_base and pgfrom_base are both calculated in the same way: if a memory area starts at byte base in page pages[i], then its address is given as:
(i << PAGE_CACHE_SHIFT) + base
also note (and this is the important bit, ngl): pgto_base must be < pgfrom_base β like, that's a hard requirement, not a suggestion π₯ but the memory areas they point to may overlap. so the addresses are ordered, the actual memory doesn't have to be. iconic, honestly.
π¨ read that again, bestie:pgto_basemust be less thanpgfrom_base. don't come crying to me if you flip them π
π SEE ALSO π
this is a whole friend group, fr fr β all from the kernel file ./net/sunrpc/xdr.c:
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_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 a lot of siblings. go say hi to _shift_data_right_pages(9) especially, it's literally the mirror twin πͺ
and that's the whole page, bestie π sign-off time: this one lives in ./net/sunrpc, dated October 2026, and it's filed under _shift_data_left_pages(9). slay, go shift some data. leftwards. πβ¨
π¦ 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