EXPORT_SYMBOL and rebinding functions

Peter Tosh blackspire.rider at gmail.com
Mon Jun 2 23:29:16 EDT 2014


Hey guys,

I have a module which defines a specific print function, and another
module that uses said function. From the first module I have used
EXPORT_SYMBOL(function_1). From within the second module I would like to
rebind that function to another printing function, and once I'm
finished, rebind it back to the original function.

So in theory the pseudo-code would look something like this

module_1.c

function_1()
{
	do some stuff
}

my_print_function = function_1

EXPORT_SYMBOL(my_print_function)

module_2.c



function_t()
{
	doing different stuff
}

placeholder = my_print_function
my_print_fuction = function_2

<do some other stuff>

my_print_function = placeholder

<END OF CODE>

My question is: Is this the correct way of doing this? Or will this
cause issues?




More information about the Kernelnewbies mailing list