fw_elf_get_class(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 a const 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