[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: underscores and function names
That's true.
I often do similar bypasses with many of the __skb socket buffer functions.
- Michael
At 01:46 PM 1/3/2005, Om wrote:
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/
/*********************************/
Michael R. Hines
Grad Student, Florida State
Dept. Computer Science
http://www.cs.fsu.edu/~mhines/
Jusqu'à ce que le futur vienne...
/*********************************/
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
FAQ: http://kernelnewbies.org/faq/