fdt_subnode_offset_namelen(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– fdt_subnode_offset_namelen β€” the "find a subnode by substring" girlie πŸ’–

okay so bestie, this one lives in the Kernel API Manual and it is genuinely so useful. it's fdt_subnode_offset_namelen, and it's basically the main character version of its sibling function that lets you match on just a slice of a name. iykyk. πŸ¦‹


✨ SYNOPSIS ✨

int fdt_subnode_offset_namelen (const void *fdt , int parentoffset ,
const char *name , int namelen );

like, look at her. four params, zero drama. πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • fdt β€” pointer to the device tree blob. yes ma'am, that's the blob. 🫢
  • parentoffset β€” structure block offset of a node. it's giving "where we're starting from" energy.
  • name β€” name of the subnode to locate. the thing you're hunting for πŸ”
  • namelen β€” number of characters of name to consider. how much of the name actually gets to count. no cap.

🌸 DESCRIPTION 🌸

so this function is identical to fdt_subnode_offset, but plot twist: it only examines the first namelen characters of name when it's matching the subnode name. 🎯

the way that's useful? literally when you wanna find subnodes based on a portion of a larger string β€” like, say, a full path. you're not matching the whole thing, just the chunk you care about, and she eats that up every single time. obsessed. πŸ”₯


⭐ RETURN ⭐

offset of the subnode β€” or, if your name doesn't show up anywhere:

-FDT_ERR_NOTFOUND

and that's the whole mood. 😭


πŸ¦‹ SEE ALSO πŸ¦‹

kernel file ./scripts/dtc/libfdt/libfdt.h, plus the whole friend group β€” she does not go anywhere without them:


ngl bestie, the -FDT_ERR_NOTFOUND return is the one thing to actually remember β€” it's not a crash, it's just her way of saying "she's not here rn." πŸ™ˆ

and that's the page!! 🧚 sign-off time: this one comes to you from ./scripts/dtc/libfdt, dated October 2026, and it's <rainbow>iconic</rainbow>. mwah πŸ’œπŸ“

πŸ“¦ where this page comes from