mirror of
https://github.com/tbsdtv/linux_media.git
synced 2025-07-23 12:43:29 +02:00
module: Move latched RB-tree support to a separate file
No functional change. This patch migrates module latched RB-tree support (e.g. see __module_address()) from core module code into kernel/module/tree_lookup.c. Reviewed-by: Christophe Leroy <christophe.leroy@csgroup.eu> Signed-off-by: Aaron Tomlin <atomlin@redhat.com> Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
This commit is contained in:
committed by
Luis Chamberlain
parent
1be9473e31
commit
58d208de3e
@@ -9,6 +9,7 @@
|
||||
#include <linux/compiler.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/rculist.h>
|
||||
|
||||
#ifndef ARCH_SHF_SMALL
|
||||
#define ARCH_SHF_SMALL 0
|
||||
@@ -93,3 +94,35 @@ static inline void module_decompress_cleanup(struct load_info *info)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_MODULES_TREE_LOOKUP
|
||||
struct mod_tree_root {
|
||||
struct latch_tree_root root;
|
||||
unsigned long addr_min;
|
||||
unsigned long addr_max;
|
||||
};
|
||||
|
||||
extern struct mod_tree_root mod_tree;
|
||||
|
||||
void mod_tree_insert(struct module *mod);
|
||||
void mod_tree_remove_init(struct module *mod);
|
||||
void mod_tree_remove(struct module *mod);
|
||||
struct module *mod_find(unsigned long addr);
|
||||
#else /* !CONFIG_MODULES_TREE_LOOKUP */
|
||||
|
||||
static inline void mod_tree_insert(struct module *mod) { }
|
||||
static inline void mod_tree_remove_init(struct module *mod) { }
|
||||
static inline void mod_tree_remove(struct module *mod) { }
|
||||
static inline struct module *mod_find(unsigned long addr)
|
||||
{
|
||||
struct module *mod;
|
||||
|
||||
list_for_each_entry_rcu(mod, &modules, list,
|
||||
lockdep_is_held(&module_mutex)) {
|
||||
if (within_module(addr, mod))
|
||||
return mod;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
#endif /* CONFIG_MODULES_TREE_LOOKUP */
|
||||
|
Reference in New Issue
Block a user