ethnl_update_u8_u32(9)
π ethnl_update_u8_u32
okay bestie so real quick, this one lives in the Kernel API Manual β like, kernel-core, netlink-adjacent, the whole vibe. it's a tiny little helper for pulling a u8 out of an NLA_U32 attribute, and honestly? it's giving "small function, big responsibility." π
β¨ NAME β¨
ethnl_update_u8_u32 β update a u8 value from an NLA_U32 attribute, slay π
πΈ SYNOPSIS πΈ
void ethnl_update_u8_u32 (u8 *dst , const struct nlattr *attr , bool *mod );
that's it, that's the whole signature, look at her go π¦
π«Ά ARGUMENTS π«Ά
dstβ the value you're updating. this is the baby that gets written to, ok so be nice to her.attrβ the netlink attribute carrying the new value, or null. yes, null is allowed, we'll get to that. πmodβ pointer to aboolfor modification tracking. she's the receipts. she remembers if anything actually changed. π
π§ DESCRIPTION π§
okay so picture this: some attributes are NLA_U32 on the wire but they're stored in a u8 in memory. mismatch city. not a vibe. that's literally the entire reason this function exists. π₯
so what she does: she reads that full 32-bit value from the NLA_U32 netlink attribute attr and narrows it down into the u8 pointed to by dst. narrowing, but make it cute. and if attr is null? she does nothing. absolute queen behavior, knows when to not act. β¨
meanwhile the bool pointed to by mod gets set to true if this function changed the value of *dst β and if it didn't change anything, mod is just left as is. not touched, not judged, left alone. π
no cap: the narrowing is real, so lowkey keep that in mind. she's not preserving all 32 bits, that's the whole point of the u8. π
π SEE ALSO π
- the kernel file
./net/ethtool/netlink.hβ go read her, iykyk π ethnl_strz_size(9)ethnl_put_strz(9)ethnl_update_u32(9)ethnl_update_u8(9)ethnl_update_bool32(9)ethnl_update_bool(9)ethnl_update_binary(9)ethnl_update_bitfield32(9)ethnl_reply_header_size(9)struct ethnl_req_info(9)ethnl_req_get_phydev(9)struct ethnl_reply_data(9)struct ethnl_request_ops(9)
the whole friend group fr fr, go say hi π
mwah, that's a wrap π β brought to you by ./net/ethtool, October 2026, main character energy only. see you in the next one, bestie π
π¦ 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