module: __module_address
PATCH 2/9 module: __module_address
Impact: New API, cleanup
ksplice wants to know the bounds of a module, not just the module text.
It makes sense to have __module_address. We then implement is_module_address and __module_text_address in terms of this (and change is_module_text_address() to bool while we're at it).
Also, add proper kerneldoc for them all.
Cc Anders Kaseorg <[email protected]>
Cc Jeff Arnold <[email protected]>
Cc Tim Abbott <[email protected]>
Signed-off-by Rusty Russell <[email protected]>
--- include/linux/module.h | 20 +++++++++--- kernel/module.c | 76 +++++++++++++++++++++++++++++++++++++------------ 2 files changed, 73 insertions(+), 23 deletions(-)
include/linux/module.h +15 -5
@@ -361,7 +361,9 @@ static inline int module_is_live(struct/* Is this address in a module? (second is with no locks, for oops) */ struct module *module_text_address (unsigned long addr);struct module *__module_text_address (unsigned long addr); -int is_module_address (unsigned long addr); +struct module *__module_address (unsigned long addr); +bool is_module_address (unsigned long addr); +bool is_module_text_address (unsigned long addr);static inline int within_module_core (unsigned long addr,struct module *mod) {
@@ -490,21 +492,29 @@ search_module_extables(unsigned long addreturn NULL ; } -/* Is this address in a module? */ static inline struct module *module_text_address (unsigned long addr) {return NULL ; } -/* Is this address in a module? (don't take a lock, we're oopsing) */ +static inline struct module *__module_address (unsigned long addr) +{ +return NULL ; +} +static inline struct module *__module_text_address (unsigned long addr) {return NULL ; } -static inline int is_module_address (unsigned long addr) +static inline bool is_module_address (unsigned long addr) { -return 0 ; +return false; +} + +static inline bool is_module_text_address (unsigned long addr) +{ +return false; }/* Get/put a kernel symbol (calls should be symmetric) */
kernel/module.c +58 -18
104 lines not on this page · raw message