STRUCT COUNTER_COMPONENT(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

okay so welcome to the Kernel API Manual, bestie β€” this page is all about struct counter_component, aka the Counter component identification situation, and it's lowkey iconic πŸ’…βœ¨

✨ SYNOPSIS ✨

Here's the whole lil struct, no cap:

struct counter_component {
    __u8 type;
    __u8 scope;
    __u8 parent;
    __u8 id;
};

πŸŽ€ Members πŸŽ€

  • type β€” component type (one of enum counter_component_type) β€” literally the type field, keeping it classified πŸ’–
  • scope β€” component scope (one of enum counter_scope) β€” it's giving scope vibes 🌸
  • parent β€” parent ID (matching the ID suffix of the respective parent sysfs path as described by the ABI documentation file Documentation/ABI/testing/sysfs-bus-counter) β€” so the parent match is documented right there, iykyk πŸ¦‹
  • id β€” component ID (matching the ID provided by the respective *_component_id sysfs attribute of the desired component) β€” find that attribute, grab the value, slay ✨

πŸ¦‹ Description πŸ¦‹

Okay so real talk: if the Count 2 ceiling extension of Counter device 4 is desired, set type equal to COUNTER_COMPONENT_EXTENSION, scope equal to COUNTER_SCOPE_COUNT, parent equal to 2, and id equal to the value provided by the respective /sys/bus/counter/devices/counter4/count2/ceiling_component_id sysfs attribute. That's the whole recipe, periodt πŸ’…πŸ”₯

πŸ’œ SEE ALSO πŸ’œ

  • Kernel file ./include/uapi/linux/counter.h β€” go peek, bestie πŸ‘€
  • struct counter_watch(9)
  • struct counter_event(9)

xoxo bestie, this page is from ./include/uapi/linux, dated October 2026 β€” that's the source/version + date sign-off, periodt πŸ’–πŸ«Ά

πŸ“¦ where this page comes from