eloop_register_read_sock() data argument order - BUG or just inconsistency or nothing?
Jouni Malinen
j
Fri Mar 26 21:24:55 PDT 2010
On Thu, Mar 25, 2010 at 04:20:55PM -0400, Patrik Lahti wrote:
> E.g. driver_wext.c:wpa_driver_wext_init() does this:
>
> eloop_register_read_sock(s, wpa_driver_wext_event_receive, drv, ctx);
>
> But driver_bsd.c:wpa_driver_bsd_init() does:
>
> eloop_register_read_sock(drv->route,
> wpa_driver_bsd_event_receive, ctx, drv);
> int eloop_register_read_sock(int sock, eloop_sock_handler handler,
> void *eloop_data, void *user_data);
> I think driver_bsd.c is correct, or am I missing something? Maybe it
> doesn't matter...? It seems the eloop_data is conceptually the global
> context and user_data is the local context. And it would make sense that
> the drv is passed to eloop_register_read_sock() as the local context
> like driver_bsd.c does.
There were some (now more or less historic) reasons behind the names
used for the context data and why there are two of them. However, no
particular convention is really followed that clearly anymore. As long
as the code that registers the callback and the callback function itself
use the parameters consistently, it does not really matter what is used
as "eloop_data" and what as "user_data".
--
Jouni Malinen PGP id EFC895FA
More information about the Hostap
mailing list