unpack_fields_u16(9)
π unpack_fields_u16(9) β Kernel API Manual, but make it make sense
okay bestie, so this page lives in the Kernel API Manual and it's all about unpack_fields_u16 β literally the function that takes a packed buffer and unpacks an array of fields out of it. that's the whole vibe. let's get into it π
β¨ SYNOPSIS β¨
void unpack_fields_u16 (const void *pbuf , size_t pbuflen , void
*ustruct , const struct packed_field_u16 *fields , size_t num_fields ,
u8 quirks );
like, look at all those parameters. she's got range. π
π«Ά ARGUMENTS π«Ά
pbufβ pointer to the buffer that's holding the packed value. the raw material, the before picture. π¦pbuflenβ the length in bytes of the packed buffer thatpbufpoints at. gotta know how much you're working with, fr fr.ustructβ pointer to the CPU-readable structure that's gonna hold the unpacked value. and yeah, it's expected (but like, not checked bestie, it is NOT checked) that this has the same data type as all thestruct packed_field_u16definitions. so. keep that in mind. πfieldsβ array ofpacked_field_u16field definitions. they must not overlap. no cap, no overlapping, that's the rule. π«num_fieldsβ the length of thefieldsarray. how many field defs you're carting in.quirksβ a bit mask made ofQUIRK_LITTLE_ENDIAN,QUIRK_LSW32_IS_FIRST, andQUIRK_MSB_ON_THE_RIGHT. the endianness lore, iykyk. β
πΈ DESCRIPTION πΈ
so here's the tea: use the unpack_fields macro instead of calling this directly. that's it. that's the whole description. she's short and she knows it. π
π¦ SEE ALSO π¦
the kernel file ./lib/packing.c is where the magic lives, and you should also go look at:
calculate_box_addr(9)pack(9)unpack(9)packing(9)pack_fields_u8(9)pack_fields_u16(9)unpack_fields_u8(9)
go read them. be curious. main character energy. π
mwah π that's the page! this icon was brought to you by the ./lib source, October 2026 edition β slay, date her, she's iconic. πβ¨
π¦ 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