Hi all,
On lun, giu 06, 2011 at 12:01:10 +0200, Antonio Quartulli wrote:
Hi Andrew, Thank you for replying
On dom, giu 05, 2011 at 11:42:36 +0200, Andrew Lunn wrote:
Hi Antonio
- tt_local_add(soft_iface, soft_iface->dev_addr);
- tt_local_add(soft_iface, soft_iface->dev_addr, 0);
Reading the code, it is not obvious what this 0 mean here. Did you see Sven's recent patches which introduced enums in various places? Maybe instead of a bool you could have an enum with two values: wired, wifi?
I've not looked at the other patches yet, but it might even make sense to have enums for wired, AP, client, adhoc?
Actually I only know whether the device is 802.11 or not. It could also be something different from both wired and wireless. However you are right, I should avoid the hardcoded zero. Maybe I can use NO_FLAGS as we did for the other patches.
Ok, this was not the case for NO_FLAGS (this is not a flag field). I introduced a new constant:
#define NULL_IFINDEX 0 /* dummy ifindex used to avoid iface checks */
I can't use an enum here because it is just a simple MACRO, not a set of values. However does it make sense to have several constats defined as 0? should we always use the same? But what about the name?
Later on someone else could add more enum values (interface types) and avoid using NO_FLAGS here (TT_CLIENT_WIFI is an enum already).
It is late. I mixed things up. These are two separated issues:
1) With NULL_IFINDEX I account the hardcoded 0.
2) Later on more enum values similar to TT_CLIENT_WIFI (e.g. TT_CLIENT_ETH, TT_CLIENT_ADHOC, etc..) can be added. But till now we only have is_wifi_iface().
Regards,