1/****************************************************************************
2 ****************************************************************************
3 ***
4 ***   This header was automatically generated from a Linux kernel header
5 ***   of the same name, to make information necessary for userspace to
6 ***   call into the kernel available to libc.  It contains only constants,
7 ***   structures, and macros generated from the original header, and thus,
8 ***   contains no copyrightable information.
9 ***
10 ****************************************************************************
11 ****************************************************************************/
12#ifndef _LINUX_MODULE_PARAMS_H
13#define _LINUX_MODULE_PARAMS_H
14
15#include <linux/init.h>
16#include <linux/stringify.h>
17#include <linux/kernel.h>
18
19#ifdef MODULE
20#define MODULE_PARAM_PREFIX
21#else
22#define MODULE_PARAM_PREFIX KBUILD_MODNAME "."
23#endif
24
25#ifdef MODULE
26#define ___module_cat(a,b) __mod_ ## a ## b
27#define __module_cat(a,b) ___module_cat(a,b)
28#define __MODULE_INFO(tag, name, info)  static const char __module_cat(name,__LINE__)[]   __attribute_used__   __attribute__((section(".modinfo"),unused)) = __stringify(tag) "=" info
29#else
30#define __MODULE_INFO(tag, name, info)
31#endif
32#define __MODULE_PARM_TYPE(name, _type)   __MODULE_INFO(parmtype, name##type, #name ":" _type)
33
34struct kernel_param;
35
36typedef int (*param_set_fn)(const char *val, struct kernel_param *kp);
37
38typedef int (*param_get_fn)(char *buffer, struct kernel_param *kp);
39
40struct kernel_param {
41 const char *name;
42 unsigned int perm;
43 param_set_fn set;
44 param_get_fn get;
45 void *arg;
46};
47
48struct kparam_string {
49 unsigned int maxlen;
50 char *string;
51};
52
53struct kparam_array
54{
55 unsigned int max;
56 unsigned int *num;
57 param_set_fn set;
58 param_get_fn get;
59 unsigned int elemsize;
60 void *elem;
61};
62
63#define __module_param_call(prefix, name, set, get, arg, perm)   static char __param_str_##name[] = prefix #name;   static struct kernel_param const __param_##name   __attribute_used__   __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *))))   = { __param_str_##name, perm, set, get, arg }
64
65#define module_param_call(name, set, get, arg, perm)   __module_param_call(MODULE_PARAM_PREFIX, name, set, get, arg, perm)
66
67#define module_param_named(name, value, type, perm)   param_check_##type(name, &(value));   module_param_call(name, param_set_##type, param_get_##type, &value, perm);   __MODULE_PARM_TYPE(name, #type)
68
69#define module_param(name, type, perm)   module_param_named(name, name, type, perm)
70
71#define module_param_string(name, string, len, perm)   static struct kparam_string __param_string_##name   = { len, string };   module_param_call(name, param_set_copystring, param_get_string,   &__param_string_##name, perm);   __MODULE_PARM_TYPE(name, "string")
72
73#define __param_check(name, p, type)   static inline type *__check_##name(void) { return(p); }
74
75#define param_check_byte(name, p) __param_check(name, p, unsigned char)
76
77#define param_check_short(name, p) __param_check(name, p, short)
78
79#define param_check_ushort(name, p) __param_check(name, p, unsigned short)
80
81#define param_check_int(name, p) __param_check(name, p, int)
82
83#define param_check_uint(name, p) __param_check(name, p, unsigned int)
84
85#define param_check_long(name, p) __param_check(name, p, long)
86
87#define param_check_ulong(name, p) __param_check(name, p, unsigned long)
88
89#define param_check_charp(name, p) __param_check(name, p, char *)
90
91#define param_check_bool(name, p) __param_check(name, p, int)
92
93#define param_check_invbool(name, p) __param_check(name, p, int)
94
95#define module_param_array_named(name, array, type, nump, perm)   static struct kparam_array __param_arr_##name   = { ARRAY_SIZE(array), nump, param_set_##type, param_get_##type,  sizeof(array[0]), array };   module_param_call(name, param_array_set, param_array_get,   &__param_arr_##name, perm);   __MODULE_PARM_TYPE(name, "array of " #type)
96
97#define module_param_array(name, type, nump, perm)   module_param_array_named(name, name, type, nump, perm)
98
99struct module;
100
101#endif
102