@@ -248,6 +248,10 @@ struct module
248248 const unsigned long * crcs ;
249249 unsigned int num_syms ;
250250
251+ /* Kernel parameters. */
252+ struct kernel_param * kp ;
253+ unsigned int num_kp ;
254+
251255 /* GPL-only exported symbols. */
252256 unsigned int num_gpl_syms ;
253257 const struct kernel_symbol * gpl_syms ;
@@ -350,6 +354,8 @@ struct module
350354#define MODULE_ARCH_INIT {}
351355#endif
352356
357+ extern struct mutex module_mutex ;
358+
353359/* FIXME: It'd be nice to isolate modules during init, too, so they
354360 aren't used before they (may) fail. But presently too much code
355361 (IDE & SCSI) require entry into the module during init.*/
@@ -358,10 +364,10 @@ static inline int module_is_live(struct module *mod)
358364 return mod -> state != MODULE_STATE_GOING ;
359365}
360366
361- /* Is this address in a module? (second is with no locks, for oops) */
362- struct module * module_text_address (unsigned long addr );
363367struct module * __module_text_address (unsigned long addr );
364- int is_module_address (unsigned long addr );
368+ struct module * __module_address (unsigned long addr );
369+ bool is_module_address (unsigned long addr );
370+ bool is_module_text_address (unsigned long addr );
365371
366372static inline int within_module_core (unsigned long addr , struct module * mod )
367373{
@@ -375,6 +381,31 @@ static inline int within_module_init(unsigned long addr, struct module *mod)
375381 addr < (unsigned long )mod -> module_init + mod -> init_size ;
376382}
377383
384+ /* Search for module by name: must hold module_mutex. */
385+ struct module * find_module (const char * name );
386+
387+ struct symsearch {
388+ const struct kernel_symbol * start , * stop ;
389+ const unsigned long * crcs ;
390+ enum {
391+ NOT_GPL_ONLY ,
392+ GPL_ONLY ,
393+ WILL_BE_GPL_ONLY ,
394+ } licence ;
395+ bool unused ;
396+ };
397+
398+ /* Search for an exported symbol by name. */
399+ const struct kernel_symbol * find_symbol (const char * name ,
400+ struct module * * owner ,
401+ const unsigned long * * crc ,
402+ bool gplok ,
403+ bool warn );
404+
405+ /* Walk the exported symbol table */
406+ bool each_symbol (bool (* fn )(const struct symsearch * arr , struct module * owner ,
407+ unsigned int symnum , void * data ), void * data );
408+
378409/* Returns 0 and fills in value, defined and namebuf, or -ERANGE if
379410 symnum out of range. */
380411int module_get_kallsym (unsigned int symnum , unsigned long * value , char * type ,
@@ -383,6 +414,10 @@ int module_get_kallsym(unsigned int symnum, unsigned long *value, char *type,
383414/* Look for this name: can be of form module:name. */
384415unsigned long module_kallsyms_lookup_name (const char * name );
385416
417+ int module_kallsyms_on_each_symbol (int (* fn )(void * , const char * ,
418+ struct module * , unsigned long ),
419+ void * data );
420+
386421extern void __module_put_and_exit (struct module * mod , long code )
387422 __attribute__((noreturn ));
388423#define module_put_and_exit (code ) __module_put_and_exit(THIS_MODULE, code);
@@ -444,6 +479,7 @@ static inline void __module_get(struct module *module)
444479#define symbol_put_addr (p ) do { } while(0)
445480
446481#endif /* CONFIG_MODULE_UNLOAD */
482+ int use_module (struct module * a , struct module * b );
447483
448484/* This is a #define so the string doesn't get put in every .o file */
449485#define module_name (mod ) \
@@ -490,21 +526,24 @@ search_module_extables(unsigned long addr)
490526 return NULL ;
491527}
492528
493- /* Is this address in a module? */
494- static inline struct module * module_text_address (unsigned long addr )
529+ static inline struct module * __module_address (unsigned long addr )
495530{
496531 return NULL ;
497532}
498533
499- /* Is this address in a module? (don't take a lock, we're oopsing) */
500534static inline struct module * __module_text_address (unsigned long addr )
501535{
502536 return NULL ;
503537}
504538
505- static inline int is_module_address (unsigned long addr )
539+ static inline bool is_module_address (unsigned long addr )
506540{
507- return 0 ;
541+ return false;
542+ }
543+
544+ static inline bool is_module_text_address (unsigned long addr )
545+ {
546+ return false;
508547}
509548
510549/* Get/put a kernel symbol (calls should be symmetric) */
@@ -559,6 +598,14 @@ static inline unsigned long module_kallsyms_lookup_name(const char *name)
559598 return 0 ;
560599}
561600
601+ static inline int module_kallsyms_on_each_symbol (int (* fn )(void * , const char * ,
602+ struct module * ,
603+ unsigned long ),
604+ void * data )
605+ {
606+ return 0 ;
607+ }
608+
562609static inline int register_module_notifier (struct notifier_block * nb )
563610{
564611 /* no events will happen anyway, so this can always succeed */
0 commit comments