rsc_table_for_each_entry(9)
β¨ 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 fromenum fw_resource_typerscβ pointer to the entry payload (paststruct 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 updateavailβ bytes available in the payloaddataβ caller-supplied private pointer- Return 0 to continue iteration, non-zero to stop. like a vibe check per entry β¨
dataβ private pointer forwarded tocbon 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
- 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