Lines Matching +full:c +full:- +full:define +full:- +full:name

1 /* SPDX-License-Identifier: GPL-2.0 */
3 #define _LINUX_MODULE_PARAMS_H
4 /* (C) Copyright 2001, 2002 Rusty Russell IBM Corporation */
10 module name. */
12 #define MODULE_PARAM_PREFIX /* empty */
13 #define __MODULE_INFO_PREFIX /* empty */
15 #define MODULE_PARAM_PREFIX KBUILD_MODNAME "."
17 #define __MODULE_INFO_PREFIX KBUILD_MODNAME "."
21 #define MAX_PARAM_PREFIX_LEN (64 - sizeof(unsigned long))
23 #define __MODULE_INFO(tag, name, info) \ argument
24 static const char __UNIQUE_ID(name)[] \
28 #define __MODULE_PARM_TYPE(name, _type) \ argument
29 __MODULE_INFO(parmtype, name##type, #name ":" _type)
33 #define MODULE_PARM_DESC(_parm, desc) \
41 * NOARG - the parameter allows for no argument (foo instead of foo=1)
50 /* Returns 0, or -errno. arg is in kp->arg. */
52 /* Returns length written or -errno. Buffer is 4k (ie. be short!) */
54 /* Optional function to free kp->arg when module unloaded. */
61 * UNSAFE - the parameter is dangerous and setting it will taint the kernel
62 * HWPARAM - Hardware param not permitted in lockdown mode
70 const char *name; member
102 * module_param - typesafe helper for a module/cmdline parameter
103 * @name: the variable to alter, and exposed parameter name.
107 * @name becomes the module parameter, or (prefixed by KBUILD_MODNAME and a
108 * ".") the kernel commandline parameter. Note that - is changed to _, so
109 * the user can use "foo-bar=1" even for variable "foo_bar".
112 * for world-readable, 0644 for root-writable, etc. Note that if it
124 * invbool: the above, only sense-reversed (N = true).
126 #define module_param(name, type, perm) \ argument
127 module_param_named(name, name, type, perm)
130 * module_param_unsafe - same as module_param but taints kernel
131 * @name: the variable to alter, and exposed parameter name.
135 #define module_param_unsafe(name, type, perm) \ argument
136 module_param_named_unsafe(name, name, type, perm)
139 * module_param_named - typesafe helper for a renamed module/cmdline parameter
140 * @name: a valid C identifier which is the parameter name.
145 * Usually it's a good idea to have variable names and user-exposed names the
146 * same, but that's harder if the variable must be non-static or is inside a
147 * structure. This allows exposure under a different name.
149 #define module_param_named(name, value, type, perm) \ argument
150 param_check_##type(name, &(value)); \
151 module_param_cb(name, &param_ops_##type, &value, perm); \
152 __MODULE_PARM_TYPE(name, #type)
155 * module_param_named_unsafe - same as module_param_named but taints kernel
156 * @name: a valid C identifier which is the parameter name.
161 #define module_param_named_unsafe(name, value, type, perm) \ argument
162 param_check_##type(name, &(value)); \
163 module_param_cb_unsafe(name, &param_ops_##type, &value, perm); \
164 __MODULE_PARM_TYPE(name, #type)
167 * module_param_cb - general callback for a module/cmdline parameter
168 * @name: a valid C identifier which is the parameter name.
175 #define module_param_cb(name, ops, arg, perm) \ argument
176 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0)
178 #define module_param_cb_unsafe(name, ops, arg, perm) \ argument
179 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, \
182 #define __level_param_cb(name, ops, arg, perm, level) \ argument
183 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level, 0)
185 * core_param_cb - general callback for a module/cmdline parameter
187 * @name: a valid C identifier which is the parameter name.
194 #define core_param_cb(name, ops, arg, perm) \ argument
195 __level_param_cb(name, ops, arg, perm, 1)
198 * postcore_param_cb - general callback for a module/cmdline parameter
200 * @name: a valid C identifier which is the parameter name.
207 #define postcore_param_cb(name, ops, arg, perm) \ argument
208 __level_param_cb(name, ops, arg, perm, 2)
211 * arch_param_cb - general callback for a module/cmdline parameter
213 * @name: a valid C identifier which is the parameter name.
220 #define arch_param_cb(name, ops, arg, perm) \ argument
221 __level_param_cb(name, ops, arg, perm, 3)
224 * subsys_param_cb - general callback for a module/cmdline parameter
226 * @name: a valid C identifier which is the parameter name.
233 #define subsys_param_cb(name, ops, arg, perm) \ argument
234 __level_param_cb(name, ops, arg, perm, 4)
237 * fs_param_cb - general callback for a module/cmdline parameter
239 * @name: a valid C identifier which is the parameter name.
246 #define fs_param_cb(name, ops, arg, perm) \ argument
247 __level_param_cb(name, ops, arg, perm, 5)
250 * device_param_cb - general callback for a module/cmdline parameter
252 * @name: a valid C identifier which is the parameter name.
259 #define device_param_cb(name, ops, arg, perm) \ argument
260 __level_param_cb(name, ops, arg, perm, 6)
263 * late_param_cb - general callback for a module/cmdline parameter
265 * @name: a valid C identifier which is the parameter name.
272 #define late_param_cb(name, ops, arg, perm) \ argument
273 __level_param_cb(name, ops, arg, perm, 7)
276 read-only sections (which is part of respective UNIX ABI on these
280 #define __moduleparam_const
282 #define __moduleparam_const const
287 #define __module_param_call(prefix, name, ops, arg, perm, level, flags) \ argument
289 static const char __param_str_##name[] = prefix #name; \
290 static struct kernel_param __moduleparam_const __param_##name \
293 = { __param_str_##name, THIS_MODULE, ops, \
301 #define module_param_call(name, _set, _get, arg, perm) \ argument
302 static const struct kernel_param_ops __param_ops_##name = \
305 name, &__param_ops_##name, arg, perm, -1, 0)
321 * core_param - define a historical core kernel parameter.
322 * @name: the name of the cmdline and sysfs parameter (often the same as var)
332 #define core_param(name, var, type, perm) \ argument
333 param_check_##type(name, &(var)); \
334 __module_param_call("", name, &param_ops_##type, &var, perm, -1, 0)
337 * core_param_unsafe - same as core_param but taints kernel
338 * @name: the name of the cmdline and sysfs parameter (often the same as var)
343 #define core_param_unsafe(name, var, type, perm) \ argument
344 param_check_##type(name, &(var)); \
345 __module_param_call("", name, &param_ops_##type, &var, perm, \
346 -1, KERNEL_PARAM_FL_UNSAFE)
351 * module_param_string - a char array parameter
352 * @name: the name of the parameter
360 #define module_param_string(name, string, len, perm) \ argument
361 static const struct kparam_string __param_string_##name \
363 __module_param_call(MODULE_PARAM_PREFIX, name, \
365 .str = &__param_string_##name, perm, -1, 0);\
366 __MODULE_PARM_TYPE(name, "string")
369 * parameq - checks if two parameter names match
370 * @name1: parameter name 1
371 * @name2: parameter name 2
374 * Dashes (-) are considered equal to underscores (_).
379 * parameqn - checks if two parameter names match
380 * @name1: parameter name 1
381 * @name2: parameter name 2
391 extern char *parse_args(const char *name,
410 /* The macros to do compile-time type checking stolen from Jakub
412 #define __param_check(name, p, type) \ argument
413 static inline type __always_unused *__check_##name(void) { return(p); }
418 #define param_check_byte(name, p) __param_check(name, p, unsigned char) argument
423 #define param_check_short(name, p) __param_check(name, p, short) argument
428 #define param_check_ushort(name, p) __param_check(name, p, unsigned short) argument
433 #define param_check_int(name, p) __param_check(name, p, int) argument
440 #define param_check_uint(name, p) __param_check(name, p, unsigned int) argument
445 #define param_check_long(name, p) __param_check(name, p, long) argument
450 #define param_check_ulong(name, p) __param_check(name, p, unsigned long) argument
455 #define param_check_ullong(name, p) __param_check(name, p, unsigned long long) argument
460 #define param_check_hexint(name, p) param_check_uint(name, p) argument
466 #define param_check_charp(name, p) __param_check(name, p, char *) argument
472 #define param_check_bool(name, p) __param_check(name, p, bool) argument
478 #define param_check_bool_enable_only param_check_bool
483 #define param_check_invbool(name, p) __param_check(name, p, bool) argument
488 #define param_get_bint param_get_int
489 #define param_check_bint param_check_int
492 * module_param_array - a parameter which is an array of some type
493 * @name: the name of the array variable
498 * Input and output are as comma-separated values. Commas inside values
501 * ARRAY_SIZE(@name) is used to determine the number of elements in the
504 #define module_param_array(name, type, nump, perm) \ argument
505 module_param_array_named(name, name, type, nump, perm)
508 * module_param_array_named - renamed parameter which is an array of some type
509 * @name: a valid C identifier which is the parameter name
510 * @array: the name of the array variable
515 * This exposes a different name than the actual variable name. See
518 #define module_param_array_named(name, array, type, nump, perm) \ argument
519 param_check_##type(name, &(array)[0]); \
520 static const struct kparam_array __param_arr_##name \
524 __module_param_call(MODULE_PARAM_PREFIX, name, \
526 .arr = &__param_arr_##name, \
527 perm, -1, 0); \
528 __MODULE_PARM_TYPE(name, "array of " #type)
541 * module_param_hw_named - A parameter representing a hw parameters
542 * @name: a valid C identifier which is the parameter name.
548 * Usually it's a good idea to have variable names and user-exposed names the
549 * same, but that's harder if the variable must be non-static or is inside a
550 * structure. This allows exposure under a different name.
552 #define module_param_hw_named(name, value, type, hwtype, perm) \ argument
553 param_check_##type(name, &(value)); \
554 __module_param_call(MODULE_PARAM_PREFIX, name, \
556 perm, -1, \
558 __MODULE_PARM_TYPE(name, #type)
560 #define module_param_hw(name, type, hwtype, perm) \ argument
561 module_param_hw_named(name, name, type, hwtype, perm)
564 * module_param_hw_array - A parameter representing an array of hw parameters
565 * @name: the name of the array variable
571 * Input and output are as comma-separated values. Commas inside values
574 * ARRAY_SIZE(@name) is used to determine the number of elements in the
577 #define module_param_hw_array(name, type, hwtype, nump, perm) \ argument
578 param_check_##type(name, &(name)[0]); \
579 static const struct kparam_array __param_arr_##name \
580 = { .max = ARRAY_SIZE(name), .num = nump, \
582 .elemsize = sizeof(name[0]), .elem = name }; \
583 __module_param_call(MODULE_PARAM_PREFIX, name, \
585 .arr = &__param_arr_##name, \
586 perm, -1, \
588 __MODULE_PARM_TYPE(name, "array of " #type)