module_param_array(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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 per module_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 πŸ”₯:

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