All of lore.kernel.org
 help / color / mirror / Atom feed
* [HELP] How to get address of module
@ 2005-08-08 11:40 Hiroki Kaminaga
  2005-08-08 11:48 ` Stephen Rothwell
  2005-08-08 13:51 ` linux-os (Dick Johnson)
  0 siblings, 2 replies; 8+ messages in thread
From: Hiroki Kaminaga @ 2005-08-08 11:40 UTC (permalink / raw)
  To: linux-kernel


Hi!

I'm looking for *nice* way to get address of loaded module in 2.6.
I'd like to know the address from driver.

In 2.4, I wrote something like this:

 * * *

(in kernel src)
--- kernel/module.c
+++ kernel/module.c

struct module *module_list = &kernel_module;

+ struct module *get_module_queue(void)
+ {
+         return module_list;
+ }
+ 
+ 

... and in driver, I wrote:
            
        mod = get_module_queue();
        while (mod->next) {
                if (strcmp(mod->name, name) == 0)
                        return (unsigned long)(mod + 1);
                mod = mod->next;
        }
        return 0;

 * * *

I am now using 2.6 kernel. The choice I can think of is

1) make linux-2.6/kernel/module.c:find_module(const char *name)
   global func, not static, and use this func.

2) use linux-2.6/kernel/module.c:module_kallsyms_lookup_name(const char *name)
   and somehow get return value from module_get_kallsym(...)

choice 1) doesn't sound nice since it changes static func -> global
func, but cost of getting module address is low. On the other hand,
choice 2) will not modify kernel src, which sounds nice, but costs more,
and I'm not sure this method works.

Any advice?!


HK.
--

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-08-09  7:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-08 11:40 [HELP] How to get address of module Hiroki Kaminaga
2005-08-08 11:48 ` Stephen Rothwell
2005-08-08 12:06   ` Hiroki Kaminaga
2005-08-08 13:30     ` Arnd Bergmann
2005-08-09  0:43       ` Hiroki Kaminaga
2005-08-09  7:09         ` Jan Engelhardt
2005-08-08 13:51 ` linux-os (Dick Johnson)
2005-08-09  0:48   ` Hiroki Kaminaga

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.