[1/6] batman-adv: unify the three starting fields of the tt_local/global_entry structures
Commit Message
Now the three starting fields of the tt_local/global_entry structures are
unified. This allows to write generalised functions that operate on the
flags and refcount field.
Signed-off-by: Antonio Quartulli <ordex@autistici.org>
---
types.h | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
Comments
On Tuesday 05 July 2011 17:23:00 Antonio Quartulli wrote:
> Now the three starting fields of the tt_local/global_entry structures are
> unified. This allows to write generalised functions that operate on the
> flags and refcount field.
>
> Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> ---
Ehrm, this is wrong (or at least undefined behaviour). Please read C99 6.5.2.3
point 5
Kind regards,
Sven
On Wednesday 06 July 2011 09:31:11 Sven Eckelmann wrote:
> On Tuesday 05 July 2011 17:23:00 Antonio Quartulli wrote:
> > Now the three starting fields of the tt_local/global_entry structures
> > are
> > unified. This allows to write generalised functions that operate on the
> > flags and refcount field.
> >
> > Signed-off-by: Antonio Quartulli <ordex@autistici.org>
> > ---
>
> Ehrm, this is wrong (or at least undefined behaviour). Please read C99
> 6.5.2.3 point 5
Found an extreme nice example [1] for you. Please read it together with the
C99 paragraph mentioned above.
Kind regards,
Sven
[1]
http://coding.derkeiler.com/Archive/C_CPP/comp.lang.c/2007-05/msg03192.html
@@ -223,20 +223,20 @@ struct socket_packet {
struct tt_local_entry {
uint8_t addr[ETH_ALEN];
- unsigned long last_seen;
uint16_t flags;
atomic_t refcount;
+ unsigned long last_seen;
struct rcu_head rcu;
struct hlist_node hash_entry;
};
struct tt_global_entry {
uint8_t addr[ETH_ALEN];
+ uint16_t flags; /* only TT_GLOBAL_ROAM is used */
+ atomic_t refcount;
struct orig_node *orig_node;
uint8_t ttvn;
- uint16_t flags; /* only TT_GLOBAL_ROAM is used */
unsigned long roam_at; /* time at which TT_GLOBAL_ROAM was set */
- atomic_t refcount;
struct rcu_head rcu;
struct hlist_node hash_entry; /* entry in the global table */
};