EXPORT_SYMBOL and rebinding functions

Valdis.Kletnieks at vt.edu Valdis.Kletnieks at vt.edu
Tue Jun 3 09:03:13 EDT 2014


On Mon, 02 Jun 2014 20:29:16 -0700, Peter Tosh said:


> function_1()
> {
> 	do some stuff
> }
>
> my_print_function = function_1
>
> EXPORT_SYMBOL(my_print_function)

No, you want EXPORT_SYMBOL(function_1) here.

> function_t()
> {
> 	doing different stuff
> }
>
> my_print_fuction = function_2

And just another function pointer assignment here
> (other code)

> my_print_function = function_1

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

The correct way to do this would be just use a call through a function
pointer - that way any other code that's at a different point in
execution doesn't end up calling something unexpected.(because let's
face it - if the code is expecting to call function_1, and it suddenly
ends up in function_2 anyhow, it will quite possibly misbehave).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140603/f5106241/attachment.bin 


More information about the Kernelnewbies mailing list