On Tuesday, November 8, 2016 at 4:29:05 PM UTC-7, Raghu Murugesan wrote:
>
> I am reading the source code of open-iscsi. In source files, I see few 
> functions start with prefix "__". Whats the reason behind naming a function 
> with double underscore as prefix in general in C language?
>
> Example: In the file usr/iscsi_sysfs.c, the function name `static int 
> __get_host_no_from_hwaddress(void *data, struct host_info *info)`
>
> Thanks for reading the post
>
> - Raghu
>

I'm not sure if you are asking in general or specifically about this case.

In general, such naming is usually done to make it clear that routines like 
__get_host_no_from_hwaddress() are not called directory by external 
users.Also note that this function is static. This sort of naming is 
usually done, as well, to make it clear that there is an external interface 
(some name without underscores at the start) that is meant to be called 
externally and calls this function. In this case it's 
iscsi_sysfs_get_host_no_from_hwaddress().

I'm guessing (because I wasn't around back then) that the "__*" functions 
were copied from libudev at one time, but that is just a SWAG.

-- 
You received this message because you are subscribed to the Google Groups 
"open-iscsi" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to open-iscsi+unsubscr...@googlegroups.com.
To post to this group, send email to open-iscsi@googlegroups.com.
Visit this group at https://groups.google.com/group/open-iscsi.
For more options, visit https://groups.google.com/d/optout.

Reply via email to