Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
params.c File Reference
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/errno.h>
#include <linux/module.h>
#include <linux/device.h>
#include <linux/err.h>
#include <linux/slab.h>
#include <linux/ctype.h>

Go to the source code of this file.

Data Structures

struct  kmalloced_param
 
struct  param_attribute
 
struct  module_param_attrs
 

Macros

#define STANDARD_PARAM_DEF(name, type, format, tmptype, strtolfn)
 
#define to_module_attr(n)   container_of(n, struct module_attribute, attr)
 
#define to_module_kobject(n)   container_of(n, struct module_kobject, kobj)
 
#define __modinit   __init
 

Functions

bool parameqn (const char *a, const char *b, size_t n)
 
bool parameq (const char *a, const char *b)
 
int parse_args (const char *doing, char *args, const struct kernel_param *params, unsigned num, s16 min_level, s16 max_level, int(*unknown)(char *param, char *val, const char *doing))
 
 STANDARD_PARAM_DEF (byte, unsigned char,"%c", unsigned long, strict_strtoul)
 
 STANDARD_PARAM_DEF (short, short,"%hi", long, strict_strtol)
 
 STANDARD_PARAM_DEF (ushort, unsigned short,"%hu", unsigned long, strict_strtoul)
 
 STANDARD_PARAM_DEF (int, int,"%i", long, strict_strtol)
 
 STANDARD_PARAM_DEF (uint, unsigned int,"%u", unsigned long, strict_strtoul)
 
 STANDARD_PARAM_DEF (long, long,"%li", long, strict_strtol)
 
 STANDARD_PARAM_DEF (ulong, unsigned long,"%lu", unsigned long, strict_strtoul)
 
int param_set_charp (const char *val, const struct kernel_param *kp)
 
 EXPORT_SYMBOL (param_set_charp)
 
int param_get_charp (char *buffer, const struct kernel_param *kp)
 
 EXPORT_SYMBOL (param_get_charp)
 
 EXPORT_SYMBOL (param_ops_charp)
 
int param_set_bool (const char *val, const struct kernel_param *kp)
 
 EXPORT_SYMBOL (param_set_bool)
 
int param_get_bool (char *buffer, const struct kernel_param *kp)
 
 EXPORT_SYMBOL (param_get_bool)
 
 EXPORT_SYMBOL (param_ops_bool)
 
int param_set_invbool (const char *val, const struct kernel_param *kp)
 
 EXPORT_SYMBOL (param_set_invbool)
 
int param_get_invbool (char *buffer, const struct kernel_param *kp)
 
 EXPORT_SYMBOL (param_get_invbool)
 
 EXPORT_SYMBOL (param_ops_invbool)
 
int param_set_bint (const char *val, const struct kernel_param *kp)
 
 EXPORT_SYMBOL (param_set_bint)
 
 EXPORT_SYMBOL (param_ops_bint)
 
 EXPORT_SYMBOL (param_array_ops)
 
int param_set_copystring (const char *val, const struct kernel_param *kp)
 
 EXPORT_SYMBOL (param_set_copystring)
 
int param_get_string (char *buffer, const struct kernel_param *kp)
 
 EXPORT_SYMBOL (param_get_string)
 
 EXPORT_SYMBOL (param_ops_string)
 

Variables

struct kernel_param_ops param_ops_charp
 
struct kernel_param_ops param_ops_bool
 
struct kernel_param_ops param_ops_invbool
 
struct kernel_param_ops param_ops_bint
 
struct kernel_param_ops param_array_ops
 
struct kernel_param_ops param_ops_string
 
struct kernel_param __start___param []
 
struct kernel_param __stop___param []
 

Macro Definition Documentation

#define __modinit   __init

Definition at line 566 of file params.c.

#define STANDARD_PARAM_DEF (   name,
  type,
  format,
  tmptype,
  strtolfn 
)
Value:
int param_set_##name(const char *val, const struct kernel_param *kp) \
{ \
tmptype l; \
int ret; \
\
ret = strtolfn(val, 0, &l); \
if (ret < 0 || ((type)l != l)) \
return ret < 0 ? ret : -EINVAL; \
*((type *)kp->arg) = l; \
return 0; \
} \
int param_get_##name(char *buffer, const struct kernel_param *kp) \
{ \
return sprintf(buffer, format, *((type *)kp->arg)); \
} \
struct kernel_param_ops param_ops_##name = { \
.set = param_set_##name, \
.get = param_get_##name, \
}; \
EXPORT_SYMBOL(param_set_##name); \
EXPORT_SYMBOL(param_get_##name); \
EXPORT_SYMBOL(param_ops_##name)

Definition at line 230 of file params.c.

#define to_module_attr (   n)    container_of(n, struct module_attribute, attr)

Definition at line 503 of file params.c.

#define to_module_kobject (   n)    container_of(n, struct module_kobject, kobj)

Definition at line 504 of file params.c.

Function Documentation

EXPORT_SYMBOL ( param_set_charp  )
EXPORT_SYMBOL ( param_get_charp  )
EXPORT_SYMBOL ( param_ops_charp  )
EXPORT_SYMBOL ( param_set_bool  )
EXPORT_SYMBOL ( param_get_bool  )
EXPORT_SYMBOL ( param_ops_bool  )
EXPORT_SYMBOL ( param_set_invbool  )
EXPORT_SYMBOL ( param_get_invbool  )
EXPORT_SYMBOL ( param_ops_invbool  )
EXPORT_SYMBOL ( param_set_bint  )
EXPORT_SYMBOL ( param_ops_bint  )
EXPORT_SYMBOL ( param_array_ops  )
EXPORT_SYMBOL ( param_set_copystring  )
EXPORT_SYMBOL ( param_get_string  )
EXPORT_SYMBOL ( param_ops_string  )
int param_get_bool ( char buffer,
const struct kernel_param kp 
)

Definition at line 315 of file params.c.

int param_get_charp ( char buffer,
const struct kernel_param kp 
)

Definition at line 286 of file params.c.

int param_get_invbool ( char buffer,
const struct kernel_param kp 
)

Definition at line 343 of file params.c.

int param_get_string ( char buffer,
const struct kernel_param kp 
)

Definition at line 489 of file params.c.

int param_set_bint ( const char val,
const struct kernel_param kp 
)

Definition at line 355 of file params.c.

int param_set_bool ( const char val,
const struct kernel_param kp 
)

Definition at line 305 of file params.c.

int param_set_charp ( const char val,
const struct kernel_param kp 
)

Definition at line 263 of file params.c.

int param_set_copystring ( const char val,
const struct kernel_param kp 
)

Definition at line 475 of file params.c.

int param_set_invbool ( const char val,
const struct kernel_param kp 
)

Definition at line 329 of file params.c.

bool parameq ( const char a,
const char b 
)

Definition at line 81 of file params.c.

bool parameqn ( const char a,
const char b,
size_t  n 
)

Definition at line 70 of file params.c.

int parse_args ( const char doing,
char args,
const struct kernel_param params,
unsigned  num,
s16  min_level,
s16  max_level,
int(*)(char *param, char *val, const char *doing)  unknown 
)

Definition at line 180 of file params.c.

STANDARD_PARAM_DEF ( byte  ,
unsigned  char,
"%c"  ,
unsigned  long,
strict_strtoul   
)
STANDARD_PARAM_DEF ( short  ,
short  ,
"%hi"  ,
long  ,
strict_strtol   
)
STANDARD_PARAM_DEF ( ushort  ,
unsigned  short,
"%hu"  ,
unsigned  long,
strict_strtoul   
)
STANDARD_PARAM_DEF ( int  ,
int  ,
"%i"  ,
long  ,
strict_strtol   
)
STANDARD_PARAM_DEF ( uint  ,
unsigned  int,
"%u"  ,
unsigned  long,
strict_strtoul   
)
STANDARD_PARAM_DEF ( long  ,
long  ,
"%li"  ,
long  ,
strict_strtol   
)
STANDARD_PARAM_DEF ( ulong  ,
unsigned  long,
"%lu"  ,
unsigned  long,
strict_strtoul   
)

Variable Documentation

struct kernel_param __start___param[]
struct kernel_param __stop___param[]
struct kernel_param_ops param_array_ops
Initial value:
= {
.set = param_array_set,
.get = param_array_get,
.free = param_array_free,
}

Definition at line 468 of file params.c.

struct kernel_param_ops param_ops_bint
Initial value:
= {
.get = param_get_int,
}

Definition at line 372 of file params.c.

struct kernel_param_ops param_ops_bool
Initial value:
= {
}

Definition at line 322 of file params.c.

struct kernel_param_ops param_ops_charp
Initial value:
= {
.free = param_free_charp,
}

Definition at line 297 of file params.c.

struct kernel_param_ops param_ops_invbool
Initial value:
= {
}

Definition at line 349 of file params.c.

struct kernel_param_ops param_ops_string
Initial value:
= {
}

Definition at line 496 of file params.c.