Linux kernel mirror (for testing)
git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel
os
linux
1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _LINUX_MODULE_PARAMS_H
3#define _LINUX_MODULE_PARAMS_H
4/* (C) Copyright 2001, 2002 Rusty Russell IBM Corporation */
5
6#include <linux/array_size.h>
7#include <linux/build_bug.h>
8#include <linux/compiler.h>
9#include <linux/init.h>
10#include <linux/stringify.h>
11#include <linux/sysfs.h>
12#include <linux/types.h>
13
14/*
15 * The maximum module name length, including the NUL byte.
16 * Chosen so that structs with an unsigned long line up, specifically
17 * modversion_info.
18 */
19#define __MODULE_NAME_LEN (64 - sizeof(unsigned long))
20
21/* You can override this manually, but generally this should match the
22 module name. */
23#ifdef MODULE
24#define MODULE_PARAM_PREFIX /* empty */
25#define __MODULE_INFO_PREFIX /* empty */
26#else
27#define MODULE_PARAM_PREFIX KBUILD_MODNAME "."
28/* We cannot use MODULE_PARAM_PREFIX because some modules override it. */
29#define __MODULE_INFO_PREFIX KBUILD_MODNAME "."
30#endif
31
32/* Generic info of form tag = "info" */
33#define MODULE_INFO(tag, info) \
34 static_assert( \
35 sizeof(info) - 1 == __builtin_strlen(info), \
36 "MODULE_INFO(" #tag ", ...) contains embedded NUL byte"); \
37 static const char __UNIQUE_ID(modinfo)[] \
38 __used __section(".modinfo") __aligned(1) \
39 = __MODULE_INFO_PREFIX __stringify(tag) "=" info
40
41#define __MODULE_PARM_TYPE(name, _type) \
42 MODULE_INFO(parmtype, #name ":" _type)
43
44/* One for each parameter, describing how to use it. Some files do
45 multiple of these per line, so can't just use MODULE_INFO. */
46#define MODULE_PARM_DESC(_parm, desc) \
47 MODULE_INFO(parm, #_parm ":" desc)
48
49struct kernel_param;
50
51/*
52 * Flags available for kernel_param_ops
53 *
54 * NOARG - the parameter allows for no argument (foo instead of foo=1)
55 */
56enum {
57 KERNEL_PARAM_OPS_FL_NOARG = (1 << 0)
58};
59
60struct kernel_param_ops {
61 /* How the ops should behave */
62 unsigned int flags;
63 /* Returns 0, or -errno. arg is in kp->arg. */
64 int (*set)(const char *val, const struct kernel_param *kp);
65 /* Returns length written or -errno. Buffer is 4k (ie. be short!) */
66 int (*get)(char *buffer, const struct kernel_param *kp);
67 /* Optional function to free kp->arg when module unloaded. */
68 void (*free)(void *arg);
69};
70
71/*
72 * Flags available for kernel_param
73 *
74 * UNSAFE - the parameter is dangerous and setting it will taint the kernel
75 * HWPARAM - Hardware param not permitted in lockdown mode
76 */
77enum {
78 KERNEL_PARAM_FL_UNSAFE = (1 << 0),
79 KERNEL_PARAM_FL_HWPARAM = (1 << 1),
80};
81
82struct kernel_param {
83 const char *name;
84 struct module *mod;
85 const struct kernel_param_ops *ops;
86 const u16 perm;
87 s8 level;
88 u8 flags;
89 union {
90 void *arg;
91 const struct kparam_string *str;
92 const struct kparam_array *arr;
93 };
94};
95
96extern const struct kernel_param __start___param[], __stop___param[];
97
98/* Special one for strings we want to copy into */
99struct kparam_string {
100 unsigned int maxlen;
101 char *string;
102};
103
104/* Special one for arrays */
105struct kparam_array
106{
107 unsigned int max;
108 unsigned int elemsize;
109 unsigned int *num;
110 const struct kernel_param_ops *ops;
111 void *elem;
112};
113
114/**
115 * module_param - typesafe helper for a module/cmdline parameter
116 * @name: the variable to alter, and exposed parameter name.
117 * @type: the type of the parameter
118 * @perm: visibility in sysfs.
119 *
120 * @name becomes the module parameter, or (prefixed by KBUILD_MODNAME and a
121 * ".") the kernel commandline parameter. Note that - is changed to _, so
122 * the user can use "foo-bar=1" even for variable "foo_bar".
123 *
124 * @perm is 0 if the variable is not to appear in sysfs, or 0444
125 * for world-readable, 0644 for root-writable, etc. Note that if it
126 * is writable, you may need to use kernel_param_lock() around
127 * accesses (esp. charp, which can be kfreed when it changes).
128 *
129 * The @type is simply pasted to refer to a param_ops_##type and a
130 * param_check_##type: for convenience many standard types are provided but
131 * you can create your own by defining those variables.
132 *
133 * Standard types are:
134 * byte, hexint, short, ushort, int, uint, long, ulong
135 * charp: a character pointer
136 * bool: a bool, values 0/1, y/n, Y/N.
137 * invbool: the above, only sense-reversed (N = true).
138 */
139#define module_param(name, type, perm) \
140 module_param_named(name, name, type, perm)
141
142/**
143 * module_param_unsafe - same as module_param but taints kernel
144 * @name: the variable to alter, and exposed parameter name.
145 * @type: the type of the parameter
146 * @perm: visibility in sysfs.
147 */
148#define module_param_unsafe(name, type, perm) \
149 module_param_named_unsafe(name, name, type, perm)
150
151/**
152 * module_param_named - typesafe helper for a renamed module/cmdline parameter
153 * @name: a valid C identifier which is the parameter name.
154 * @value: the actual lvalue to alter.
155 * @type: the type of the parameter
156 * @perm: visibility in sysfs.
157 *
158 * Usually it's a good idea to have variable names and user-exposed names the
159 * same, but that's harder if the variable must be non-static or is inside a
160 * structure. This allows exposure under a different name.
161 */
162#define module_param_named(name, value, type, perm) \
163 param_check_##type(name, &(value)); \
164 module_param_cb(name, ¶m_ops_##type, &value, perm); \
165 __MODULE_PARM_TYPE(name, #type)
166
167/**
168 * module_param_named_unsafe - same as module_param_named but taints kernel
169 * @name: a valid C identifier which is the parameter name.
170 * @value: the actual lvalue to alter.
171 * @type: the type of the parameter
172 * @perm: visibility in sysfs.
173 */
174#define module_param_named_unsafe(name, value, type, perm) \
175 param_check_##type(name, &(value)); \
176 module_param_cb_unsafe(name, ¶m_ops_##type, &value, perm); \
177 __MODULE_PARM_TYPE(name, #type)
178
179/**
180 * module_param_cb - general callback for a module/cmdline parameter
181 * @name: a valid C identifier which is the parameter name.
182 * @ops: the set & get operations for this parameter.
183 * @arg: args for @ops
184 * @perm: visibility in sysfs.
185 *
186 * The ops can have NULL set or get functions.
187 */
188#define module_param_cb(name, ops, arg, perm) \
189 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, 0)
190
191#define module_param_cb_unsafe(name, ops, arg, perm) \
192 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, -1, \
193 KERNEL_PARAM_FL_UNSAFE)
194
195#define __level_param_cb(name, ops, arg, perm, level) \
196 __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level, 0)
197/**
198 * core_param_cb - general callback for a module/cmdline parameter
199 * to be evaluated before core initcall level
200 * @name: a valid C identifier which is the parameter name.
201 * @ops: the set & get operations for this parameter.
202 * @arg: args for @ops
203 * @perm: visibility in sysfs.
204 *
205 * The ops can have NULL set or get functions.
206 */
207#define core_param_cb(name, ops, arg, perm) \
208 __level_param_cb(name, ops, arg, perm, 1)
209
210/**
211 * postcore_param_cb - general callback for a module/cmdline parameter
212 * to be evaluated before postcore initcall level
213 * @name: a valid C identifier which is the parameter name.
214 * @ops: the set & get operations for this parameter.
215 * @arg: args for @ops
216 * @perm: visibility in sysfs.
217 *
218 * The ops can have NULL set or get functions.
219 */
220#define postcore_param_cb(name, ops, arg, perm) \
221 __level_param_cb(name, ops, arg, perm, 2)
222
223/**
224 * arch_param_cb - general callback for a module/cmdline parameter
225 * to be evaluated before arch initcall level
226 * @name: a valid C identifier which is the parameter name.
227 * @ops: the set & get operations for this parameter.
228 * @arg: args for @ops
229 * @perm: visibility in sysfs.
230 *
231 * The ops can have NULL set or get functions.
232 */
233#define arch_param_cb(name, ops, arg, perm) \
234 __level_param_cb(name, ops, arg, perm, 3)
235
236/**
237 * subsys_param_cb - general callback for a module/cmdline parameter
238 * to be evaluated before subsys initcall level
239 * @name: a valid C identifier which is the parameter name.
240 * @ops: the set & get operations for this parameter.
241 * @arg: args for @ops
242 * @perm: visibility in sysfs.
243 *
244 * The ops can have NULL set or get functions.
245 */
246#define subsys_param_cb(name, ops, arg, perm) \
247 __level_param_cb(name, ops, arg, perm, 4)
248
249/**
250 * fs_param_cb - general callback for a module/cmdline parameter
251 * to be evaluated before fs initcall level
252 * @name: a valid C identifier which is the parameter name.
253 * @ops: the set & get operations for this parameter.
254 * @arg: args for @ops
255 * @perm: visibility in sysfs.
256 *
257 * The ops can have NULL set or get functions.
258 */
259#define fs_param_cb(name, ops, arg, perm) \
260 __level_param_cb(name, ops, arg, perm, 5)
261
262/**
263 * device_param_cb - general callback for a module/cmdline parameter
264 * to be evaluated before device initcall level
265 * @name: a valid C identifier which is the parameter name.
266 * @ops: the set & get operations for this parameter.
267 * @arg: args for @ops
268 * @perm: visibility in sysfs.
269 *
270 * The ops can have NULL set or get functions.
271 */
272#define device_param_cb(name, ops, arg, perm) \
273 __level_param_cb(name, ops, arg, perm, 6)
274
275/**
276 * late_param_cb - general callback for a module/cmdline parameter
277 * to be evaluated before late initcall level
278 * @name: a valid C identifier which is the parameter name.
279 * @ops: the set & get operations for this parameter.
280 * @arg: args for @ops
281 * @perm: visibility in sysfs.
282 *
283 * The ops can have NULL set or get functions.
284 */
285#define late_param_cb(name, ops, arg, perm) \
286 __level_param_cb(name, ops, arg, perm, 7)
287
288/* On alpha, ia64 and ppc64 relocations to global data cannot go into
289 read-only sections (which is part of respective UNIX ABI on these
290 platforms). So 'const' makes no sense and even causes compile failures
291 with some compilers. */
292#if defined(CONFIG_ALPHA) || defined(CONFIG_PPC64)
293#define __moduleparam_const
294#else
295#define __moduleparam_const const
296#endif
297
298/* This is the fundamental function for registering boot/module parameters. */
299#define __module_param_call(prefix, name, ops, arg, perm, level, flags) \
300 static_assert(sizeof(""prefix) - 1 <= __MODULE_NAME_LEN); \
301 static const char __param_str_##name[] = prefix #name; \
302 static struct kernel_param __moduleparam_const __param_##name \
303 __used __section("__param") \
304 __aligned(__alignof__(struct kernel_param)) \
305 = { __param_str_##name, THIS_MODULE, ops, \
306 VERIFY_OCTAL_PERMISSIONS(perm), level, flags, { arg } }
307
308/*
309 * Useful for describing a set/get pair used only once (i.e. for this
310 * parameter). For repeated set/get pairs (i.e. the same struct
311 * kernel_param_ops), use module_param_cb() instead.
312 */
313#define module_param_call(name, _set, _get, arg, perm) \
314 static const struct kernel_param_ops __param_ops_##name = \
315 { .flags = 0, .set = _set, .get = _get }; \
316 __module_param_call(MODULE_PARAM_PREFIX, \
317 name, &__param_ops_##name, arg, perm, -1, 0)
318
319#ifdef CONFIG_SYSFS
320void kernel_param_lock(struct module *mod);
321void kernel_param_unlock(struct module *mod);
322#else
323static inline void kernel_param_lock(struct module *mod)
324{
325}
326static inline void kernel_param_unlock(struct module *mod)
327{
328}
329#endif
330
331#ifndef MODULE
332/**
333 * core_param - define a historical core kernel parameter.
334 * @name: the name of the cmdline and sysfs parameter (often the same as var)
335 * @var: the variable
336 * @type: the type of the parameter
337 * @perm: visibility in sysfs
338 *
339 * core_param is just like module_param(), but cannot be modular and
340 * doesn't add a prefix (such as "printk."). This is for compatibility
341 * with __setup(), and it makes sense as truly core parameters aren't
342 * tied to the particular file they're in.
343 */
344#define core_param(name, var, type, perm) \
345 param_check_##type(name, &(var)); \
346 __module_param_call("", name, ¶m_ops_##type, &var, perm, -1, 0)
347
348/**
349 * core_param_unsafe - same as core_param but taints kernel
350 * @name: the name of the cmdline and sysfs parameter (often the same as var)
351 * @var: the variable
352 * @type: the type of the parameter
353 * @perm: visibility in sysfs
354 */
355#define core_param_unsafe(name, var, type, perm) \
356 param_check_##type(name, &(var)); \
357 __module_param_call("", name, ¶m_ops_##type, &var, perm, \
358 -1, KERNEL_PARAM_FL_UNSAFE)
359
360/**
361 * __core_param_cb - similar like core_param, with a set/get ops instead of type.
362 * @name: the name of the cmdline and sysfs parameter (often the same as var)
363 * @ops: the set & get operations for this parameter.
364 * @arg: the variable
365 * @perm: visibility in sysfs
366 *
367 * Ideally this should be called 'core_param_cb', but the name has been
368 * used for module core parameter, so add the '__' prefix
369 */
370#define __core_param_cb(name, ops, arg, perm) \
371 __module_param_call("", name, ops, arg, perm, -1, 0)
372
373#endif /* !MODULE */
374
375/**
376 * module_param_string - a char array parameter
377 * @name: the name of the parameter
378 * @string: the string variable
379 * @len: the maximum length of the string, incl. terminator
380 * @perm: visibility in sysfs.
381 *
382 * This actually copies the string when it's set (unlike type charp).
383 * @len is usually just sizeof(string).
384 */
385#define module_param_string(name, string, len, perm) \
386 static const struct kparam_string __param_string_##name \
387 = { len, string }; \
388 __module_param_call(MODULE_PARAM_PREFIX, name, \
389 ¶m_ops_string, \
390 .str = &__param_string_##name, perm, -1, 0);\
391 __MODULE_PARM_TYPE(name, "string")
392
393/**
394 * parameq - checks if two parameter names match
395 * @name1: parameter name 1
396 * @name2: parameter name 2
397 *
398 * Returns: true if the two parameter names are equal.
399 * Dashes (-) are considered equal to underscores (_).
400 */
401bool parameq(const char *name1, const char *name2);
402
403/**
404 * parameqn - checks if two parameter names match
405 * @name1: parameter name 1
406 * @name2: parameter name 2
407 * @n: the length to compare
408 *
409 * Similar to parameq(), except it compares @n characters.
410 *
411 * Returns: true if the first @n characters of the two parameter names
412 * are equal.
413 * Dashes (-) are considered equal to underscores (_).
414 */
415bool parameqn(const char *name1, const char *name2, size_t n);
416
417typedef int (*parse_unknown_fn)(char *param, char *val, const char *doing, void *arg);
418
419/* Called on module insert or kernel boot */
420char *parse_args(const char *doing,
421 char *args,
422 const struct kernel_param *params,
423 unsigned int num,
424 s16 min_level,
425 s16 max_level,
426 void *arg, parse_unknown_fn unknown);
427
428/* Called by module remove. */
429#ifdef CONFIG_MODULES
430void module_destroy_params(const struct kernel_param *params, unsigned int num);
431#endif
432
433/* All the helper functions */
434/* The macros to do compile-time type checking stolen from Jakub
435 Jelinek, who IIRC came up with this idea for the 2.4 module init code. */
436#define __param_check(name, p, type) \
437 static inline type __always_unused *__check_##name(void) { return(p); }
438
439extern const struct kernel_param_ops param_ops_byte;
440int param_set_byte(const char *val, const struct kernel_param *kp);
441int param_get_byte(char *buffer, const struct kernel_param *kp);
442#define param_check_byte(name, p) __param_check(name, p, unsigned char)
443
444extern const struct kernel_param_ops param_ops_short;
445int param_set_short(const char *val, const struct kernel_param *kp);
446int param_get_short(char *buffer, const struct kernel_param *kp);
447#define param_check_short(name, p) __param_check(name, p, short)
448
449extern const struct kernel_param_ops param_ops_ushort;
450int param_set_ushort(const char *val, const struct kernel_param *kp);
451int param_get_ushort(char *buffer, const struct kernel_param *kp);
452#define param_check_ushort(name, p) __param_check(name, p, unsigned short)
453
454extern const struct kernel_param_ops param_ops_int;
455int param_set_int(const char *val, const struct kernel_param *kp);
456int param_get_int(char *buffer, const struct kernel_param *kp);
457#define param_check_int(name, p) __param_check(name, p, int)
458
459extern const struct kernel_param_ops param_ops_uint;
460int param_set_uint(const char *val, const struct kernel_param *kp);
461int param_get_uint(char *buffer, const struct kernel_param *kp);
462int param_set_uint_minmax(const char *val, const struct kernel_param *kp,
463 unsigned int min, unsigned int max);
464#define param_check_uint(name, p) __param_check(name, p, unsigned int)
465
466extern const struct kernel_param_ops param_ops_long;
467int param_set_long(const char *val, const struct kernel_param *kp);
468int param_get_long(char *buffer, const struct kernel_param *kp);
469#define param_check_long(name, p) __param_check(name, p, long)
470
471extern const struct kernel_param_ops param_ops_ulong;
472int param_set_ulong(const char *val, const struct kernel_param *kp);
473int param_get_ulong(char *buffer, const struct kernel_param *kp);
474#define param_check_ulong(name, p) __param_check(name, p, unsigned long)
475
476extern const struct kernel_param_ops param_ops_ullong;
477int param_set_ullong(const char *val, const struct kernel_param *kp);
478int param_get_ullong(char *buffer, const struct kernel_param *kp);
479#define param_check_ullong(name, p) __param_check(name, p, unsigned long long)
480
481extern const struct kernel_param_ops param_ops_hexint;
482int param_set_hexint(const char *val, const struct kernel_param *kp);
483int param_get_hexint(char *buffer, const struct kernel_param *kp);
484#define param_check_hexint(name, p) param_check_uint(name, p)
485
486extern const struct kernel_param_ops param_ops_charp;
487int param_set_charp(const char *val, const struct kernel_param *kp);
488int param_get_charp(char *buffer, const struct kernel_param *kp);
489void param_free_charp(void *arg);
490#define param_check_charp(name, p) __param_check(name, p, char *)
491
492/* We used to allow int as well as bool. We're taking that away! */
493extern const struct kernel_param_ops param_ops_bool;
494int param_set_bool(const char *val, const struct kernel_param *kp);
495int param_get_bool(char *buffer, const struct kernel_param *kp);
496#define param_check_bool(name, p) __param_check(name, p, bool)
497
498extern const struct kernel_param_ops param_ops_bool_enable_only;
499int param_set_bool_enable_only(const char *val, const struct kernel_param *kp);
500/* getter is the same as for the regular bool */
501#define param_check_bool_enable_only param_check_bool
502
503extern const struct kernel_param_ops param_ops_invbool;
504int param_set_invbool(const char *val, const struct kernel_param *kp);
505int param_get_invbool(char *buffer, const struct kernel_param *kp);
506#define param_check_invbool(name, p) __param_check(name, p, bool)
507
508/* An int, which can only be set like a bool (though it shows as an int). */
509extern const struct kernel_param_ops param_ops_bint;
510int param_set_bint(const char *val, const struct kernel_param *kp);
511#define param_get_bint param_get_int
512#define param_check_bint param_check_int
513
514/**
515 * module_param_array - a parameter which is an array of some type
516 * @name: the name of the array variable
517 * @type: the type, as per module_param()
518 * @nump: optional pointer filled in with the number written
519 * @perm: visibility in sysfs
520 *
521 * Input and output are as comma-separated values. Commas inside values
522 * don't work properly (eg. an array of charp).
523 *
524 * ARRAY_SIZE(@name) is used to determine the number of elements in the
525 * array, so the definition must be visible.
526 */
527#define module_param_array(name, type, nump, perm) \
528 module_param_array_named(name, name, type, nump, perm)
529
530/**
531 * module_param_array_named - renamed parameter which is an array of some type
532 * @name: a valid C identifier which is the parameter name
533 * @array: the name of the array variable
534 * @type: the type, as per module_param()
535 * @nump: optional pointer filled in with the number written
536 * @perm: visibility in sysfs
537 *
538 * This exposes a different name than the actual variable name. See
539 * module_param_named() for why this might be necessary.
540 */
541#define module_param_array_named(name, array, type, nump, perm) \
542 param_check_##type(name, &(array)[0]); \
543 static const struct kparam_array __param_arr_##name \
544 = { .max = ARRAY_SIZE(array), .num = nump, \
545 .ops = ¶m_ops_##type, \
546 .elemsize = sizeof(array[0]), .elem = array }; \
547 __module_param_call(MODULE_PARAM_PREFIX, name, \
548 ¶m_array_ops, \
549 .arr = &__param_arr_##name, \
550 perm, -1, 0); \
551 __MODULE_PARM_TYPE(name, "array of " #type)
552
553enum hwparam_type {
554 hwparam_ioport, /* Module parameter configures an I/O port */
555 hwparam_iomem, /* Module parameter configures an I/O mem address */
556 hwparam_ioport_or_iomem, /* Module parameter could be either, depending on other option */
557 hwparam_irq, /* Module parameter configures an IRQ */
558 hwparam_dma, /* Module parameter configures a DMA channel */
559 hwparam_dma_addr, /* Module parameter configures a DMA buffer address */
560 hwparam_other, /* Module parameter configures some other value */
561};
562
563/**
564 * module_param_hw_named - A parameter representing a hw parameters
565 * @name: a valid C identifier which is the parameter name.
566 * @value: the actual lvalue to alter.
567 * @type: the type of the parameter
568 * @hwtype: what the value represents (enum hwparam_type)
569 * @perm: visibility in sysfs.
570 *
571 * Usually it's a good idea to have variable names and user-exposed names the
572 * same, but that's harder if the variable must be non-static or is inside a
573 * structure. This allows exposure under a different name.
574 */
575#define module_param_hw_named(name, value, type, hwtype, perm) \
576 param_check_##type(name, &(value)); \
577 __module_param_call(MODULE_PARAM_PREFIX, name, \
578 ¶m_ops_##type, &value, \
579 perm, -1, \
580 KERNEL_PARAM_FL_HWPARAM | (hwparam_##hwtype & 0)); \
581 __MODULE_PARM_TYPE(name, #type)
582
583#define module_param_hw(name, type, hwtype, perm) \
584 module_param_hw_named(name, name, type, hwtype, perm)
585
586/**
587 * module_param_hw_array - A parameter representing an array of hw parameters
588 * @name: the name of the array variable
589 * @type: the type, as per module_param()
590 * @hwtype: what the value represents (enum hwparam_type)
591 * @nump: optional pointer filled in with the number written
592 * @perm: visibility in sysfs
593 *
594 * Input and output are as comma-separated values. Commas inside values
595 * don't work properly (eg. an array of charp).
596 *
597 * ARRAY_SIZE(@name) is used to determine the number of elements in the
598 * array, so the definition must be visible.
599 */
600#define module_param_hw_array(name, type, hwtype, nump, perm) \
601 param_check_##type(name, &(name)[0]); \
602 static const struct kparam_array __param_arr_##name \
603 = { .max = ARRAY_SIZE(name), .num = nump, \
604 .ops = ¶m_ops_##type, \
605 .elemsize = sizeof(name[0]), .elem = name }; \
606 __module_param_call(MODULE_PARAM_PREFIX, name, \
607 ¶m_array_ops, \
608 .arr = &__param_arr_##name, \
609 perm, -1, \
610 KERNEL_PARAM_FL_HWPARAM | (hwparam_##hwtype & 0)); \
611 __MODULE_PARM_TYPE(name, "array of " #type)
612
613
614extern const struct kernel_param_ops param_array_ops;
615
616extern const struct kernel_param_ops param_ops_string;
617int param_set_copystring(const char *val, const struct kernel_param *kp);
618int param_get_string(char *buffer, const struct kernel_param *kp);
619
620/* for exporting parameters in /sys/module/.../parameters */
621
622struct module;
623
624#if defined(CONFIG_SYSFS) && defined(CONFIG_MODULES)
625int module_param_sysfs_setup(struct module *mod,
626 const struct kernel_param *kparam,
627 unsigned int num_params);
628
629void module_param_sysfs_remove(struct module *mod);
630#else
631static inline int module_param_sysfs_setup(struct module *mod,
632 const struct kernel_param *kparam,
633 unsigned int num_params)
634{
635 return 0;
636}
637
638static inline void module_param_sysfs_remove(struct module *mod)
639{ }
640#endif
641
642#endif /* _LINUX_MODULE_PARAMS_H */