As a user program does, a kernel module can accept arguments from the command line. This allows dynamically changing the behavior of the module according to given parameters, and can help the developer not having to indefinitely change/compile the module during a test/debug session. In order to set this up, you should first declare the variables that will hold the values of command line arguments, and use the module_param() macro on each of these. The macro is defined in include/linux/moduleparam.h (this should be included in the code too: #include <linux/moduleparam.h>), shown as follows:
module_param(name, type, perm);
This macro contains the following elements:
- name: The name of the variable used as the parameter
- type: The parameter's type (bool, charp, byte, short, ushort, int, uint, long, ulong), where charp stands for char pointer
- perm: This...