History

[PATCH] i4l: __attribute__((packed)) for the CAPI message structs

The CAPI message structs itself should be packed and not the location of single fields in the structure.

Jan Blunck committed 20 years ago

Commit 9fe656e1 parent bfc090c1 file · +44 −44Browse files

Unified · Split

drivers/isdn/act2000/capi.h+44−44
@@ -78,29 +78,29 @@ typedef union actcapi_infoel { /* info element */ · 77 unmodified lines
78typedef struct actcapi_msn {78typedef struct actcapi_msn {
79 __u8 eaz;79 __u8 eaz;
80 __u8 len; /* Length of MSN */80 __u8 len; /* Length of MSN */
81 __u8 msn[15] __attribute__ ((packed));81 __u8 msn[15];
82} actcapi_msn;82} __attribute__((packed)) actcapi_msn;
83 83
84typedef struct actcapi_dlpd {84typedef struct actcapi_dlpd {
85 __u8 len; /* Length of structure */85 __u8 len; /* Length of structure */
86 __u16 dlen __attribute__ ((packed)); /* Data Length */86 __u16 dlen; /* Data Length */
87 __u8 laa __attribute__ ((packed)); /* Link Address A */87 __u8 laa; /* Link Address A */
88 __u8 lab; /* Link Address B */88 __u8 lab; /* Link Address B */
89 __u8 modulo; /* Modulo Mode */89 __u8 modulo; /* Modulo Mode */
90 __u8 win; /* Window size */90 __u8 win; /* Window size */
91 __u8 xid[100]; /* XID Information */91 __u8 xid[100]; /* XID Information */
92} actcapi_dlpd;92} __attribute__((packed)) actcapi_dlpd;
93 93
94typedef struct actcapi_ncpd {94typedef struct actcapi_ncpd {
95 __u8 len; /* Length of structure */95 __u8 len; /* Length of structure */
96 __u16 lic __attribute__ ((packed));96 __u16 lic;
97 __u16 hic __attribute__ ((packed));97 __u16 hic;
98 __u16 ltc __attribute__ ((packed));98 __u16 ltc;
99 __u16 htc __attribute__ ((packed));99 __u16 htc;
100 __u16 loc __attribute__ ((packed));100 __u16 loc;
101 __u16 hoc __attribute__ ((packed));101 __u16 hoc;
102 __u8 modulo __attribute__ ((packed));102 __u8 modulo;
103} actcapi_ncpd;103} __attribute__((packed)) actcapi_ncpd;
104#define actcapi_ncpi actcapi_ncpd104#define actcapi_ncpi actcapi_ncpd
105 105
106/*106/*
@@ -168,19 +168,19 @@ typedef struct actcapi_msg { · 61 unmodified lines
168 __u16 manuf_msg;168 __u16 manuf_msg;
169 __u16 controller;169 __u16 controller;
170 actcapi_msn msnmap;170 actcapi_msn msnmap;
171 } manufacturer_req_msn;171 } __attribute ((packed)) manufacturer_req_msn;
172 /* TODO: TraceInit-req/conf/ind/resp and172 /* TODO: TraceInit-req/conf/ind/resp and
173 * TraceDump-req/conf/ind/resp173 * TraceDump-req/conf/ind/resp
174 */174 */
175 struct connect_req {175 struct connect_req {
176 __u8 controller;176 __u8 controller;
177 __u8 bchan;177 __u8 bchan;
178 __u32 infomask __attribute__ ((packed));178 __u32 infomask;
179 __u8 si1;179 __u8 si1;
180 __u8 si2;180 __u8 si2;
181 __u8 eaz;181 __u8 eaz;
182 actcapi_addr addr;182 actcapi_addr addr;
183 } connect_req;183 } __attribute__ ((packed)) connect_req;
184 struct connect_conf {184 struct connect_conf {
185 __u16 plci;185 __u16 plci;
186 __u16 info;186 __u16 info;
@@ -192,7 +192,7 @@ typedef struct actcapi_msg { · 5 unmodified lines
192 __u8 si2;192 __u8 si2;
193 __u8 eaz;193 __u8 eaz;
194 actcapi_addr addr;194 actcapi_addr addr;
195 } connect_ind;195 } __attribute__ ((packed)) connect_ind;
196 struct connect_resp {196 struct connect_resp {
197 __u16 plci;197 __u16 plci;
198 __u8 rejectcause;198 __u8 rejectcause;
@@ -200,14 +200,14 @@ typedef struct actcapi_msg { · 1 unmodified line
200 struct connect_active_ind {200 struct connect_active_ind {
201 __u16 plci;201 __u16 plci;
202 actcapi_addr addr;202 actcapi_addr addr;
203 } connect_active_ind;203 } __attribute__ ((packed)) connect_active_ind;
204 struct connect_active_resp {204 struct connect_active_resp {
205 __u16 plci;205 __u16 plci;
206 } connect_active_resp;206 } connect_active_resp;
207 struct connect_b3_req {207 struct connect_b3_req {
208 __u16 plci;208 __u16 plci;
209 actcapi_ncpi ncpi;209 actcapi_ncpi ncpi;
210 } connect_b3_req;210 } __attribute__ ((packed)) connect_b3_req;
211 struct connect_b3_conf {211 struct connect_b3_conf {
212 __u16 plci;212 __u16 plci;
213 __u16 ncci;213 __u16 ncci;
@@ -217,12 +217,12 @@ typedef struct actcapi_msg { · 3 unmodified lines
217 __u16 ncci;217 __u16 ncci;
218 __u16 plci;218 __u16 plci;
219 actcapi_ncpi ncpi;219 actcapi_ncpi ncpi;
220 } connect_b3_ind;220 } __attribute__ ((packed)) connect_b3_ind;
221 struct connect_b3_resp {221 struct connect_b3_resp {
222 __u16 ncci;222 __u16 ncci;
223 __u8 rejectcause;223 __u8 rejectcause;
224 actcapi_ncpi ncpi __attribute__ ((packed));224 actcapi_ncpi ncpi;
225 } connect_b3_resp;225 } __attribute__ ((packed)) connect_b3_resp;
226 struct disconnect_req {226 struct disconnect_req {
227 __u16 plci;227 __u16 plci;
228 __u8 cause;228 __u8 cause;
@@ -241,14 +241,14 @@ typedef struct actcapi_msg { · 12 unmodified lines
241 struct connect_b3_active_ind {241 struct connect_b3_active_ind {
242 __u16 ncci;242 __u16 ncci;
243 actcapi_ncpi ncpi;243 actcapi_ncpi ncpi;
244 } connect_b3_active_ind;244 } __attribute__ ((packed)) connect_b3_active_ind;
245 struct connect_b3_active_resp {245 struct connect_b3_active_resp {
246 __u16 ncci;246 __u16 ncci;
247 } connect_b3_active_resp;247 } connect_b3_active_resp;
248 struct disconnect_b3_req {248 struct disconnect_b3_req {
249 __u16 ncci;249 __u16 ncci;
250 actcapi_ncpi ncpi;250 actcapi_ncpi ncpi;
251 } disconnect_b3_req;251 } __attribute__ ((packed)) disconnect_b3_req;
252 struct disconnect_b3_conf {252 struct disconnect_b3_conf {
253 __u16 ncci;253 __u16 ncci;
254 __u16 info;254 __u16 info;
@@ -257,7 +257,7 @@ typedef struct actcapi_msg { · 2 unmodified lines
257 __u16 ncci;257 __u16 ncci;
258 __u16 info;258 __u16 info;
259 actcapi_ncpi ncpi;259 actcapi_ncpi ncpi;
260 } disconnect_b3_ind;260 } __attribute__ ((packed)) disconnect_b3_ind;
261 struct disconnect_b3_resp {261 struct disconnect_b3_resp {
262 __u16 ncci;262 __u16 ncci;
263 } disconnect_b3_resp;263 } disconnect_b3_resp;
@@ -265,7 +265,7 @@ typedef struct actcapi_msg { · 1 unmodified line
265 __u16 plci;265 __u16 plci;
266 actcapi_infonr nr;266 actcapi_infonr nr;
267 actcapi_infoel el;267 actcapi_infoel el;
268 } info_ind;268 } __attribute__ ((packed)) info_ind;
269 struct info_resp {269 struct info_resp {
270 __u16 plci;270 __u16 plci;
271 } info_resp;271 } info_resp;
@@ -279,8 +279,8 @@ typedef struct actcapi_msg { · 7 unmodified lines
279 struct select_b2_protocol_req {279 struct select_b2_protocol_req {
280 __u16 plci;280 __u16 plci;
281 __u8 protocol;281 __u8 protocol;
282 actcapi_dlpd dlpd __attribute__ ((packed));282 actcapi_dlpd dlpd;
283 } select_b2_protocol_req;283 } __attribute__ ((packed)) select_b2_protocol_req;
284 struct select_b2_protocol_conf {284 struct select_b2_protocol_conf {
285 __u16 plci;285 __u16 plci;
286 __u16 info;286 __u16 info;
@@ -288,47 +288,47 @@ typedef struct actcapi_msg { · 1 unmodified line
288 struct select_b3_protocol_req {288 struct select_b3_protocol_req {
289 __u16 plci;289 __u16 plci;
290 __u8 protocol;290 __u8 protocol;
291 actcapi_ncpd ncpd __attribute__ ((packed));291 actcapi_ncpd ncpd;
292 } select_b3_protocol_req;292 } __attribute__ ((packed)) select_b3_protocol_req;
293 struct select_b3_protocol_conf {293 struct select_b3_protocol_conf {
294 __u16 plci;294 __u16 plci;
295 __u16 info;295 __u16 info;
296 } select_b3_protocol_conf;296 } select_b3_protocol_conf;
297 struct listen_req {297 struct listen_req {
298 __u8 controller;298 __u8 controller;
299 __u32 infomask __attribute__ ((packed)); 299 __u32 infomask;
300 __u16 eazmask __attribute__ ((packed));300 __u16 eazmask;
301 __u16 simask __attribute__ ((packed));301 __u16 simask;
302 } listen_req;302 } __attribute__ ((packed)) listen_req;
303 struct listen_conf {303 struct listen_conf {
304 __u8 controller;304 __u8 controller;
305 __u16 info __attribute__ ((packed));305 __u16 info;
306 } listen_conf;306 } __attribute__ ((packed)) listen_conf;
307 struct data_b3_req {307 struct data_b3_req {
308 __u16 fakencci;308 __u16 fakencci;
309 __u16 datalen;309 __u16 datalen;
310 __u32 unused;310 __u32 unused;
311 __u8 blocknr;311 __u8 blocknr;
312 __u16 flags __attribute__ ((packed));312 __u16 flags;
313 } data_b3_req;313 } __attribute ((packed)) data_b3_req;
314 struct data_b3_ind {314 struct data_b3_ind {
315 __u16 fakencci;315 __u16 fakencci;
316 __u16 datalen;316 __u16 datalen;
317 __u32 unused;317 __u32 unused;
318 __u8 blocknr;318 __u8 blocknr;
319 __u16 flags __attribute__ ((packed));319 __u16 flags;
320 } data_b3_ind;320 } __attribute__ ((packed)) data_b3_ind;
321 struct data_b3_resp {321 struct data_b3_resp {
322 __u16 ncci;322 __u16 ncci;
323 __u8 blocknr;323 __u8 blocknr;
324 } data_b3_resp;324 } __attribute__ ((packed)) data_b3_resp;
325 struct data_b3_conf {325 struct data_b3_conf {
326 __u16 ncci;326 __u16 ncci;
327 __u8 blocknr;327 __u8 blocknr;
328 __u16 info __attribute__ ((packed));328 __u16 info;
329 } data_b3_conf;329 } __attribute__ ((packed)) data_b3_conf;
330 } msg;330 } msg;
331} actcapi_msg;331} __attribute__ ((packed)) actcapi_msg;
332 332
333static inline unsigned short333static inline unsigned short
334actcapi_nextsmsg(act2000_card *card)334actcapi_nextsmsg(act2000_card *card)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t