[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: underscores and function names
Michael R. Hines wrote:
The ones with underscores usually have matching functions withOUT
underscores. They are meant to be private calls.
The ones without underscores usually call the one with underscores, and
these are the ones that actually do the work.
The kernel will sometimes call the underscore'd functions directly
because it knows what it's doing.......
But while programming, we should generally call the ones without them.
Yes, unless we know what we do ;-)
for example, lets take arch/i386/lib/usercopy.c : copy_to_user(). This
function performs some checks (access_ok()) on the passed parameter and
then call the actual function that implements the functionlity
include/asm/uaccess.h:__copy_to_user(). The implementation might use
other functions as well.
If the target area is already checked for access_ok, then the caller
call skip the call copy_to_user() and make a call directly to
__copy_to_user(). This will save some time/code size.
I am not familiar with functions with single underscore starting. But
the idea is same.
HTH.
Om.
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/