module_param_array(9)
β¨ module_param_array(9) β¨
okay so bestie, we're diving into the Linux kernel API manual today and honestly? this one's kinda niche but also lowkey iconic π
it's all about making array parameters for your kernel modules, and the header file it lives in is ./include/linux, straight from the kernel source. the vibe is October 2026, so we're talking future-fresh kernel docs π¦
πΈ NAME πΈ
module_param_array β a parameter which is an array of some type
like literally, it's a module parameter but make it an array. we love a glow-up β¨
π SYNOPSIS π
module_param_array (name , type , nump , perm );
that's the whole flex, bestie β four args and you're in business π«Ά
π ARGUMENTS π
nameβ the name of the array variable. yes, the actual variable name in your code, no cap.typeβ the type, as permodule_param. so whatever type you'd use there, same energy here fr fr.numpβ optional pointer filled in with the number written. it's optional so like, no pressure, but if you pass it, it'll tell you how many got written πpermβ visibility in sysfs. this is the permission bits situation, the whole "who gets to see me" vibe check π
π¦ DESCRIPTION π¦
okay so here's the tea: input and output are as comma-separated values. that's the whole communication style, bestie β commas, commas, commas π
but β and this is important β commas inside values don't work properly (eg. an array of charp). so if your values themselves contain commas, it's giving broken, it's giving chaos, and not in a fun way ππ
also, ARRAY_SIZE(name) is used to determine the number of elements in the array, so the definition must be visible. like, the array needs to be in scope where the macro expands, or it literally cannot function. it's a whole "you need to be visible to be seen" moment, very main character energy tbh π
π SEE ALSO π
the whole squad, the entire crew, the kernel-param besties π₯:
- Kernel file
./include/linux/moduleparam.h module_param(9)module_param_unsafe(9)module_param_named(9)module_param_named_unsafe(9)module_param_cb(9)core_param_cb(9)postcore_param_cb(9)arch_param_cb(9)subsys_param_cb(9)fs_param_cb(9)device_param_cb(9)late_param_cb(9)core_param(9)core_param_unsafe(9)__core_param_cb(9)module_param_string(9)parameq(9)parameqn(9)module_param_array_named(9)module_param_hw_named(9)module_param_hw_array(9)
like I said, a whole friend group. iykyk π§ββοΈ
β quick reminder bestie: if your values have commas inside them, this macro is not gonna slay for you. that's the documented limitation, so keep it in mind π
hope that helped, bestie! go forth and parametrize those arrays π
this page is from the kernel docs in ./include/linux, dated October 2026 β catch you in the next manual page! π¦π
π¦ 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