baettig@scs.ch said:
> > What is the best way to go about calling a kernel module's function(s)
> > from within the kernel itself?
> Sorry, I did not get it.
> What should happen if the kernel wants to call a function of your
> module and the module is not loaded yet???
int do_myroutine()
{
int (*myroutine_ptr)(void) = NULL;
int ret;
myroutine_ptr = get_module_symbol("", "myroutine");
if (!myroutine_ptr) {
request_module("mymodule");
myroutine_ptr = get_module_symbol("", "myroutine");
}
if (!myroutine_ptr)
return -EINVAL;
ret = (*myroutine_ptr)();
put_module_symbol(myroutine_ptr);
return ret;
}
-- dwmw2- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue Aug 15 2000 - 21:00:17 EST