buf_data_size(9)
π buf_data_size β ok bestie let's count some bytes π
hey hi hello, welcome to the Kernel API Manual entry for buf_data_size(9) π
this is the function you call when you've got a circular buffer and you're like "how much stuff is actually in there rn" β and it's gonna tell you. no cap.
β¨ SYNOPSIS β¨
u32 buf_data_size (size_t buf_size , u32 read_ptr , u32 write_ptr );
like, three args, one u32 back. that's the whole vibe. π¦
πΈ ARGUMENTS πΈ
buf_sizeβ the size of the circular buffer, yes queen, just tell her how big it is πread_ptrβ the read pointer, and psst, it's carrying an extra overflow bit with it πwrite_ptrβ the write pointer, also rocking that extra overflow bit β¨
π DESCRIPTION π
okay so here's the situation. since read_ptr and write_ptr both have that extra overflow bit tacked on, they're not straight-up indices anymore β so this function calculates the offsets from the pointers, and then uses those offsets to calculate the data size in the buffer. that's it. that's the whole job. it's giving "small function, big responsibility" energy fr fr π«Ά
β RETURN β
the number of bytes of data in the buffer π that's literally it, that's the tea
π¦ SEE ALSO π¦
kernel file ./drivers/gpu/drm/xe/xe_eu_stall.c struct β go look at her, she's iconic π
and the whole friend group, no one left out:
eu_stall_open_properties(9)xe_eu_stall_get_sampling_rates(9)xe_eu_stall_get_per_xecore_buf_size(9)xe_eu_stall_data_record_size(9)num_data_rows(9)xe_eu_stall_init(9)eu_stall_data_buf_poll(9)xe_eu_stall_stream_read_locked(9)xe_eu_stall_stream_open(9)
ok that's the whole page bestie, nothing hidden, nothing skipped π go forth and count your bytes responsibly π
and that's a wrap!! this one lives in ./drivers/gpu/drm/xe, dated October 2026 β mwah, catch you in the next manpage πππ§
π¦ 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