diff options
Diffstat (limited to 'include/linux/module.h')
| -rw-r--r-- | include/linux/module.h | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/include/linux/module.h b/include/linux/module.h index 8b17fd8c790d..9bdf27c7615b 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 | }; | ||
| 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 |
| @@ -350,7 +377,7 @@ struct module | |||
| 350 | keeping pointers to this stuff */ | 377 | keeping pointers to this stuff */ |
| 351 | char *args; | 378 | char *args; |
| 352 | #ifdef CONFIG_TRACEPOINTS | 379 | #ifdef CONFIG_TRACEPOINTS |
| 353 | struct tracepoint *tracepoints; | 380 | struct tracepoint * const *tracepoints_ptrs; |
| 354 | unsigned int num_tracepoints; | 381 | unsigned int num_tracepoints; |
| 355 | #endif | 382 | #endif |
| 356 | #ifdef HAVE_JUMP_LABEL | 383 | #ifdef HAVE_JUMP_LABEL |
| @@ -362,7 +389,7 @@ struct module | |||
| 362 | unsigned int num_trace_bprintk_fmt; | 389 | unsigned int num_trace_bprintk_fmt; |
| 363 | #endif | 390 | #endif |
| 364 | #ifdef CONFIG_EVENT_TRACING | 391 | #ifdef CONFIG_EVENT_TRACING |
| 365 | struct ftrace_event_call *trace_events; | 392 | struct ftrace_event_call **trace_events; |
| 366 | unsigned int num_trace_events; | 393 | unsigned int num_trace_events; |
| 367 | #endif | 394 | #endif |
| 368 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD | 395 | #ifdef CONFIG_FTRACE_MCOUNT_RECORD |
