diff options
author | Jani Nikula <jani.nikula@intel.com> | 2014-08-26 16:53:23 -0400 |
---|---|---|
committer | Rusty Russell <rusty@rustcorp.com.au> | 2014-08-27 08:24:08 -0400 |
commit | 3baee201b06cfaff84c2c5ddc551b192bb3eaed3 (patch) | |
tree | 68d6d30786363245fb1f4d64ae74615047df9aa1 /include/linux/moduleparam.h | |
parent | 91f9d330cc14932084c37751997213cb0e7ea882 (diff) |
module: add module_param_unsafe and module_param_named_unsafe
Add the helpers to be used by modules wishing to expose unsafe debugging
or testing module parameters that taint the kernel when set.
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Li Zhong <zhong@linux.vnet.ibm.com>
Cc: Jon Mason <jon.mason@intel.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'include/linux/moduleparam.h')
-rw-r--r-- | include/linux/moduleparam.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index 1e3ffb839daa..9531f9f9729e 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
@@ -123,6 +123,12 @@ struct kparam_array | |||
123 | module_param_named(name, name, type, perm) | 123 | module_param_named(name, name, type, perm) |
124 | 124 | ||
125 | /** | 125 | /** |
126 | * module_param_unsafe - same as module_param but taints kernel | ||
127 | */ | ||
128 | #define module_param_unsafe(name, type, perm) \ | ||
129 | module_param_named_unsafe(name, name, type, perm) | ||
130 | |||
131 | /** | ||
126 | * module_param_named - typesafe helper for a renamed module/cmdline parameter | 132 | * module_param_named - typesafe helper for a renamed module/cmdline parameter |
127 | * @name: a valid C identifier which is the parameter name. | 133 | * @name: a valid C identifier which is the parameter name. |
128 | * @value: the actual lvalue to alter. | 134 | * @value: the actual lvalue to alter. |
@@ -139,6 +145,14 @@ struct kparam_array | |||
139 | __MODULE_PARM_TYPE(name, #type) | 145 | __MODULE_PARM_TYPE(name, #type) |
140 | 146 | ||
141 | /** | 147 | /** |
148 | * module_param_named_unsafe - same as module_param_named but taints kernel | ||
149 | */ | ||
150 | #define module_param_named_unsafe(name, value, type, perm) \ | ||
151 | param_check_##type(name, &(value)); \ | ||
152 | module_param_cb_unsafe(name, ¶m_ops_##type, &value, perm); \ | ||
153 | __MODULE_PARM_TYPE(name, #type) | ||
154 | |||
155 | /** | ||
142 | * module_param_cb - general callback for a module/cmdline parameter | 156 | * module_param_cb - general callback for a module/cmdline parameter |
143 | * @name: a valid C identifier which is the parameter name. | 157 | * @name: a valid C identifier which is the parameter name. |
144 | * @ops: the set & get operations for this parameter. | 158 | * @ops: the set & get operations for this parameter. |
@@ -149,6 +163,10 @@ struct kparam_array | |||
149 | #define module_param_cb(name, ops, arg, perm) \ | 163 | #define module_param_cb(name, ops, arg, perm) \ |
150 | __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0) | 164 | __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0) |
151 | 165 | ||
166 | #define module_param_cb_unsafe(name, ops, arg, perm) \ | ||
167 | __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, \ | ||
168 | KERNEL_PARAM_FL_UNSAFE) | ||
169 | |||
152 | /** | 170 | /** |
153 | * <level>_param_cb - general callback for a module/cmdline parameter | 171 | * <level>_param_cb - general callback for a module/cmdline parameter |
154 | * to be evaluated before certain initcall level | 172 | * to be evaluated before certain initcall level |