fw_elf_get_class(9)
β¨ fw_elf_get_class(9) β¨
okay bestie, this is a page from the Kernel API Manual and honestly? it's short, it's sweet, and it's giving "tiny helper function that carries the whole elf situation on its back" π
π NAME π
fw_elf_get_class β get elf class πΈ
like, that's it. that's the whole job. iconic behaviour honestly.
π¦ SYNOPSIS π¦
u8 fw_elf_get_class (const struct firmware *fw );
one function, one argument, returns a u8. no drama, no cap π
π ARGUMENTS π
fwβ the ELF firmware image π§ that's the thing you're passing in, bestie, and yes it's aconst struct firmware *so pls don't go mutating it, we're being polite here
π₯ DESCRIPTION π₯
okay so here's the little detail that makes this function work, and you're gonna want to remember it: it uses elf32_hdr to access the class.
wait, why? because the start of the struct is the same for both elf class π that's the whole trick β the beginning of the struct lines up identically no matter which elf class you're dealing with, so peeking at it with elf32_hdr gets you exactly what you need. lowkey clever, highkey slay β¨
so no, you're not out here needing separate paths for each class. the header prefix ate and left no crumbs π
π RETURN π
returns the elf class of the firmware π«Ά like, that's what you asked for, that's what you get, we love a straightforward queen
β SEE ALSO β
- Kernel file
./drivers/remoteproc/remoteproc_elf_helpers.hβ go read it, bestie, it's literally right there π
fr fr the whole header prefix matching thing is the bit that makes this work, so don't skip the description, okay? π
and that's the vibe check, bestie π this one's filed under ./drivers/remoteproc and dated October 2026 β shoutout to the Kernel API Manual for keeping the receipts, periodt ππ
π¦
π¦ 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