diff options
Diffstat (limited to 'include/linux/module.h')
| -rw-r--r-- | include/linux/module.h | 42 |
1 files changed, 39 insertions, 3 deletions
diff --git a/include/linux/module.h b/include/linux/module.h index 7575bbbdf2a2..5de42043dff0 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
| @@ -58,6 +58,12 @@ struct module_attribute { | |||
| 58 | void (*free)(struct module *); | 58 | void (*free)(struct module *); |
| 59 | }; | 59 | }; |
| 60 | 60 | ||
| 61 | struct module_version_attribute { | ||
| 62 | struct module_attribute mattr; | ||
| 63 | const char *module_name; | ||
| 64 | const char *version; | ||
| 65 | } __attribute__ ((__aligned__(sizeof(void *)))); | ||
| 66 | |||
| 61 | struct module_kobject | 67 | struct module_kobject |
| 62 | { | 68 | { |
| 63 | struct kobject kobj; | 69 | struct kobject kobj; |
| @@ -161,7 +167,28 @@ extern struct module __this_module; | |||
| 161 | Using this automatically adds a checksum of the .c files and the | 167 | Using this automatically adds a checksum of the .c files and the |
| 162 | local headers in "srcversion". | 168 | local headers in "srcversion". |
| 163 | */ | 169 | */ |
| 170 | |||
| 171 | #if defined(MODULE) || !defined(CONFIG_SYSFS) | ||
| 164 | #define MODULE_VERSION(_version) MODULE_INFO(version, _version) | 172 | #define MODULE_VERSION(_version) MODULE_INFO(version, _version) |
| 173 | #else | ||
| 174 | #define MODULE_VERSION(_version) \ | ||
| 175 | extern ssize_t __modver_version_show(struct module_attribute *, \ | ||
| 176 | struct module *, char *); \ | ||
| 177 | static struct module_version_attribute __modver_version_attr \ | ||
| 178 | __used \ | ||
| 179 | __attribute__ ((__section__ ("__modver"),aligned(sizeof(void *)))) \ | ||
| 180 | = { \ | ||
| 181 | .mattr = { \ | ||
| 182 | .attr = { \ | ||
| 183 | .name = "version", \ | ||
| 184 | .mode = S_IRUGO, \ | ||
| 185 | }, \ | ||
| 186 | .show = __modver_version_show, \ | ||
| 187 | }, \ | ||
| 188 | .module_name = KBUILD_MODNAME, \ | ||
| 189 | .version = _version, \ | ||
| 190 | } | ||
| 191 | #endif | ||
| 165 | 192 | ||
| 166 | /* Optional firmware file (or files) needed by the module | 193 | /* Optional firmware file (or files) needed by the module |
| 167 | * format is simply firmware file name. Multiple firmware | 194 | * format is simply firmware file name. Multiple firmware |
| @@ -308,6 +335,9 @@ struct module | |||
| 308 | /* The size of the executable code in each section. */ | 335 | /* The size of the executable code in each section. */ |
| 309 | unsigned int init_text_size, core_text_size; | 336 | unsigned int init_text_size, core_text_size; |
| 310 | 337 | ||
| 338 | /* Size of RO sections of the module (text+rodata) */ | ||
| 339 | unsigned int init_ro_size, core_ro_size; | ||
| 340 | |||
| 311 | /* Arch-specific module values */ | 341 | /* Arch-specific module values */ |
| 312 | struct mod_arch_specific arch; | 342 | struct mod_arch_specific arch; |
| 313 | 343 | ||
| @@ -347,7 +377,7 @@ struct module | |||
| 347 | keeping pointers to this stuff */ | 377 | keeping pointers to this stuff */ |
| 348 | char *args; | 378 | char *args; |
| 349 | #ifdef CONFIG_TRACEPOINTS | 379 | #ifdef CONFIG_TRACEPOINTS |
| 350 | struct tracepoint *tracepoints; | 380 | struct tracepoint * const *tracepoints_ptrs; |
| 351 | unsigned int num_tracepoints; | 381 | unsigned int num_tracepoints; |
| 352 | #endif | 382 | #endif |
| 353 | #ifdef HAVE_JUMP_LABEL | 383 | #ifdef HAVE_JUMP_LABEL |
| @@ -359,7 +389,7 @@ struct module | |||
| 359 | unsigned int num_trace_bprintk_fmt; | 389 | unsigned int num_trace_bprintk_fmt; |
| 360 | #endif | 390 | #endif |
| 361 | #ifdef CONFIG_EVENT_TRACING | 391 | #ifdef CONFIG_EVENT_TRACING |
| 362 | struct ftrace_event_call *trace_events; | 392 | struct ftrace_event_call **trace_events; |
| 363 | unsigned int num_trace_events; | 393 | unsigned int num_trace_events; |
| 364 | #endif | 394 | #endif |
| 365 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | 395 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
| @@ -672,7 +702,6 @@ static inline int module_get_iter_tracepoints(struct tracepoint_iter *iter) | |||
| 672 | { | 702 | { |
| 673 | return 0; | 703 | return 0; |
| 674 | } | 704 | } |
| 675 | |||
| 676 | #endif /* CONFIG_MODULES */ | 705 | #endif /* CONFIG_MODULES */ |
| 677 | 706 | ||
| 678 | #ifdef CONFIG_SYSFS | 707 | #ifdef CONFIG_SYSFS |
| @@ -687,6 +716,13 @@ extern int module_sysfs_initialized; | |||
| 687 | 716 | ||
| 688 | #define __MODULE_STRING(x) __stringify(x) | 717 | #define __MODULE_STRING(x) __stringify(x) |
| 689 | 718 | ||
| 719 | #ifdef CONFIG_DEBUG_SET_MODULE_RONX | ||
| 720 | extern void set_all_modules_text_rw(void); | ||
| 721 | extern void set_all_modules_text_ro(void); | ||
| 722 | #else | ||
| 723 | static inline void set_all_modules_text_rw(void) { } | ||
| 724 | static inline void set_all_modules_text_ro(void) { } | ||
| 725 | #endif | ||
| 690 | 726 | ||
| 691 | #ifdef CONFIG_GENERIC_BUG | 727 | #ifdef CONFIG_GENERIC_BUG |
| 692 | void module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *, | 728 | void module_bug_finalize(const Elf_Ehdr *, const Elf_Shdr *, |
