container_of(9)
Okay so bestie, welcome to container_of(9) from the Kernel API Manual β this is the page where you cast a member of a structure out to the containing structure, and honestly? Iconic behavior π
πΈ NAME πΈ
container_of β cast a member of a structure out to the containing structure. Periodt.
β¨ SYNOPSIS β¨
Here's the exact shape of it, no cap:
container_of (ptr , type , member );
π ARGUMENTS π
Three little besties walk into the call:
ptrβ the pointer to the member.typeβ the type of the container struct this is embedded in.memberβ the name of the member within the struct.
π₯ SEE ALSO π₯
Go peek at the kernel file ./tools/usb/usbip/libsrc/list.h β that's the spot. The related references are list_add(9), list_del(9), list_entry(9), list_for_each(9), and list_for_each_safe(9). Obsessed π«Ά
Source/version vibes: ./tools/usb/usbip/libsrc. Date on the page: October 2026. Signed with glitter, container_of(9) style πβ¨
π¦ 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