STRUCT COMEDI_BUF_MAP(9)
β¨ struct comedi_buf_map(9) β¨
okay so bestie, welcome to the Kernel API Manual π
today we're looking at struct comedi_buf_map(9) β literally the little struct that's like "hey, lemme describe the pages in a COMEDI buffer" π«Ά
πΈ NAME πΈ
struct comedi_buf_map β Describe pages in a COMEDI buffer
π SYNOPSIS π
struct comedi_buf_map {
struct device *dma_hw_dev;
struct comedi_buf_page *page_list;
unsigned int n_pages;
enum dma_data_direction dma_dir;
struct kref refcount;
};
π Members π
dma_hw_devβ a low-level hardwarestruct devicepointer, and it's literally copied straight from the COMEDI device'shw_devmember. no cap, it's a copy π§page_listβ pointer to an array ofstruct comedi_buf_page, one for each page in the buffer. one page, one entry, iconic behaviour βn_pagesβ the number of pages in the buffer. that's the count, periodt π₯dma_dirβ the DMA direction used to allocate pages of DMA coherent memory, orDMA_NONEif the pages were allocated from regular memory πrefcountβ astruct krefreference counter used to free the buffer. this is the little guardian angel of cleanup π
π¦ Description π¦
A COMEDI data buffer is allocated as individual pages, either in conventional memory or DMA coherent memory, depending on the attached, low-level hardware device. it's giving "pages, not one big blob" energy π
The buffer is normally freed when the COMEDI device is detached from the low-level driver (which may happen due to device removal), but if it happens to be mmapped at the time, the pages cannot be freed until the buffer has been munmapped. that is what the reference counter is for β not me explaining lifetime management in a group chat ππ
fr fr, that refcount is the whole plot twist: it's what lets the pages stick around until nobody's mmapping them anymore.
π SEE ALSO π
Kernel file ./include/linux/comedi/comedidev.h struct comedi_subdevice(9), struct comedi_buf_page(9), struct comedi_async(9), enum comedi_cb(9), struct comedi_driver(9), struct comedi_device(9), struct comedi_lrange(9), comedi_range_is_bipolar(9), comedi_range_is_unipolar(9), comedi_range_is_external(9), comedi_chan_range_is_bipolar(9), comedi_chan_range_is_unipolar(9), comedi_chan_range_is_external(9), comedi_offset_munge(9), comedi_bytes_per_sample(9), comedi_sample_shift(9), comedi_bytes_to_samples(9), comedi_samples_to_bytes(9), comedi_check_trigger_src(9), comedi_check_trigger_is_unique(9), comedi_check_trigger_arg_is(9), comedi_check_trigger_arg_min(9), comedi_check_trigger_arg_max(9), comedi_buf_n_bytes_ready(9), __comedi_request_region(9), comedi_request_region(9), module_comedi_driver(9) π
β¨
and that's the whole page, bestie π this one's from the Kernel file ./include/linux/comedi, dated October 2026, and the title is struct comedi_buf_map(9). go read the source, ily, bye ππ
π¦ 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