iomap_iter_next(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’œ iomap_iter_next(9) β€” the kernel API manual, bestie edition πŸ’œ

okay so this is iomap_iter_next(9) from the Kernel API Manual and honestly? it's lowkey the glue holding your ->iomap_next callback together. let's get into it ✨


πŸŽ€ NAME πŸŽ€

iomap_iter_next β€” finish the previous mapping and produce the next one. that's it, that's the whole vibe. closing one door, opening the next πŸšͺ✨


🌸 SYNOPSIS 🌸

int iomap_iter_next (const struct iomap_iter *iter , struct iomap *iomap
, struct iomap *srcmap , iomap_iter_begin_fn begin , iomap_iter_end_fn
end );

like, five parameters, no cap. very demure, very mindful signature πŸ’…


πŸ¦‹ ARGUMENTS πŸ¦‹

  • iter β€” the iteration structure, your main character of the hour πŸ‘‘
  • iomap β€” the mapping that gets finished and then repopulated. glow-up arc fr πŸ”₯
  • srcmap β€” the source mapping, also finished and then repopulated. matching set with the one above 🫢
  • begin β€” the callback that produces a mapping for the current position. the glow-up artist 🎨
  • end β€” an optional callback that finishes the previous mapping, or NULL. optional icon behavior, we respect it πŸ™ˆ

✨ DESCRIPTION ✨

so iomap_iter_next is an inline helper that implements the common body of an ->iomap_next callback. it's giving "shared code so nobody copies and pastes the same five lines" energy 🧚

here's the little routine it runs, in order:

  1. finishes the previous mapping via end β€” but only if present πŸ’«
  2. decides via iomap_iter_continue whether to keep going πŸ€”
  3. obtains the next mapping via begin 🌈

and here's the iconic part: this helper is marked __always_inline so that when a caller passes compile-time-constant begin and end callbacks, the compiler can call them directly β€” avoiding the indirect-call overhead. literally optimizing at compile time, she's so smart πŸ˜­πŸ‘‘

Returns

  • 1 to continue iterating πŸ”
  • 0 once the range is fully consumed βœ…
  • a negative errno on error πŸ’€
bestie pls double-check which of the three you got β€” negative errno is not the same vibe as "we're done here" and you do NOT want to mix them up πŸ™

🌺 SEE ALSO 🌺

go read the whole friend group, they all hang out together πŸ«ΆπŸ’–


and that's the page!! brought to you from ./include/linux, stamped October 2026 β€” mwah, slay, periodt, go write some mappings πŸ’…πŸŽ€βœ¨

πŸ“¦ where this page comes from