rsc_table_for_each_entry(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ rsc_table_for_each_entry(9) ✨

okay bestie, so this is a page from the Kernel API Manual β€” yes, the kernel API manual, we're in that part of the docs today, and honestly? it's giving "I read headers for fun" and I respect it πŸ’…


🌸 NAME 🌸

rsc_table_for_each_entry β€” iterate over all entries in a resource table

like, every single one. no skipping. no cap. 🫢


πŸŽ€ SYNOPSIS πŸŽ€

int rsc_table_for_each_entry (struct resource_table *table , size_t
table_sz , struct device *dev , int (*cb)(u32 type, void *rsc, int
offset, int avail, void *data) , void *data );

she's a long one, but she's iconic for it πŸ”₯


πŸ¦‹ ARGUMENTS πŸ¦‹

  • table β€” pointer to the resource table. the main character of this whole operation, fr.
  • table_sz β€” total size of the table buffer in bytes. know your limits, queen.
  • dev β€” device used for error logging. when things go wrong, she's the one who files the report 😭
  • cb β€” callback invoked for each entry. lemme break down her whole signature for you, because it's a lot:
    • type β€” value from enum fw_resource_type
    • rsc β€” pointer to the entry payload (past struct fw_rsc_hdr)
    • offset β€” byte offset of the payload within the table; callers that write back into the table (e.g. to record a dynamically allocated address) use this to locate the entry for later update
    • avail β€” bytes available in the payload
    • data β€” caller-supplied private pointer
    • Return 0 to continue iteration, non-zero to stop. like a vibe check per entry ✨
  • data β€” private pointer forwarded to cb on every call. she gets passed along every single time, no gatekeeping πŸ’œ

πŸ‘‘ DESCRIPTION πŸ‘‘

So what she actually does: iterates over every resource entry in table, performing the standard truncation check, and invokes cb for each one. that's it. that's the whole job.

Iteration stops on the first non-zero return from cb or on a malformed table. so either your callback says "enough 😀" or the table itself is broken β€” either way, we're done.

Return values, because you know I'd never leave you guessing:

  • 0 β€” after a complete iteration. we ran the whole thing, ate, left no crumbs πŸ“
  • -EINVAL β€” if the table is truncated. that table got cut off mid-sentence and we are not about to guess the rest πŸ’€
  • the first non-zero value returned by cb β€” your callback called it, so that's the answer we're shipping back

🌈 SEE ALSO 🌈

Kernel file ./include/linux/rsc_table.h

  • struct resource_table(9)
  • struct fw_rsc_hdr(9)
  • enum fw_resource_type(9)
  • struct fw_rsc_carveout(9)
  • struct fw_rsc_devmem(9)
  • struct fw_rsc_trace(9)
  • struct fw_rsc_vdev_vring(9)
  • struct fw_rsc_vdev(9)

that's the whole friend group right there, go say hi 🧚


ngl bestie, if you're writing back into the table mid-iteration, that offset argument is your bestie too β€” it's literally there so you can find that entry again later. use her. 🫢

okay that's the page!! one last lil sign-off β€” this one lives over in ./include/linux and it's dated October 2026, so yeah, she's from the future, we don't ask questions πŸ’–β­πŸŽ€

πŸ“¦ where this page comes from