ENUM BUF_END_ALIGN_TYPE(9)
π enum buf_end_align_type(9) π
ok so bestie, this is a page from the Kernel API Manual and it's literally all about enum buf_end_align_type β which is honestly such a main character name. it's about how a buffer's end lines up with pages, relative to where the previous buffer ended. page alignment drama, basically. let's get into it π
β¨ NAME β¨
enum buf_end_align_type β page alignment of a buffer end with regard to the end of the previous buffer. that's it, that's the vibe π¦
β¨ SYNOPSIS β¨
enum buf_end_align_type {
SAME_PAGE_UNALIGNED ,
SAME_PAGE_ALIGNED ,
NEXT_PAGE_UNALIGNED ,
NEXT_PAGE_ALIGNED ,
NEXT_NEXT_UNALIGNED ,
LOOP_END
};
β¨ Constants β¨
okay so here's the whole cast of characters, one by one π
SAME_PAGE_UNALIGNEDβ the end of this buffer is on the same page as the end of the previous buffer, and it is not page aligned. examples:buf1 ][ buf2 ][ ...andbuf1 ]|[ buf2 ][ ...πSAME_PAGE_ALIGNEDβ so when the end of the previous buffer is not page aligned, the end of this buffer is on the same page as the end of the previous buffer and it is page aligned. but when the previous buffer is page aligned, the end of this buffer is aligned to the next page boundary. examples:buf1 ][ buf2 ]| ...andbuf1 ]|[ buf2 ]| ...β¨NEXT_PAGE_UNALIGNEDβ the end of this buffer is on the page next to the end of the previous buffer, and it is not page aligned. examples:buf1 ][ buf2 | buf2 ][ ...andbuf1 ]|[ buf2 | buf2 ][ ...πΈNEXT_PAGE_ALIGNEDβ the end of this buffer is on the page next to the end of the previous buffer, and it is page aligned. examples:buf1 ][ buf2 | buf2 ]| ...andbuf1 ]|[ buf2 | buf2 ]| ...π₯NEXT_NEXT_UNALIGNEDβ the end of this buffer is on the page that follows the page after the end of the previous buffer, and it is not page aligned. examples:buf1 ][ buf2 | buf2 | buf2 ][ ...andbuf1 ]|[ buf2 | buf2 | buf2 ][ ...π (yes the name is a mouthful, no I will not be shortening it)LOOP_ENDβ the number of enum values inbuf_end_align_type. it's used for controlling loop termination. so like, it's the "we're done here" counter π«Ά
π Description π
in the pictures below, buf2 refers to the buffer we are aligning. buf1 refers to the previous buffer by addr. symbol [ means the start of a buffer, ] means the end of a buffer, and | means page boundaries. iykyk π«
ngl the symbols are doing a lot of heavy lifting here, so stare at those little diagrams until the alignment clicks. it's giving "ascii art but make it kernel" π¨
π¦ SEE ALSO π¦
- Kernel file
./drivers/android/tests/binder_alloc_kunit.c binder_alloc_exhaustive_test(9)
okay periodt, that's the whole page bestie, you're officially an alignment expert now π
and for the cute sign-off: this gem comes from ./drivers/android/tests and it's dated October 2026 β so yeah, future vibes. 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