]> Pileus Git - ~andy/linux/blob - include/linux/module.h
module: change attr callbacks to take struct module_kobject
[~andy/linux] / include / linux / module.h
1 #ifndef _LINUX_MODULE_H
2 #define _LINUX_MODULE_H
3 /*
4  * Dynamic loading of modules into the kernel.
5  *
6  * Rewritten by Richard Henderson <rth@tamu.edu> Dec 1996
7  * Rewritten again by Rusty Russell, 2002
8  */
9 #include <linux/list.h>
10 #include <linux/stat.h>
11 #include <linux/compiler.h>
12 #include <linux/cache.h>
13 #include <linux/kmod.h>
14 #include <linux/elf.h>
15 #include <linux/stringify.h>
16 #include <linux/kobject.h>
17 #include <linux/moduleparam.h>
18 #include <linux/tracepoint.h>
19
20 #include <linux/percpu.h>
21 #include <asm/module.h>
22
23 #include <trace/events/module.h>
24
25 /* Not Yet Implemented */
26 #define MODULE_SUPPORTED_DEVICE(name)
27
28 /* Some toolchains use a `_' prefix for all user symbols. */
29 #ifdef CONFIG_SYMBOL_PREFIX
30 #define MODULE_SYMBOL_PREFIX CONFIG_SYMBOL_PREFIX
31 #else
32 #define MODULE_SYMBOL_PREFIX ""
33 #endif
34
35 #define MODULE_NAME_LEN MAX_PARAM_PREFIX_LEN
36
37 struct kernel_symbol
38 {
39         unsigned long value;
40         const char *name;
41 };
42
43 struct modversion_info
44 {
45         unsigned long crc;
46         char name[MODULE_NAME_LEN];
47 };
48
49 struct module;
50
51 struct module_kobject {
52         struct kobject kobj;
53         struct module *mod;
54         struct kobject *drivers_dir;
55         struct module_param_attrs *mp;
56 };
57
58 struct module_attribute {
59         struct attribute attr;
60         ssize_t (*show)(struct module_attribute *, struct module_kobject *,
61                         char *);
62         ssize_t (*store)(struct module_attribute *, struct module_kobject *,
63                          const char *, size_t count);
64         void (*setup)(struct module *, const char *);
65         int (*test)(struct module *);
66         void (*free)(struct module *);
67 };
68
69 struct module_version_attribute {
70         struct module_attribute mattr;
71         const char *module_name;
72         const char *version;
73 } __attribute__ ((__aligned__(sizeof(void *))));
74
75 extern ssize_t __modver_version_show(struct module_attribute *,
76                                      struct module_kobject *, char *);
77
78
79 /* These are either module local, or the kernel's dummy ones. */
80 extern int init_module(void);
81 extern void cleanup_module(void);
82
83 /* Archs provide a method of finding the correct exception table. */
84 struct exception_table_entry;
85
86 const struct exception_table_entry *
87 search_extable(const struct exception_table_entry *first,
88                const struct exception_table_entry *last,
89                unsigned long value);
90 void sort_extable(struct exception_table_entry *start,
91                   struct exception_table_entry *finish);
92 void sort_main_extable(void);
93 void trim_init_extable(struct module *m);
94
95 #ifdef MODULE
96 #define MODULE_GENERIC_TABLE(gtype,name)                        \
97 extern const struct gtype##_id __mod_##gtype##_table            \
98   __attribute__ ((unused, alias(__stringify(name))))
99
100 extern struct module __this_module;
101 #define THIS_MODULE (&__this_module)
102 #else  /* !MODULE */
103 #define MODULE_GENERIC_TABLE(gtype,name)
104 #define THIS_MODULE ((struct module *)0)
105 #endif
106
107 /* Generic info of form tag = "info" */
108 #define MODULE_INFO(tag, info) __MODULE_INFO(tag, tag, info)
109
110 /* For userspace: you can also call me... */
111 #define MODULE_ALIAS(_alias) MODULE_INFO(alias, _alias)
112
113 /*
114  * The following license idents are currently accepted as indicating free
115  * software modules
116  *
117  *      "GPL"                           [GNU Public License v2 or later]
118  *      "GPL v2"                        [GNU Public License v2]
119  *      "GPL and additional rights"     [GNU Public License v2 rights and more]
120  *      "Dual BSD/GPL"                  [GNU Public License v2
121  *                                       or BSD license choice]
122  *      "Dual MIT/GPL"                  [GNU Public License v2
123  *                                       or MIT license choice]
124  *      "Dual MPL/GPL"                  [GNU Public License v2
125  *                                       or Mozilla license choice]
126  *
127  * The following other idents are available
128  *
129  *      "Proprietary"                   [Non free products]
130  *
131  * There are dual licensed components, but when running with Linux it is the
132  * GPL that is relevant so this is a non issue. Similarly LGPL linked with GPL
133  * is a GPL combined work.
134  *
135  * This exists for several reasons
136  * 1.   So modinfo can show license info for users wanting to vet their setup 
137  *      is free
138  * 2.   So the community can ignore bug reports including proprietary modules
139  * 3.   So vendors can do likewise based on their own policies
140  */
141 #define MODULE_LICENSE(_license) MODULE_INFO(license, _license)
142
143 /*
144  * Author(s), use "Name <email>" or just "Name", for multiple
145  * authors use multiple MODULE_AUTHOR() statements/lines.
146  */
147 #define MODULE_AUTHOR(_author) MODULE_INFO(author, _author)
148   
149 /* What your module does. */
150 #define MODULE_DESCRIPTION(_description) MODULE_INFO(description, _description)
151
152 /* One for each parameter, describing how to use it.  Some files do
153    multiple of these per line, so can't just use MODULE_INFO. */
154 #define MODULE_PARM_DESC(_parm, desc) \
155         __MODULE_INFO(parm, _parm, #_parm ":" desc)
156
157 #define MODULE_DEVICE_TABLE(type,name)          \
158   MODULE_GENERIC_TABLE(type##_device,name)
159
160 /* Version of form [<epoch>:]<version>[-<extra-version>].
161    Or for CVS/RCS ID version, everything but the number is stripped.
162   <epoch>: A (small) unsigned integer which allows you to start versions
163            anew. If not mentioned, it's zero.  eg. "2:1.0" is after
164            "1:2.0".
165   <version>: The <version> may contain only alphanumerics and the
166            character `.'.  Ordered by numeric sort for numeric parts,
167            ascii sort for ascii parts (as per RPM or DEB algorithm).
168   <extraversion>: Like <version>, but inserted for local
169            customizations, eg "rh3" or "rusty1".
170
171   Using this automatically adds a checksum of the .c files and the
172   local headers in "srcversion".
173 */
174
175 #if defined(MODULE) || !defined(CONFIG_SYSFS)
176 #define MODULE_VERSION(_version) MODULE_INFO(version, _version)
177 #else
178 #define MODULE_VERSION(_version)                                        \
179         static struct module_version_attribute ___modver_attr = {       \
180                 .mattr  = {                                             \
181                         .attr   = {                                     \
182                                 .name   = "version",                    \
183                                 .mode   = S_IRUGO,                      \
184                         },                                              \
185                         .show   = __modver_version_show,                \
186                 },                                                      \
187                 .module_name    = KBUILD_MODNAME,                       \
188                 .version        = _version,                             \
189         };                                                              \
190         static const struct module_version_attribute                    \
191         __used __attribute__ ((__section__ ("__modver")))               \
192         * __moduleparam_const __modver_attr = &___modver_attr
193 #endif
194
195 /* Optional firmware file (or files) needed by the module
196  * format is simply firmware file name.  Multiple firmware
197  * files require multiple MODULE_FIRMWARE() specifiers */
198 #define MODULE_FIRMWARE(_firmware) MODULE_INFO(firmware, _firmware)
199
200 /* Given an address, look for it in the exception tables */
201 const struct exception_table_entry *search_exception_tables(unsigned long add);
202
203 struct notifier_block;
204
205 #ifdef CONFIG_MODULES
206
207 extern int modules_disabled; /* for sysctl */
208 /* Get/put a kernel symbol (calls must be symmetric) */
209 void *__symbol_get(const char *symbol);
210 void *__symbol_get_gpl(const char *symbol);
211 #define symbol_get(x) ((typeof(&x))(__symbol_get(MODULE_SYMBOL_PREFIX #x)))
212
213 /* modules using other modules: kdb wants to see this. */
214 struct module_use {
215         struct list_head source_list;
216         struct list_head target_list;
217         struct module *source, *target;
218 };
219
220 #ifndef __GENKSYMS__
221 #ifdef CONFIG_MODVERSIONS
222 /* Mark the CRC weak since genksyms apparently decides not to
223  * generate a checksums for some symbols */
224 #define __CRC_SYMBOL(sym, sec)                                  \
225         extern void *__crc_##sym __attribute__((weak));         \
226         static const unsigned long __kcrctab_##sym              \
227         __used                                                  \
228         __attribute__((section("___kcrctab" sec "+" #sym), unused))     \
229         = (unsigned long) &__crc_##sym;
230 #else
231 #define __CRC_SYMBOL(sym, sec)
232 #endif
233
234 /* For every exported symbol, place a struct in the __ksymtab section */
235 #define __EXPORT_SYMBOL(sym, sec)                               \
236         extern typeof(sym) sym;                                 \
237         __CRC_SYMBOL(sym, sec)                                  \
238         static const char __kstrtab_##sym[]                     \
239         __attribute__((section("__ksymtab_strings"), aligned(1))) \
240         = MODULE_SYMBOL_PREFIX #sym;                            \
241         static const struct kernel_symbol __ksymtab_##sym       \
242         __used                                                  \
243         __attribute__((section("___ksymtab" sec "+" #sym), unused))     \
244         = { (unsigned long)&sym, __kstrtab_##sym }
245
246 #define EXPORT_SYMBOL(sym)                                      \
247         __EXPORT_SYMBOL(sym, "")
248
249 #define EXPORT_SYMBOL_GPL(sym)                                  \
250         __EXPORT_SYMBOL(sym, "_gpl")
251
252 #define EXPORT_SYMBOL_GPL_FUTURE(sym)                           \
253         __EXPORT_SYMBOL(sym, "_gpl_future")
254
255
256 #ifdef CONFIG_UNUSED_SYMBOLS
257 #define EXPORT_UNUSED_SYMBOL(sym) __EXPORT_SYMBOL(sym, "_unused")
258 #define EXPORT_UNUSED_SYMBOL_GPL(sym) __EXPORT_SYMBOL(sym, "_unused_gpl")
259 #else
260 #define EXPORT_UNUSED_SYMBOL(sym)
261 #define EXPORT_UNUSED_SYMBOL_GPL(sym)
262 #endif
263
264 #endif
265
266 enum module_state
267 {
268         MODULE_STATE_LIVE,
269         MODULE_STATE_COMING,
270         MODULE_STATE_GOING,
271 };
272
273 struct module
274 {
275         enum module_state state;
276
277         /* Member of list of modules */
278         struct list_head list;
279
280         /* Unique handle for this module */
281         char name[MODULE_NAME_LEN];
282
283         /* Sysfs stuff. */
284         struct module_kobject mkobj;
285         struct module_attribute *modinfo_attrs;
286         const char *version;
287         const char *srcversion;
288         struct kobject *holders_dir;
289
290         /* Exported symbols */
291         const struct kernel_symbol *syms;
292         const unsigned long *crcs;
293         unsigned int num_syms;
294
295         /* Kernel parameters. */
296         struct kernel_param *kp;
297         unsigned int num_kp;
298
299         /* GPL-only exported symbols. */
300         unsigned int num_gpl_syms;
301         const struct kernel_symbol *gpl_syms;
302         const unsigned long *gpl_crcs;
303
304 #ifdef CONFIG_UNUSED_SYMBOLS
305         /* unused exported symbols. */
306         const struct kernel_symbol *unused_syms;
307         const unsigned long *unused_crcs;
308         unsigned int num_unused_syms;
309
310         /* GPL-only, unused exported symbols. */
311         unsigned int num_unused_gpl_syms;
312         const struct kernel_symbol *unused_gpl_syms;
313         const unsigned long *unused_gpl_crcs;
314 #endif
315
316         /* symbols that will be GPL-only in the near future. */
317         const struct kernel_symbol *gpl_future_syms;
318         const unsigned long *gpl_future_crcs;
319         unsigned int num_gpl_future_syms;
320
321         /* Exception table */
322         unsigned int num_exentries;
323         struct exception_table_entry *extable;
324
325         /* Startup function. */
326         int (*init)(void);
327
328         /* If this is non-NULL, vfree after init() returns */
329         void *module_init;
330
331         /* Here is the actual code + data, vfree'd on unload. */
332         void *module_core;
333
334         /* Here are the sizes of the init and core sections */
335         unsigned int init_size, core_size;
336
337         /* The size of the executable code in each section.  */
338         unsigned int init_text_size, core_text_size;
339
340         /* Size of RO sections of the module (text+rodata) */
341         unsigned int init_ro_size, core_ro_size;
342
343         /* Arch-specific module values */
344         struct mod_arch_specific arch;
345
346         unsigned int taints;    /* same bits as kernel:tainted */
347
348 #ifdef CONFIG_GENERIC_BUG
349         /* Support for BUG */
350         unsigned num_bugs;
351         struct list_head bug_list;
352         struct bug_entry *bug_table;
353 #endif
354
355 #ifdef CONFIG_KALLSYMS
356         /*
357          * We keep the symbol and string tables for kallsyms.
358          * The core_* fields below are temporary, loader-only (they
359          * could really be discarded after module init).
360          */
361         Elf_Sym *symtab, *core_symtab;
362         unsigned int num_symtab, core_num_syms;
363         char *strtab, *core_strtab;
364
365         /* Section attributes */
366         struct module_sect_attrs *sect_attrs;
367
368         /* Notes attributes */
369         struct module_notes_attrs *notes_attrs;
370 #endif
371
372         /* The command line arguments (may be mangled).  People like
373            keeping pointers to this stuff */
374         char *args;
375
376 #ifdef CONFIG_SMP
377         /* Per-cpu data. */
378         void __percpu *percpu;
379         unsigned int percpu_size;
380 #endif
381
382 #ifdef CONFIG_TRACEPOINTS
383         unsigned int num_tracepoints;
384         struct tracepoint * const *tracepoints_ptrs;
385 #endif
386 #ifdef HAVE_JUMP_LABEL
387         struct jump_entry *jump_entries;
388         unsigned int num_jump_entries;
389 #endif
390 #ifdef CONFIG_TRACING
391         unsigned int num_trace_bprintk_fmt;
392         const char **trace_bprintk_fmt_start;
393 #endif
394 #ifdef CONFIG_EVENT_TRACING
395         struct ftrace_event_call **trace_events;
396         unsigned int num_trace_events;
397 #endif
398 #ifdef CONFIG_FTRACE_MCOUNT_RECORD
399         unsigned int num_ftrace_callsites;
400         unsigned long *ftrace_callsites;
401 #endif
402
403 #ifdef CONFIG_MODULE_UNLOAD
404         /* What modules depend on me? */
405         struct list_head source_list;
406         /* What modules do I depend on? */
407         struct list_head target_list;
408
409         /* Who is waiting for us to be unloaded */
410         struct task_struct *waiter;
411
412         /* Destruction function. */
413         void (*exit)(void);
414
415         struct module_ref {
416                 unsigned int incs;
417                 unsigned int decs;
418         } __percpu *refptr;
419 #endif
420
421 #ifdef CONFIG_CONSTRUCTORS
422         /* Constructor functions. */
423         ctor_fn_t *ctors;
424         unsigned int num_ctors;
425 #endif
426 };
427 #ifndef MODULE_ARCH_INIT
428 #define MODULE_ARCH_INIT {}
429 #endif
430
431 extern struct mutex module_mutex;
432
433 /* FIXME: It'd be nice to isolate modules during init, too, so they
434    aren't used before they (may) fail.  But presently too much code
435    (IDE & SCSI) require entry into the module during init.*/
436 static inline int module_is_live(struct module *mod)
437 {
438         return mod->state != MODULE_STATE_GOING;
439 }
440
441 struct module *__module_text_address(unsigned long addr);
442 struct module *__module_address(unsigned long addr);
443 bool is_module_address(unsigned long addr);
444 bool is_module_percpu_address(unsigned long addr);
445 bool is_module_text_address(unsigned long addr);
446
447 static inline int within_module_core(unsigned long addr, struct module *mod)
448 {
449         return (unsigned long)mod->module_core <= addr &&
450                addr < (unsigned long)mod->module_core + mod->core_size;
451 }
452
453 static inline int within_module_init(unsigned long addr, struct module *mod)
454 {
455         return (unsigned long)mod->module_init <= addr &&
456                addr < (unsigned long)mod->module_init + mod->init_size;
457 }
458
459 /* Search for module by name: must hold module_mutex. */
460 struct module *find_module(const char *name);
461
462 struct symsearch {
463         const struct kernel_symbol *start, *stop;
464         const unsigned long *crcs;
465         enum {
466                 NOT_GPL_ONLY,
467                 GPL_ONLY,
468                 WILL_BE_GPL_ONLY,
469         } licence;
470         bool unused;
471 };
472
473 /* Search for an exported symbol by name. */
474 const struct kernel_symbol *find_symbol(const char *name,
475                                         struct module **owner,
476                                         const unsigned long **crc,
477                                         bool gplok,
478                                         bool warn);
479
480 /* Walk the exported symbol table */
481 bool each_symbol_section(bool (*fn)(const struct symsearch *arr,
482                                     struct module *owner,
483                                     void *data), void *data);
484
485 /* Returns 0 and fills in value, defined and namebuf, or -ERANGE if
486    symnum out of range. */
487 int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
488                         char *name, char *module_name, int *exported);
489
490 /* Look for this name: can be of form module:name. */
491 unsigned long module_kallsyms_lookup_name(const char *name);
492
493 int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
494                                              struct module *, unsigned long),
495                                    void *data);
496
497 extern void __module_put_and_exit(struct module *mod, long code)
498         __attribute__((noreturn));
499 #define module_put_and_exit(code) __module_put_and_exit(THIS_MODULE, code);
500
501 #ifdef CONFIG_MODULE_UNLOAD
502 unsigned int module_refcount(struct module *mod);
503 void __symbol_put(const char *symbol);
504 #define symbol_put(x) __symbol_put(MODULE_SYMBOL_PREFIX #x)
505 void symbol_put_addr(void *addr);
506
507 /* Sometimes we know we already have a refcount, and it's easier not
508    to handle the error case (which only happens with rmmod --wait). */
509 static inline void __module_get(struct module *module)
510 {
511         if (module) {
512                 preempt_disable();
513                 __this_cpu_inc(module->refptr->incs);
514                 trace_module_get(module, _THIS_IP_);
515                 preempt_enable();
516         }
517 }
518
519 static inline int try_module_get(struct module *module)
520 {
521         int ret = 1;
522
523         if (module) {
524                 preempt_disable();
525
526                 if (likely(module_is_live(module))) {
527                         __this_cpu_inc(module->refptr->incs);
528                         trace_module_get(module, _THIS_IP_);
529                 } else
530                         ret = 0;
531
532                 preempt_enable();
533         }
534         return ret;
535 }
536
537 extern void module_put(struct module *module);
538
539 #else /*!CONFIG_MODULE_UNLOAD*/
540 static inline int try_module_get(struct module *module)
541 {
542         return !module || module_is_live(module);
543 }
544 static inline void module_put(struct module *module)
545 {
546 }
547 static inline void __module_get(struct module *module)
548 {
549 }
550 #define symbol_put(x) do { } while(0)
551 #define symbol_put_addr(p) do { } while(0)
552
553 #endif /* CONFIG_MODULE_UNLOAD */
554 int ref_module(struct module *a, struct module *b);
555
556 /* This is a #define so the string doesn't get put in every .o file */
557 #define module_name(mod)                        \
558 ({                                              \
559         struct module *__mod = (mod);           \
560         __mod ? __mod->name : "kernel";         \
561 })
562
563 /* For kallsyms to ask for address resolution.  namebuf should be at
564  * least KSYM_NAME_LEN long: a pointer to namebuf is returned if
565  * found, otherwise NULL. */
566 const char *module_address_lookup(unsigned long addr,
567                             unsigned long *symbolsize,
568                             unsigned long *offset,
569                             char **modname,
570                             char *namebuf);
571 int lookup_module_symbol_name(unsigned long addr, char *symname);
572 int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name);
573
574 /* For extable.c to search modules' exception tables. */
575 const struct exception_table_entry *search_module_extables(unsigned long addr);
576
577 int register_module_notifier(struct notifier_block * nb);
578 int unregister_module_notifier(struct notifier_block * nb);
579
580 extern void print_modules(void);
581
582 extern void module_update_tracepoints(void);
583 extern int module_get_iter_tracepoints(struct tracepoint_iter *iter);
584
585 #else /* !CONFIG_MODULES... */
586 #define EXPORT_SYMBOL(sym)
587 #define EXPORT_SYMBOL_GPL(sym)
588 #define EXPORT_SYMBOL_GPL_FUTURE(sym)
589 #define EXPORT_UNUSED_SYMBOL(sym)
590 #define EXPORT_UNUSED_SYMBOL_GPL(sym)
591
592 /* Given an address, look for it in the exception tables. */
593 static inline const struct exception_table_entry *
594 search_module_extables(unsigned long addr)
595 {
596         return NULL;
597 }
598
599 static inline struct module *__module_address(unsigned long addr)
600 {
601         return NULL;
602 }
603
604 static inline struct module *__module_text_address(unsigned long addr)
605 {
606         return NULL;
607 }
608
609 static inline bool is_module_address(unsigned long addr)
610 {
611         return false;
612 }
613
614 static inline bool is_module_percpu_address(unsigned long addr)
615 {
616         return false;
617 }
618
619 static inline bool is_module_text_address(unsigned long addr)
620 {
621         return false;
622 }
623
624 /* Get/put a kernel symbol (calls should be symmetric) */
625 #define symbol_get(x) ({ extern typeof(x) x __attribute__((weak)); &(x); })
626 #define symbol_put(x) do { } while(0)
627 #define symbol_put_addr(x) do { } while(0)
628
629 static inline void __module_get(struct module *module)
630 {
631 }
632
633 static inline int try_module_get(struct module *module)
634 {
635         return 1;
636 }
637
638 static inline void module_put(struct module *module)
639 {
640 }
641
642 #define module_name(mod) "kernel"
643
644 /* For kallsyms to ask for address resolution.  NULL means not found. */
645 static inline const char *module_address_lookup(unsigned long addr,
646                                           unsigned long *symbolsize,
647                                           unsigned long *offset,
648                                           char **modname,
649                                           char *namebuf)
650 {
651         return NULL;
652 }
653
654 static inline int lookup_module_symbol_name(unsigned long addr, char *symname)
655 {
656         return -ERANGE;
657 }
658
659 static inline int lookup_module_symbol_attrs(unsigned long addr, unsigned long *size, unsigned long *offset, char *modname, char *name)
660 {
661         return -ERANGE;
662 }
663
664 static inline int module_get_kallsym(unsigned int symnum, unsigned long *value,
665                                         char *type, char *name,
666                                         char *module_name, int *exported)
667 {
668         return -ERANGE;
669 }
670
671 static inline unsigned long module_kallsyms_lookup_name(const char *name)
672 {
673         return 0;
674 }
675
676 static inline int module_kallsyms_on_each_symbol(int (*fn)(void *, const char *,
677                                                            struct module *,
678                                                            unsigned long),
679                                                  void *data)
680 {
681         return 0;
682 }
683
684 static inline int register_module_notifier(struct notifier_block * nb)
685 {
686         /* no events will happen anyway, so this can always succeed */
687         return 0;
688 }
689
690 static inline int unregister_module_notifier(struct notifier_block * nb)
691 {
692         return 0;
693 }
694
695 #define module_put_and_exit(code) do_exit(code)
696
697 static inline void print_modules(void)
698 {
699 }
700
701 static inline void module_update_tracepoints(void)
702 {
703 }
704
705 static inline int module_get_iter_tracepoints(struct tracepoint_iter *iter)
706 {
707         return 0;
708 }
709 #endif /* CONFIG_MODULES */
710
711 #ifdef CONFIG_SYSFS
712 extern struct kset *module_kset;
713 extern struct kobj_type module_ktype;
714 extern int module_sysfs_initialized;
715 #endif /* CONFIG_SYSFS */
716
717 #define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x)
718
719 /* BELOW HERE ALL THESE ARE OBSOLETE AND WILL VANISH */
720
721 #define __MODULE_STRING(x) __stringify(x)
722
723 #ifdef CONFIG_DEBUG_SET_MODULE_RONX
724 extern void set_all_modules_text_rw(void);
725 extern void set_all_modules_text_ro(void);
726 #else
727 static inline void set_all_modules_text_rw(void) { }
728 static inline void set_all_modules_text_ro(void) { }
729 #endif
730
731 #ifdef CONFIG_GENERIC_BUG
732 void module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *,
733                          struct module *);
734 void module_bug_cleanup(struct module *);
735
736 #else   /* !CONFIG_GENERIC_BUG */
737
738 static inline void module_bug_finalize(const Elf_Ehdr *hdr,
739                                         const Elf_Shdr *sechdrs,
740                                         struct module *mod)
741 {
742 }
743 static inline void module_bug_cleanup(struct module *mod) {}
744 #endif  /* CONFIG_GENERIC_BUG */
745
746 #endif /* _LINUX_MODULE_H */