kfifo_out_linear_ptr(9)
π kfifo_out_linear_ptr β bestie, it just hands you a pointer β¨
So this is a page from the Linux kernel API manual, kfifo_out_linear_ptr(9) β a macro in the kernel's kfifo (kernel FIFO) family, and honestly? It's giving "quietly iconic helper" energy. Let me walk you through it π«Ά
πΈ NAME πΈ
kfifo_out_linear_ptr β gets a pointer to the available data. That's it, that's the whole job. She points, you copy. π
π SYNOPSIS π
kfifo_out_linear_ptr (fifo , ptr , n );
Three args, no drama. Let's get into them π
β¨ ARGUMENTS β¨
fifoβ address of the fifo to be used. Like, which fifo are we talking about? That one. πptrβ pointer to data to store the pointer to tail. Yes bestie, it's a pointer to a pointer β the macro writes the tail pointer into whateverptrpoints at, so you get the actual address of the data back out πnβ max. number of elements to point at. The ceiling, the limit, the "no more than this please" π―
π DESCRIPTION π
Ok so real talk β this macro works similarly to kfifo_out_linear: it obtains the pointer to the available data in the fifo buffer and returns the numbers of elements available. Both things, one call. Slay.
The count it returns is the available count till the end of available data or till the end of the buffer β whichever comes first. So the data it points at is always one unbroken linear chunk, no wrap-around nonsense π ββοΈ
Which is exactly why the manpage says it can be used for linear data processing β like a memcpy of ptr with the count returned. Grab the pointer, grab the count, blast it with memcpy. Chef's kiss. π₯
π The locking tea: with only one concurrent reader and one concurrent writer, you don't need extra locking to use these macro. One reader, one writer? You're chilling, no lock needed. Anything more chaotic than that and you're on your own, bestie β the page does not promise you anything else.
π SEE ALSO π
The whole kfifo friend group lives in the kernel file ./include/linux/kfifo.h β go say hi π
DECLARE_KFIFO_PTR(9)DECLARE_KFIFO(9)INIT_KFIFO(9)DEFINE_KFIFO(9)kfifo_initialized(9)kfifo_esize(9)kfifo_recsize(9)kfifo_size(9)kfifo_reset(9)kfifo_reset_out(9)kfifo_len(9)kfifo_is_empty(9)kfifo_is_empty_spinlocked(9)kfifo_is_empty_spinlocked_noirqsave(9)kfifo_is_full(9)kfifo_avail(9)kfifo_skip_count(9)kfifo_skip(9)kfifo_peek_len(9)kfifo_alloc(9)kfifo_alloc_node(9)kfifo_free(9)kfifo_init(9)kfifo_put(9)kfifo_get(9)kfifo_peek(9)kfifo_in(9)kfifo_in_spinlocked(9)kfifo_in_spinlocked_noirqsave(9)kfifo_out(9)kfifo_out_spinlocked(9)kfifo_out_spinlocked_noirqsave(9)kfifo_from_user(9)kfifo_to_user(9)kfifo_dma_in_prepare_mapped(9)kfifo_dma_in_finish(9)kfifo_dma_out_prepare_mapped(9)kfifo_dma_out_finish(9)kfifo_out_peek(9)kfifo_out_linear(9)
That's the whole page, no crumbs left behind π
Sign-off time, bestie π§ β this one's dated October 2026, it lives in ./include/linux, and it's part of the Kernel API Manual. Go get that pointer. Periodt. π
β¨
π¦ 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