Re: Module related stuff

Gordon Chaffee (chaffee@cs.berkeley.edu)
Mon, 25 May 1998 09:57:11 -0700 (PDT)


Paul Gortmaker writes:
> if (get_module_symbol("", "request_module") == 0) {
> printk("%s: module auto-load (kmod) support not present.\n", driver);
> printk("%s: parent unable to auto-load daughter module.", driver);
> return -ENOSYS;
> }
>
> will fail if CONFIG_MODVERSIONS is enabled, but work if it is not
> enabled. Since get_module_symbol is currently not used anywhere in
> the kernel, I doubt that this has affected anything else but what
> I'm working on.

I would have sworn get_module_symbol was in use since I put it in to
enable Native Language Support, but I just searched for it, and it
isn't there. It isn't even used in any of my old NLS patches for
2.0.x which was when I first added it.

I think you can do something like this to get the correct name in both
cases. I'm doing this somewhat from memory, but I was using this idea
at some point in the past. The details might not be quite right.

/* Expand the symbol name to use the modversion symbol name */
#define SYMBOLNAME(x) SYMBOLNAME2(x)

/* Put quotes around the resulting modversion symbol name */
#define SYMBOLNAME2(x) #x

/* Search for the possibly expanded symbol name */
get_module_symbol(SYMBOLNAME(request_module))

- Gordon

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu