Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-f…
Browse files Browse the repository at this point in the history
…or-linus

* git://git.kernel.org/pub/scm/linux/kernel/git/rusty/linux-2.6-for-linus:
  module: fix bne2 "gave up waiting for init of module libcrc32c"
  module: verify_export_symbols under the lock
  module: move find_module check to end
  module: make locking more fine-grained.
  module: Make module sysfs functions private.
  module: move sysfs exposure to end of load_module
  module: fix kdb's illicit use of struct module_use.
  module: Make the 'usage' lists be two-way
  • Loading branch information
Linus Torvalds committed Jun 5, 2010
2 parents 8ce655e + 9bea7f2 commit 90ec781
Show file tree
Hide file tree
Showing 3 changed files with 221 additions and 155 deletions.
44 changes: 10 additions & 34 deletions include/linux/module.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,13 @@ void *__symbol_get(const char *symbol);
void *__symbol_get_gpl(const char *symbol);
#define symbol_get(x) ((typeof(&x))(__symbol_get(MODULE_SYMBOL_PREFIX #x)))

/* modules using other modules: kdb wants to see this. */
struct module_use {
struct list_head source_list;
struct list_head target_list;
struct module *source, *target;
};

#ifndef __GENKSYMS__
#ifdef CONFIG_MODVERSIONS
/* Mark the CRC weak since genksyms apparently decides not to
Expand Down Expand Up @@ -359,7 +366,9 @@ struct module

#ifdef CONFIG_MODULE_UNLOAD
/* What modules depend on me? */
struct list_head modules_which_use_me;
struct list_head source_list;
/* What modules do I depend on? */
struct list_head target_list;

/* Who is waiting for us to be unloaded */
struct task_struct *waiter;
Expand Down Expand Up @@ -663,43 +672,10 @@ static inline int module_get_iter_tracepoints(struct tracepoint_iter *iter)

#endif /* CONFIG_MODULES */

struct device_driver;
#ifdef CONFIG_SYSFS
struct module;

extern struct kset *module_kset;
extern struct kobj_type module_ktype;
extern int module_sysfs_initialized;

int mod_sysfs_init(struct module *mod);
int mod_sysfs_setup(struct module *mod,
struct kernel_param *kparam,
unsigned int num_params);
int module_add_modinfo_attrs(struct module *mod);
void module_remove_modinfo_attrs(struct module *mod);

#else /* !CONFIG_SYSFS */

static inline int mod_sysfs_init(struct module *mod)
{
return 0;
}

static inline int mod_sysfs_setup(struct module *mod,
struct kernel_param *kparam,
unsigned int num_params)
{
return 0;
}

static inline int module_add_modinfo_attrs(struct module *mod)
{
return 0;
}

static inline void module_remove_modinfo_attrs(struct module *mod)
{ }

#endif /* CONFIG_SYSFS */

#define symbol_request(x) try_then_request_module(symbol_get(x), "symbol:" #x)
Expand Down
12 changes: 3 additions & 9 deletions kernel/debug/kdb/kdb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1857,12 +1857,6 @@ static int kdb_ef(int argc, const char **argv)
}

#if defined(CONFIG_MODULES)
/* modules using other modules */
struct module_use {
struct list_head list;
struct module *module_which_uses;
};

/*
* kdb_lsmod - This function implements the 'lsmod' command. Lists
* currently loaded kernel modules.
Expand Down Expand Up @@ -1894,9 +1888,9 @@ static int kdb_lsmod(int argc, const char **argv)
{
struct module_use *use;
kdb_printf(" [ ");
list_for_each_entry(use, &mod->modules_which_use_me,
list)
kdb_printf("%s ", use->module_which_uses->name);
list_for_each_entry(use, &mod->source_list,
source_list)
kdb_printf("%s ", use->target->name);
kdb_printf("]\n");
}
#endif
Expand Down
Loading

0 comments on commit 90ec781

Please sign in to comment.