• Home
  • Raw
  • Download

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, \
296 /* Obsolete - use module_param_cb() */
297 #define module_param_call(name, _set, _get, arg, perm) \ argument
298 static const struct kernel_param_ops __param_ops_##name = \
301 name, &__param_ops_##name, arg, perm, -1, 0)
317 * core_param - define a historical core kernel parameter.
318 * @name: the name of the cmdline and sysfs parameter (often the same as var)
328 #define core_param(name, var, type, perm) \ argument
329 param_check_##type(name, &(var)); \
330 __module_param_call("", name, &param_ops_##type, &var, perm, -1, 0)
333 * core_param_unsafe - same as core_param but taints kernel
334 * @name: the name of the cmdline and sysfs parameter (often the same as var)
339 #define core_param_unsafe(name, var, type, perm) \ argument
340 param_check_##type(name, &(var)); \
341 __module_param_call("", name, &param_ops_##type, &var, perm, \
342 -1, KERNEL_PARAM_FL_UNSAFE)
347 * module_param_string - a char array parameter
348 * @name: the name of the parameter
356 #define module_param_string(name, string, len, perm) \ argument
357 static const struct kparam_string __param_string_##name \
359 __module_param_call(MODULE_PARAM_PREFIX, name, \
361 .str = &__param_string_##name, perm, -1, 0);\
362 __MODULE_PARM_TYPE(name, "string")
365 * parameq - checks if two parameter names match
366 * @name1: parameter name 1
367 * @name2: parameter name 2
370 * Dashes (-) are considered equal to underscores (_).
375 * parameqn - checks if two parameter names match
376 * @name1: parameter name 1
377 * @name2: parameter name 2
385 extern char *parse_args(const char *name,
406 /* The macros to do compile-time type checking stolen from Jakub
408 #define __param_check(name, p, type) \ argument
409 static inline type __always_unused *__check_##name(void) { return(p); }
414 #define param_check_byte(name, p) __param_check(name, p, unsigned char) argument
419 #define param_check_short(name, p) __param_check(name, p, short) argument
424 #define param_check_ushort(name, p) __param_check(name, p, unsigned short) argument
429 #define param_check_int(name, p) __param_check(name, p, int) argument
436 #define param_check_uint(name, p) __param_check(name, p, unsigned int) argument
441 #define param_check_long(name, p) __param_check(name, p, long) argument
446 #define param_check_ulong(name, p) __param_check(name, p, unsigned long) argument
451 #define param_check_ullong(name, p) __param_check(name, p, unsigned long long) argument
456 #define param_check_hexint(name, p) param_check_uint(name, p) argument
462 #define param_check_charp(name, p) __param_check(name, p, char *) argument
468 #define param_check_bool(name, p) __param_check(name, p, bool) argument
474 #define param_check_bool_enable_only param_check_bool
479 #define param_check_invbool(name, p) __param_check(name, p, bool) argument
484 #define param_get_bint param_get_int
485 #define param_check_bint param_check_int
488 * module_param_array - a parameter which is an array of some type
489 * @name: the name of the array variable
494 * Input and output are as comma-separated values. Commas inside values
497 * ARRAY_SIZE(@name) is used to determine the number of elements in the
500 #define module_param_array(name, type, nump, perm) \ argument
501 module_param_array_named(name, name, type, nump, perm)
504 * module_param_array_named - renamed parameter which is an array of some type
505 * @name: a valid C identifier which is the parameter name
506 * @array: the name of the array variable
511 * This exposes a different name than the actual variable name. See
514 #define module_param_array_named(name, array, type, nump, perm) \ argument
515 param_check_##type(name, &(array)[0]); \
516 static const struct kparam_array __param_arr_##name \
520 __module_param_call(MODULE_PARAM_PREFIX, name, \
522 .arr = &__param_arr_##name, \
523 perm, -1, 0); \
524 __MODULE_PARM_TYPE(name, "array of " #type)
537 * module_param_hw_named - A parameter representing a hw parameters
538 * @name: a valid C identifier which is the parameter name.
544 * Usually it's a good idea to have variable names and user-exposed names the
545 * same, but that's harder if the variable must be non-static or is inside a
546 * structure. This allows exposure under a different name.
548 #define module_param_hw_named(name, value, type, hwtype, perm) \ argument
549 param_check_##type(name, &(value)); \
550 __module_param_call(MODULE_PARAM_PREFIX, name, \
552 perm, -1, \
554 __MODULE_PARM_TYPE(name, #type)
556 #define module_param_hw(name, type, hwtype, perm) \ argument
557 module_param_hw_named(name, name, type, hwtype, perm)
560 * module_param_hw_array - A parameter representing an array of hw parameters
561 * @name: the name of the array variable
567 * Input and output are as comma-separated values. Commas inside values
570 * ARRAY_SIZE(@name) is used to determine the number of elements in the
573 #define module_param_hw_array(name, type, hwtype, nump, perm) \ argument
574 param_check_##type(name, &(name)[0]); \
575 static const struct kparam_array __param_arr_##name \
576 = { .max = ARRAY_SIZE(name), .num = nump, \
578 .elemsize = sizeof(name[0]), .elem = name }; \
579 __module_param_call(MODULE_PARAM_PREFIX, name, \
581 .arr = &__param_arr_##name, \
582 perm, -1, \
584 __MODULE_PARM_TYPE(name, "array of " #type)