diff options
author | Steven Whitehouse <steve@chygwyn.com> | 2006-03-21 01:42:39 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2006-03-21 01:42:39 -0500 |
commit | c4ea94ab3710eb2434abe2eab1a479c2dc01f8ac (patch) | |
tree | 72e07ca7d2d5fe2de31b3f5a4e64fa411efdf18d /net/decnet/dn_table.c | |
parent | 2c7946a7bf45ae86736ab3b43d0085e43947945c (diff) |
[DECnet]: Endian annotation and fixes for DECnet.
The typedef for dn_address has been removed in favour of using __le16
or __u16 directly as appropriate. All the DECnet header files are
updated accordingly.
The byte ordering of dn_eth2dn() and dn_dn2eth() are both changed
since just about all their callers wanted network order rather than
host order, so the conversion is now done in the functions themselves.
Several missed endianess conversions have been picked up during the
conversion process. The nh_gw field in struct dn_fib_info has been
changed from a 32 bit field to 16 bits as it ought to be.
One or two cases of using htons rather than dn_htons in the routing
code have been found and fixed.
There are still a few warnings to fix, but this patch deals with the
important cases.
Signed-off-by: Steven Whitehouse <steve@chygwyn.com>
Signed-off-by: Patrick Caulfield <patrick@tykepenguin.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/decnet/dn_table.c')
-rw-r--r-- | net/decnet/dn_table.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/decnet/dn_table.c b/net/decnet/dn_table.c index 6f8b5658cb4e..0ebc46af1bdd 100644 --- a/net/decnet/dn_table.c +++ b/net/decnet/dn_table.c | |||
@@ -46,7 +46,7 @@ struct dn_zone | |||
46 | u32 dz_hashmask; | 46 | u32 dz_hashmask; |
47 | #define DZ_HASHMASK(dz) ((dz)->dz_hashmask) | 47 | #define DZ_HASHMASK(dz) ((dz)->dz_hashmask) |
48 | int dz_order; | 48 | int dz_order; |
49 | u16 dz_mask; | 49 | __le16 dz_mask; |
50 | #define DZ_MASK(dz) ((dz)->dz_mask) | 50 | #define DZ_MASK(dz) ((dz)->dz_mask) |
51 | }; | 51 | }; |
52 | 52 | ||
@@ -84,14 +84,14 @@ static int dn_fib_hash_zombies; | |||
84 | 84 | ||
85 | static inline dn_fib_idx_t dn_hash(dn_fib_key_t key, struct dn_zone *dz) | 85 | static inline dn_fib_idx_t dn_hash(dn_fib_key_t key, struct dn_zone *dz) |
86 | { | 86 | { |
87 | u16 h = ntohs(key.datum)>>(16 - dz->dz_order); | 87 | u16 h = dn_ntohs(key.datum)>>(16 - dz->dz_order); |
88 | h ^= (h >> 10); | 88 | h ^= (h >> 10); |
89 | h ^= (h >> 6); | 89 | h ^= (h >> 6); |
90 | h &= DZ_HASHMASK(dz); | 90 | h &= DZ_HASHMASK(dz); |
91 | return *(dn_fib_idx_t *)&h; | 91 | return *(dn_fib_idx_t *)&h; |
92 | } | 92 | } |
93 | 93 | ||
94 | static inline dn_fib_key_t dz_key(u16 dst, struct dn_zone *dz) | 94 | static inline dn_fib_key_t dz_key(__le16 dst, struct dn_zone *dz) |
95 | { | 95 | { |
96 | dn_fib_key_t k; | 96 | dn_fib_key_t k; |
97 | k.datum = dst & DZ_MASK(dz); | 97 | k.datum = dst & DZ_MASK(dz); |
@@ -250,7 +250,7 @@ static int dn_fib_nh_match(struct rtmsg *r, struct nlmsghdr *nlh, struct dn_kern | |||
250 | 250 | ||
251 | for_nexthops(fi) { | 251 | for_nexthops(fi) { |
252 | int attrlen = nhlen - sizeof(struct rtnexthop); | 252 | int attrlen = nhlen - sizeof(struct rtnexthop); |
253 | dn_address gw; | 253 | __le16 gw; |
254 | 254 | ||
255 | if (attrlen < 0 || (nhlen -= nhp->rtnh_len) < 0) | 255 | if (attrlen < 0 || (nhlen -= nhp->rtnh_len) < 0) |
256 | return -EINVAL; | 256 | return -EINVAL; |
@@ -457,7 +457,7 @@ static int dn_fib_table_insert(struct dn_fib_table *tb, struct rtmsg *r, struct | |||
457 | 457 | ||
458 | dz_key_0(key); | 458 | dz_key_0(key); |
459 | if (rta->rta_dst) { | 459 | if (rta->rta_dst) { |
460 | dn_address dst; | 460 | __le16 dst; |
461 | memcpy(&dst, rta->rta_dst, 2); | 461 | memcpy(&dst, rta->rta_dst, 2); |
462 | if (dst & ~DZ_MASK(dz)) | 462 | if (dst & ~DZ_MASK(dz)) |
463 | return -EINVAL; | 463 | return -EINVAL; |
@@ -593,7 +593,7 @@ static int dn_fib_table_delete(struct dn_fib_table *tb, struct rtmsg *r, struct | |||
593 | 593 | ||
594 | dz_key_0(key); | 594 | dz_key_0(key); |
595 | if (rta->rta_dst) { | 595 | if (rta->rta_dst) { |
596 | dn_address dst; | 596 | __le16 dst; |
597 | memcpy(&dst, rta->rta_dst, 2); | 597 | memcpy(&dst, rta->rta_dst, 2); |
598 | if (dst & ~DZ_MASK(dz)) | 598 | if (dst & ~DZ_MASK(dz)) |
599 | return -EINVAL; | 599 | return -EINVAL; |