for_each_element_completed(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… for_each_element_completed(9) β€” Kernel API Manual

okay so bestie, welcome to the for_each_element_completed page from the Kernel API Manual ✨ this one's a tiny little helper but it's lowkey carrying the whole "did we actually finish parsing" vibe check, so let's get into it 🫢


🌸 NAME 🌸

for_each_element_completed β€” determine if element parsing consumed all data

like, the whole entire point: did your element walk eat all the data or not πŸ‘€


✨ SYNOPSIS ✨

bool for_each_element_completed (const struct element *element , const
void *data , size_t datalen );

that's the whole signature, no cap πŸŽ€


πŸ¦‹ ARGUMENTS πŸ¦‹

  • element β€” the element pointer you got after for_each_element or friends ran πŸ’« like, the one you're holding at the end of the loop
  • data β€” same data pointer as passed to for_each_element or friends, fr fr, it's gotta be the same one πŸ”
  • datalen β€” same data length as passed to for_each_element or friends, again, must match the original 🌸
heads up bestie: all three have to line up with what you passed in originally, or the answer means nothing πŸ’€

🌈 RETURN 🌈

true if all elements were iterated, false otherwise β€” and pls see the notes below before you trust that false πŸ‘‘ like, the notes are the whole tea β˜•


πŸ’œ DESCRIPTION πŸ’œ

so this function returns true if all the data was parsed or considered while walking the elements πŸ”₯ iconic behaviour, honestly.

Only use this if your for_each_element loop cannot be broken out of πŸ™ˆ because if you do break out early, it always returns false β€” always, every time, no exceptions, and that's on periodt πŸ’… so don't come for this function when it's your own loop being messy.

also: if some data was malformed, this returns false 😭 because the last parsed element will not fill the whole remaining data. it's giving "leftover crumbs" energy πŸ“ the walk just couldn't reach all the way to the end.


🧚 SEE ALSO 🧚

Kernel file ./include/linux/ieee80211.h β€” and oh my god bestie the guest list is long, literally everyone showed up to this party πŸŽ€ all of these are (9) pages:


and that's the whole page bestie, you ate that 🫢

this lil gem lives in ./include/linux and the date on it is October 2026 ⭐ so yeah, slightly future-dated, main character energy fr fr πŸ’– go forth and check your parsing loops πŸ’…

πŸ“¦ where this page comes from