Re: EXPORT_SYMBOL and rebinding functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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).


Attachment: pgpFP7JLTeJCP.pgp
Description: PGP signature

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux