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