kfifo_out_linear_ptr(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 whatever ptr points 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 πŸ’œ


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