STRUCT POWERCAP_ZONE_CONSTRAINT_OPS(9)
π
struct powercap_zone_constraint_ops β the Kernel API Manual moment π
okay so bestie, you've stumbled into the Kernel API Manual page for struct powe...nstraint_ops(9) and honestly? it's giving "the blueprint for constraint callbacks" and we're gonna get through it together, no cap π
β¨ NAME β¨
struct powercap_zone_constraint_ops β literally the place where you Define constraint callbacks, bestie. that's the whole vibe π¦
πΈ SYNOPSIS πΈ
like, here's the whole shape of it, verbatim, don't touch a single character π
struct powercap_zone_constraint_ops {
int (*set_power_limit_uw) (struct powercap_zone *, int, u64);
int (*get_power_limit_uw) (struct powercap_zone *, int, u64 *);
int (*set_time_window_us) (struct powercap_zone *, int, u64);
int (*get_time_window_us) (struct powercap_zone *, int, u64 *);
int (*get_max_power_uw) (struct powercap_zone *, int, u64 *);
int (*get_min_power_uw) (struct powercap_zone *, int, u64 *);
int (*get_max_time_window_us) (struct powercap_zone *, int, u64 *);
int (*get_min_time_window_us) (struct powercap_zone *, int, u64 *);
const char *(*get_name) (struct powercap_zone *, int);
};
π§ Members π§
okay so every single one of these function pointers, and what it's actually about:
set_power_limit_uwβ Set power limit in micro-watts. π₯get_power_limit_uwβ Get power limit in micro-watts. πset_time_window_usβ Set time window in micro-seconds. β±οΈget_time_window_usβ Get time window in micro-seconds. β±οΈget_max_power_uwβ Get max power allowed in micro-watts. βget_min_power_uwβ Get min power allowed in micro-watts. βget_max_time_window_usβ Get max time window allowed in micro-seconds. πget_min_time_window_usβ Get min time window allowed in micro-seconds. πget_nameβ Get the name of constraint. π
Description π«Ά
so, the whole point of this structure is that it's used to define the constraint callbacks for the client drivers. main character energy, honestly π
here's the part you cannot skip β these callbacks are mandatory and can't be NULL:
set_power_limit_uwget_power_limit_uwset_time_window_usget_time_window_usget_name
β οΈ bestie listen to me. those five? mandatory. NULL? no. not happening. π
and also: client drivers should handle mutual exclusion, if required in callbacks. so like, that's on you, not on the struct, iykyk π
π SEE ALSO π
go read these next, fr fr β Kernel file ./include/linux/powercap.h:
struct powercap_control_type_ops(9)struct powercap_control_type(9)struct powercap_zone_ops(9)struct powercap_zone(9)struct powercap_zone_constraint(9)powercap_set_zone_data(9)powercap_get_zone_data(9)powercap_register_control_type(9)powercap_unregister_control_type(9)powercap_register_zone(9)powercap_unregister_zone(9)
aaaand that's the page, bestie πΈ sign-off szn: this lil masterpiece lives in ./include/linux, stamped October 2026, filed under struct powe...nstraint_ops(9) π slay, you read the whole thing, so proud of you π«Άβ¨
π¦ 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