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