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