diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/asm-generic/vmlinux.lds.h | 35 | ||||
-rw-r--r-- | include/linux/module.h | 32 | ||||
-rw-r--r-- | include/linux/moduleparam.h | 58 |
3 files changed, 61 insertions, 64 deletions
diff --git a/include/asm-generic/vmlinux.lds.h b/include/asm-generic/vmlinux.lds.h index 798603e8ec3..8aeadf6b553 100644 --- a/include/asm-generic/vmlinux.lds.h +++ b/include/asm-generic/vmlinux.lds.h | |||
@@ -616,30 +616,23 @@ | |||
616 | *(.init.setup) \ | 616 | *(.init.setup) \ |
617 | VMLINUX_SYMBOL(__setup_end) = .; | 617 | VMLINUX_SYMBOL(__setup_end) = .; |
618 | 618 | ||
619 | #define INITCALLS \ | 619 | #define INIT_CALLS_LEVEL(level) \ |
620 | *(.initcallearly.init) \ | 620 | VMLINUX_SYMBOL(__initcall##level##_start) = .; \ |
621 | VMLINUX_SYMBOL(__early_initcall_end) = .; \ | 621 | *(.initcall##level##.init) \ |
622 | *(.initcall0.init) \ | 622 | *(.initcall##level##s.init) \ |
623 | *(.initcall0s.init) \ | ||
624 | *(.initcall1.init) \ | ||
625 | *(.initcall1s.init) \ | ||
626 | *(.initcall2.init) \ | ||
627 | *(.initcall2s.init) \ | ||
628 | *(.initcall3.init) \ | ||
629 | *(.initcall3s.init) \ | ||
630 | *(.initcall4.init) \ | ||
631 | *(.initcall4s.init) \ | ||
632 | *(.initcall5.init) \ | ||
633 | *(.initcall5s.init) \ | ||
634 | *(.initcallrootfs.init) \ | ||
635 | *(.initcall6.init) \ | ||
636 | *(.initcall6s.init) \ | ||
637 | *(.initcall7.init) \ | ||
638 | *(.initcall7s.init) | ||
639 | 623 | ||
640 | #define INIT_CALLS \ | 624 | #define INIT_CALLS \ |
641 | VMLINUX_SYMBOL(__initcall_start) = .; \ | 625 | VMLINUX_SYMBOL(__initcall_start) = .; \ |
642 | INITCALLS \ | 626 | *(.initcallearly.init) \ |
627 | INIT_CALLS_LEVEL(0) \ | ||
628 | INIT_CALLS_LEVEL(1) \ | ||
629 | INIT_CALLS_LEVEL(2) \ | ||
630 | INIT_CALLS_LEVEL(3) \ | ||
631 | INIT_CALLS_LEVEL(4) \ | ||
632 | INIT_CALLS_LEVEL(5) \ | ||
633 | INIT_CALLS_LEVEL(rootfs) \ | ||
634 | INIT_CALLS_LEVEL(6) \ | ||
635 | INIT_CALLS_LEVEL(7) \ | ||
643 | VMLINUX_SYMBOL(__initcall_end) = .; | 636 | VMLINUX_SYMBOL(__initcall_end) = .; |
644 | 637 | ||
645 | #define CON_INITCALL \ | 638 | #define CON_INITCALL \ |
diff --git a/include/linux/module.h b/include/linux/module.h index 4598bf03e98..fbcafe2ee13 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -21,8 +21,6 @@ | |||
21 | #include <linux/percpu.h> | 21 | #include <linux/percpu.h> |
22 | #include <asm/module.h> | 22 | #include <asm/module.h> |
23 | 23 | ||
24 | #include <trace/events/module.h> | ||
25 | |||
26 | /* Not Yet Implemented */ | 24 | /* Not Yet Implemented */ |
27 | #define MODULE_SUPPORTED_DEVICE(name) | 25 | #define MODULE_SUPPORTED_DEVICE(name) |
28 | 26 | ||
@@ -452,33 +450,11 @@ void symbol_put_addr(void *addr); | |||
452 | 450 | ||
453 | /* Sometimes we know we already have a refcount, and it's easier not | 451 | /* Sometimes we know we already have a refcount, and it's easier not |
454 | to handle the error case (which only happens with rmmod --wait). */ | 452 | to handle the error case (which only happens with rmmod --wait). */ |
455 | static inline void __module_get(struct module *module) | 453 | extern void __module_get(struct module *module); |
456 | { | ||
457 | if (module) { | ||
458 | preempt_disable(); | ||
459 | __this_cpu_inc(module->refptr->incs); | ||
460 | trace_module_get(module, _THIS_IP_); | ||
461 | preempt_enable(); | ||
462 | } | ||
463 | } | ||
464 | |||
465 | static inline int try_module_get(struct module *module) | ||
466 | { | ||
467 | int ret = 1; | ||
468 | |||
469 | if (module) { | ||
470 | preempt_disable(); | ||
471 | 454 | ||
472 | if (likely(module_is_live(module))) { | 455 | /* This is the Right Way to get a module: if it fails, it's being removed, |
473 | __this_cpu_inc(module->refptr->incs); | 456 | * so pretend it's not there. */ |
474 | trace_module_get(module, _THIS_IP_); | 457 | extern bool try_module_get(struct module *module); |
475 | } else | ||
476 | ret = 0; | ||
477 | |||
478 | preempt_enable(); | ||
479 | } | ||
480 | return ret; | ||
481 | } | ||
482 | 458 | ||
483 | extern void module_put(struct module *module); | 459 | extern void module_put(struct module *module); |
484 | 460 | ||
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index c47f4d60db0..ea36486378d 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
@@ -47,14 +47,11 @@ struct kernel_param_ops { | |||
47 | void (*free)(void *arg); | 47 | void (*free)(void *arg); |
48 | }; | 48 | }; |
49 | 49 | ||
50 | /* Flag bits for kernel_param.flags */ | ||
51 | #define KPARAM_ISBOOL 2 | ||
52 | |||
53 | struct kernel_param { | 50 | struct kernel_param { |
54 | const char *name; | 51 | const char *name; |
55 | const struct kernel_param_ops *ops; | 52 | const struct kernel_param_ops *ops; |
56 | u16 perm; | 53 | u16 perm; |
57 | u16 flags; | 54 | s16 level; |
58 | union { | 55 | union { |
59 | void *arg; | 56 | void *arg; |
60 | const struct kparam_string *str; | 57 | const struct kparam_string *str; |
@@ -131,8 +128,40 @@ struct kparam_array | |||
131 | * The ops can have NULL set or get functions. | 128 | * The ops can have NULL set or get functions. |
132 | */ | 129 | */ |
133 | #define module_param_cb(name, ops, arg, perm) \ | 130 | #define module_param_cb(name, ops, arg, perm) \ |
134 | __module_param_call(MODULE_PARAM_PREFIX, \ | 131 | __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, 0) |
135 | name, ops, arg, __same_type((arg), bool *), perm) | 132 | |
133 | /** | ||
134 | * <level>_param_cb - general callback for a module/cmdline parameter | ||
135 | * to be evaluated before certain initcall level | ||
136 | * @name: a valid C identifier which is the parameter name. | ||
137 | * @ops: the set & get operations for this parameter. | ||
138 | * @perm: visibility in sysfs. | ||
139 | * | ||
140 | * The ops can have NULL set or get functions. | ||
141 | */ | ||
142 | #define __level_param_cb(name, ops, arg, perm, level) \ | ||
143 | __module_param_call(MODULE_PARAM_PREFIX, name, ops, arg, perm, level) | ||
144 | |||
145 | #define core_param_cb(name, ops, arg, perm) \ | ||
146 | __level_param_cb(name, ops, arg, perm, 1) | ||
147 | |||
148 | #define postcore_param_cb(name, ops, arg, perm) \ | ||
149 | __level_param_cb(name, ops, arg, perm, 2) | ||
150 | |||
151 | #define arch_param_cb(name, ops, arg, perm) \ | ||
152 | __level_param_cb(name, ops, arg, perm, 3) | ||
153 | |||
154 | #define subsys_param_cb(name, ops, arg, perm) \ | ||
155 | __level_param_cb(name, ops, arg, perm, 4) | ||
156 | |||
157 | #define fs_param_cb(name, ops, arg, perm) \ | ||
158 | __level_param_cb(name, ops, arg, perm, 5) | ||
159 | |||
160 | #define device_param_cb(name, ops, arg, perm) \ | ||
161 | __level_param_cb(name, ops, arg, perm, 6) | ||
162 | |||
163 | #define late_param_cb(name, ops, arg, perm) \ | ||
164 | __level_param_cb(name, ops, arg, perm, 7) | ||
136 | 165 | ||
137 | /* On alpha, ia64 and ppc64 relocations to global data cannot go into | 166 | /* On alpha, ia64 and ppc64 relocations to global data cannot go into |
138 | read-only sections (which is part of respective UNIX ABI on these | 167 | read-only sections (which is part of respective UNIX ABI on these |
@@ -146,7 +175,7 @@ struct kparam_array | |||
146 | 175 | ||
147 | /* This is the fundamental function for registering boot/module | 176 | /* This is the fundamental function for registering boot/module |
148 | parameters. */ | 177 | parameters. */ |
149 | #define __module_param_call(prefix, name, ops, arg, isbool, perm) \ | 178 | #define __module_param_call(prefix, name, ops, arg, perm, level) \ |
150 | /* Default value instead of permissions? */ \ | 179 | /* Default value instead of permissions? */ \ |
151 | static int __param_perm_check_##name __attribute__((unused)) = \ | 180 | static int __param_perm_check_##name __attribute__((unused)) = \ |
152 | BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ | 181 | BUILD_BUG_ON_ZERO((perm) < 0 || (perm) > 0777 || ((perm) & 2)) \ |
@@ -155,8 +184,7 @@ struct kparam_array | |||
155 | static struct kernel_param __moduleparam_const __param_##name \ | 184 | static struct kernel_param __moduleparam_const __param_##name \ |
156 | __used \ | 185 | __used \ |
157 | __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ | 186 | __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) \ |
158 | = { __param_str_##name, ops, perm, isbool ? KPARAM_ISBOOL : 0, \ | 187 | = { __param_str_##name, ops, perm, level, { arg } } |
159 | { arg } } | ||
160 | 188 | ||
161 | /* Obsolete - use module_param_cb() */ | 189 | /* Obsolete - use module_param_cb() */ |
162 | #define module_param_call(name, set, get, arg, perm) \ | 190 | #define module_param_call(name, set, get, arg, perm) \ |
@@ -164,8 +192,7 @@ struct kparam_array | |||
164 | { (void *)set, (void *)get }; \ | 192 | { (void *)set, (void *)get }; \ |
165 | __module_param_call(MODULE_PARAM_PREFIX, \ | 193 | __module_param_call(MODULE_PARAM_PREFIX, \ |
166 | name, &__param_ops_##name, arg, \ | 194 | name, &__param_ops_##name, arg, \ |
167 | __same_type(arg, bool *), \ | 195 | (perm) + sizeof(__check_old_set_param(set))*0, 0) |
168 | (perm) + sizeof(__check_old_set_param(set))*0) | ||
169 | 196 | ||
170 | /* We don't get oldget: it's often a new-style param_get_uint, etc. */ | 197 | /* We don't get oldget: it's often a new-style param_get_uint, etc. */ |
171 | static inline int | 198 | static inline int |
@@ -245,8 +272,7 @@ static inline void __kernel_param_unlock(void) | |||
245 | */ | 272 | */ |
246 | #define core_param(name, var, type, perm) \ | 273 | #define core_param(name, var, type, perm) \ |
247 | param_check_##type(name, &(var)); \ | 274 | param_check_##type(name, &(var)); \ |
248 | __module_param_call("", name, ¶m_ops_##type, \ | 275 | __module_param_call("", name, ¶m_ops_##type, &var, perm, 0) |
249 | &var, __same_type(var, bool), perm) | ||
250 | #endif /* !MODULE */ | 276 | #endif /* !MODULE */ |
251 | 277 | ||
252 | /** | 278 | /** |
@@ -264,7 +290,7 @@ static inline void __kernel_param_unlock(void) | |||
264 | = { len, string }; \ | 290 | = { len, string }; \ |
265 | __module_param_call(MODULE_PARAM_PREFIX, name, \ | 291 | __module_param_call(MODULE_PARAM_PREFIX, name, \ |
266 | ¶m_ops_string, \ | 292 | ¶m_ops_string, \ |
267 | .str = &__param_string_##name, 0, perm); \ | 293 | .str = &__param_string_##name, perm, 0); \ |
268 | __MODULE_PARM_TYPE(name, "string") | 294 | __MODULE_PARM_TYPE(name, "string") |
269 | 295 | ||
270 | /** | 296 | /** |
@@ -292,6 +318,8 @@ extern int parse_args(const char *name, | |||
292 | char *args, | 318 | char *args, |
293 | const struct kernel_param *params, | 319 | const struct kernel_param *params, |
294 | unsigned num, | 320 | unsigned num, |
321 | s16 level_min, | ||
322 | s16 level_max, | ||
295 | int (*unknown)(char *param, char *val)); | 323 | int (*unknown)(char *param, char *val)); |
296 | 324 | ||
297 | /* Called by module remove. */ | 325 | /* Called by module remove. */ |
@@ -403,7 +431,7 @@ extern int param_set_bint(const char *val, const struct kernel_param *kp); | |||
403 | __module_param_call(MODULE_PARAM_PREFIX, name, \ | 431 | __module_param_call(MODULE_PARAM_PREFIX, name, \ |
404 | ¶m_array_ops, \ | 432 | ¶m_array_ops, \ |
405 | .arr = &__param_arr_##name, \ | 433 | .arr = &__param_arr_##name, \ |
406 | __same_type(array[0], bool), perm); \ | 434 | perm, 0); \ |
407 | __MODULE_PARM_TYPE(name, "array of " #type) | 435 | __MODULE_PARM_TYPE(name, "array of " #type) |
408 | 436 | ||
409 | extern struct kernel_param_ops param_array_ops; | 437 | extern struct kernel_param_ops param_array_ops; |