previous | start | next

Example

Place the following in the .c file for a module:

#define DRIVER_AUTHOR "Glenn Lancaster <glancast@cs.depaul.edu>"
#define DRIVER_DESC   "A module accepting command line arguments"

static int hidden = 0;
static short int myshort = 1;
static int myint = 420;
static long int mylong = 9999;
static char *mystring = "blah";
static int myintArray[2] = {5, 10};
static int arr_argc = 0;

/*
 * module_param(foo, int, 0000) 
 * foo - parameter name
 * int - parameter's data type
 * 0000 - permission bits: S_Ipq   p = R | W | X, q = USR | GRP | OTH
 */
module_param(myshort, short, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP);
MODULE_PARM_DESC(myshort, "A short integer");
module_param(myint, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
MODULE_PARM_DESC(myint, "An integer");
module_param(mylong, long, S_IRUSR);
MODULE_PARM_DESC(mylong, "A long integer");
module_param(mystring, charp, 0000);
MODULE_PARM_DESC(mystring, "A character string");


previous | start | next