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 /include/net/dn_nsp.h | |
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 'include/net/dn_nsp.h')
-rw-r--r-- | include/net/dn_nsp.h | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/include/net/dn_nsp.h b/include/net/dn_nsp.h index e6182b86262b..96e816b6974d 100644 --- a/include/net/dn_nsp.h +++ b/include/net/dn_nsp.h | |||
@@ -72,77 +72,77 @@ extern struct sk_buff *dn_alloc_send_skb(struct sock *sk, size_t *size, int nobl | |||
72 | 72 | ||
73 | struct nsp_data_seg_msg | 73 | struct nsp_data_seg_msg |
74 | { | 74 | { |
75 | unsigned char msgflg; | 75 | __u8 msgflg; |
76 | unsigned short dstaddr; | 76 | __le16 dstaddr; |
77 | unsigned short srcaddr; | 77 | __le16 srcaddr; |
78 | } __attribute__((packed)); | 78 | } __attribute__((packed)); |
79 | 79 | ||
80 | struct nsp_data_opt_msg | 80 | struct nsp_data_opt_msg |
81 | { | 81 | { |
82 | unsigned short acknum; | 82 | __le16 acknum; |
83 | unsigned short segnum; | 83 | __le16 segnum; |
84 | unsigned short lsflgs; | 84 | __le16 lsflgs; |
85 | } __attribute__((packed)); | 85 | } __attribute__((packed)); |
86 | 86 | ||
87 | struct nsp_data_opt_msg1 | 87 | struct nsp_data_opt_msg1 |
88 | { | 88 | { |
89 | unsigned short acknum; | 89 | __le16 acknum; |
90 | unsigned short segnum; | 90 | __le16 segnum; |
91 | } __attribute__((packed)); | 91 | } __attribute__((packed)); |
92 | 92 | ||
93 | 93 | ||
94 | /* Acknowledgment Message (data/other data) */ | 94 | /* Acknowledgment Message (data/other data) */ |
95 | struct nsp_data_ack_msg | 95 | struct nsp_data_ack_msg |
96 | { | 96 | { |
97 | unsigned char msgflg; | 97 | __u8 msgflg; |
98 | unsigned short dstaddr; | 98 | __le16 dstaddr; |
99 | unsigned short srcaddr; | 99 | __le16 srcaddr; |
100 | unsigned short acknum; | 100 | __le16 acknum; |
101 | } __attribute__((packed)); | 101 | } __attribute__((packed)); |
102 | 102 | ||
103 | /* Connect Acknowledgment Message */ | 103 | /* Connect Acknowledgment Message */ |
104 | struct nsp_conn_ack_msg | 104 | struct nsp_conn_ack_msg |
105 | { | 105 | { |
106 | unsigned char msgflg; | 106 | __u8 msgflg; |
107 | unsigned short dstaddr; | 107 | __le16 dstaddr; |
108 | } __attribute__((packed)); | 108 | } __attribute__((packed)); |
109 | 109 | ||
110 | 110 | ||
111 | /* Connect Initiate/Retransmit Initiate/Connect Confirm */ | 111 | /* Connect Initiate/Retransmit Initiate/Connect Confirm */ |
112 | struct nsp_conn_init_msg | 112 | struct nsp_conn_init_msg |
113 | { | 113 | { |
114 | unsigned char msgflg; | 114 | __u8 msgflg; |
115 | #define NSP_CI 0x18 /* Connect Initiate */ | 115 | #define NSP_CI 0x18 /* Connect Initiate */ |
116 | #define NSP_RCI 0x68 /* Retrans. Conn Init */ | 116 | #define NSP_RCI 0x68 /* Retrans. Conn Init */ |
117 | unsigned short dstaddr; | 117 | __le16 dstaddr; |
118 | unsigned short srcaddr; | 118 | __le16 srcaddr; |
119 | unsigned char services; | 119 | __u8 services; |
120 | #define NSP_FC_NONE 0x00 /* Flow Control None */ | 120 | #define NSP_FC_NONE 0x00 /* Flow Control None */ |
121 | #define NSP_FC_SRC 0x04 /* Seg Req. Count */ | 121 | #define NSP_FC_SRC 0x04 /* Seg Req. Count */ |
122 | #define NSP_FC_SCMC 0x08 /* Sess. Control Mess */ | 122 | #define NSP_FC_SCMC 0x08 /* Sess. Control Mess */ |
123 | #define NSP_FC_MASK 0x0c /* FC type mask */ | 123 | #define NSP_FC_MASK 0x0c /* FC type mask */ |
124 | unsigned char info; | 124 | __u8 info; |
125 | unsigned short segsize; | 125 | __le16 segsize; |
126 | } __attribute__((packed)); | 126 | } __attribute__((packed)); |
127 | 127 | ||
128 | /* Disconnect Initiate/Disconnect Confirm */ | 128 | /* Disconnect Initiate/Disconnect Confirm */ |
129 | struct nsp_disconn_init_msg | 129 | struct nsp_disconn_init_msg |
130 | { | 130 | { |
131 | unsigned char msgflg; | 131 | __u8 msgflg; |
132 | unsigned short dstaddr; | 132 | __le16 dstaddr; |
133 | unsigned short srcaddr; | 133 | __le16 srcaddr; |
134 | unsigned short reason; | 134 | __le16 reason; |
135 | } __attribute__((packed)); | 135 | } __attribute__((packed)); |
136 | 136 | ||
137 | 137 | ||
138 | 138 | ||
139 | struct srcobj_fmt | 139 | struct srcobj_fmt |
140 | { | 140 | { |
141 | char format; | 141 | __u8 format; |
142 | unsigned char task; | 142 | __u8 task; |
143 | unsigned short grpcode; | 143 | __le16 grpcode; |
144 | unsigned short usrcode; | 144 | __le16 usrcode; |
145 | char dlen; | 145 | __u8 dlen; |
146 | } __attribute__((packed)); | 146 | } __attribute__((packed)); |
147 | 147 | ||
148 | /* | 148 | /* |
@@ -150,7 +150,7 @@ struct srcobj_fmt | |||
150 | * numbers used in NSP. Similar in operation to the functions | 150 | * numbers used in NSP. Similar in operation to the functions |
151 | * of the same name in TCP. | 151 | * of the same name in TCP. |
152 | */ | 152 | */ |
153 | static __inline__ int dn_before(unsigned short seq1, unsigned short seq2) | 153 | static __inline__ int dn_before(__u16 seq1, __u16 seq2) |
154 | { | 154 | { |
155 | seq1 &= 0x0fff; | 155 | seq1 &= 0x0fff; |
156 | seq2 &= 0x0fff; | 156 | seq2 &= 0x0fff; |
@@ -159,7 +159,7 @@ static __inline__ int dn_before(unsigned short seq1, unsigned short seq2) | |||
159 | } | 159 | } |
160 | 160 | ||
161 | 161 | ||
162 | static __inline__ int dn_after(unsigned short seq1, unsigned short seq2) | 162 | static __inline__ int dn_after(__u16 seq1, __u16 seq2) |
163 | { | 163 | { |
164 | seq1 &= 0x0fff; | 164 | seq1 &= 0x0fff; |
165 | seq2 &= 0x0fff; | 165 | seq2 &= 0x0fff; |
@@ -167,23 +167,23 @@ static __inline__ int dn_after(unsigned short seq1, unsigned short seq2) | |||
167 | return (int)((seq2 - seq1) & 0x0fff) > 2048; | 167 | return (int)((seq2 - seq1) & 0x0fff) > 2048; |
168 | } | 168 | } |
169 | 169 | ||
170 | static __inline__ int dn_equal(unsigned short seq1, unsigned short seq2) | 170 | static __inline__ int dn_equal(__u16 seq1, __u16 seq2) |
171 | { | 171 | { |
172 | return ((seq1 ^ seq2) & 0x0fff) == 0; | 172 | return ((seq1 ^ seq2) & 0x0fff) == 0; |
173 | } | 173 | } |
174 | 174 | ||
175 | static __inline__ int dn_before_or_equal(unsigned short seq1, unsigned short seq2) | 175 | static __inline__ int dn_before_or_equal(__u16 seq1, __u16 seq2) |
176 | { | 176 | { |
177 | return (dn_before(seq1, seq2) || dn_equal(seq1, seq2)); | 177 | return (dn_before(seq1, seq2) || dn_equal(seq1, seq2)); |
178 | } | 178 | } |
179 | 179 | ||
180 | static __inline__ void seq_add(unsigned short *seq, unsigned short off) | 180 | static __inline__ void seq_add(__u16 *seq, __u16 off) |
181 | { | 181 | { |
182 | (*seq) += off; | 182 | (*seq) += off; |
183 | (*seq) &= 0x0fff; | 183 | (*seq) &= 0x0fff; |
184 | } | 184 | } |
185 | 185 | ||
186 | static __inline__ int seq_next(unsigned short seq1, unsigned short seq2) | 186 | static __inline__ int seq_next(__u16 seq1, __u16 seq2) |
187 | { | 187 | { |
188 | return dn_equal(seq1 + 1, seq2); | 188 | return dn_equal(seq1 + 1, seq2); |
189 | } | 189 | } |
@@ -191,7 +191,7 @@ static __inline__ int seq_next(unsigned short seq1, unsigned short seq2) | |||
191 | /* | 191 | /* |
192 | * Can we delay the ack ? | 192 | * Can we delay the ack ? |
193 | */ | 193 | */ |
194 | static __inline__ int sendack(unsigned short seq) | 194 | static __inline__ int sendack(__u16 seq) |
195 | { | 195 | { |
196 | return (int)((seq & 0x1000) ? 0 : 1); | 196 | return (int)((seq & 0x1000) ? 0 : 1); |
197 | } | 197 | } |