lkml.org 
[lkml]   [2000]   [Aug]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Calling module functions from the kernel proper
Date

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/

\
 
 \ /
  Last update: 2005-03-22 13:58    [W:0.043 / U:2.672 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site