[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.

Signed-off-by: Jan Blunck <jblunck@suse.de>
Acked-by: Karsten Keil <kkeil@suse.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Jan Blunck 2006-01-08 01:05:09 -08:00 committed by Linus Torvalds
parent bfc090c468
commit 9fe656e91f
1 changed files with 44 additions and 44 deletions

View File

@ -78,29 +78,29 @@ typedef union actcapi_infoel { /* info element */
typedef struct actcapi_msn { typedef struct actcapi_msn {
__u8 eaz; __u8 eaz;
__u8 len; /* Length of MSN */ __u8 len; /* Length of MSN */
__u8 msn[15] __attribute__ ((packed)); __u8 msn[15];
} actcapi_msn; } __attribute__((packed)) actcapi_msn;
typedef struct actcapi_dlpd { typedef struct actcapi_dlpd {
__u8 len; /* Length of structure */ __u8 len; /* Length of structure */
__u16 dlen __attribute__ ((packed)); /* Data Length */ __u16 dlen; /* Data Length */
__u8 laa __attribute__ ((packed)); /* Link Address A */ __u8 laa; /* Link Address A */
__u8 lab; /* Link Address B */ __u8 lab; /* Link Address B */
__u8 modulo; /* Modulo Mode */ __u8 modulo; /* Modulo Mode */
__u8 win; /* Window size */ __u8 win; /* Window size */
__u8 xid[100]; /* XID Information */ __u8 xid[100]; /* XID Information */
} actcapi_dlpd; } __attribute__((packed)) actcapi_dlpd;
typedef struct actcapi_ncpd { typedef struct actcapi_ncpd {
__u8 len; /* Length of structure */ __u8 len; /* Length of structure */
__u16 lic __attribute__ ((packed)); __u16 lic;
__u16 hic __attribute__ ((packed)); __u16 hic;
__u16 ltc __attribute__ ((packed)); __u16 ltc;
__u16 htc __attribute__ ((packed)); __u16 htc;
__u16 loc __attribute__ ((packed)); __u16 loc;
__u16 hoc __attribute__ ((packed)); __u16 hoc;
__u8 modulo __attribute__ ((packed)); __u8 modulo;
} actcapi_ncpd; } __attribute__((packed)) actcapi_ncpd;
#define actcapi_ncpi actcapi_ncpd #define actcapi_ncpi actcapi_ncpd
/* /*
@ -168,19 +168,19 @@ typedef struct actcapi_msg {
__u16 manuf_msg; __u16 manuf_msg;
__u16 controller; __u16 controller;
actcapi_msn msnmap; actcapi_msn msnmap;
} manufacturer_req_msn; } __attribute ((packed)) manufacturer_req_msn;
/* TODO: TraceInit-req/conf/ind/resp and /* TODO: TraceInit-req/conf/ind/resp and
* TraceDump-req/conf/ind/resp * TraceDump-req/conf/ind/resp
*/ */
struct connect_req { struct connect_req {
__u8 controller; __u8 controller;
__u8 bchan; __u8 bchan;
__u32 infomask __attribute__ ((packed)); __u32 infomask;
__u8 si1; __u8 si1;
__u8 si2; __u8 si2;
__u8 eaz; __u8 eaz;
actcapi_addr addr; actcapi_addr addr;
} connect_req; } __attribute__ ((packed)) connect_req;
struct connect_conf { struct connect_conf {
__u16 plci; __u16 plci;
__u16 info; __u16 info;
@ -192,7 +192,7 @@ typedef struct actcapi_msg {
__u8 si2; __u8 si2;
__u8 eaz; __u8 eaz;
actcapi_addr addr; actcapi_addr addr;
} connect_ind; } __attribute__ ((packed)) connect_ind;
struct connect_resp { struct connect_resp {
__u16 plci; __u16 plci;
__u8 rejectcause; __u8 rejectcause;
@ -200,14 +200,14 @@ typedef struct actcapi_msg {
struct connect_active_ind { struct connect_active_ind {
__u16 plci; __u16 plci;
actcapi_addr addr; actcapi_addr addr;
} connect_active_ind; } __attribute__ ((packed)) connect_active_ind;
struct connect_active_resp { struct connect_active_resp {
__u16 plci; __u16 plci;
} connect_active_resp; } connect_active_resp;
struct connect_b3_req { struct connect_b3_req {
__u16 plci; __u16 plci;
actcapi_ncpi ncpi; actcapi_ncpi ncpi;
} connect_b3_req; } __attribute__ ((packed)) connect_b3_req;
struct connect_b3_conf { struct connect_b3_conf {
__u16 plci; __u16 plci;
__u16 ncci; __u16 ncci;
@ -217,12 +217,12 @@ typedef struct actcapi_msg {
__u16 ncci; __u16 ncci;
__u16 plci; __u16 plci;
actcapi_ncpi ncpi; actcapi_ncpi ncpi;
} connect_b3_ind; } __attribute__ ((packed)) connect_b3_ind;
struct connect_b3_resp { struct connect_b3_resp {
__u16 ncci; __u16 ncci;
__u8 rejectcause; __u8 rejectcause;
actcapi_ncpi ncpi __attribute__ ((packed)); actcapi_ncpi ncpi;
} connect_b3_resp; } __attribute__ ((packed)) connect_b3_resp;
struct disconnect_req { struct disconnect_req {
__u16 plci; __u16 plci;
__u8 cause; __u8 cause;
@ -241,14 +241,14 @@ typedef struct actcapi_msg {
struct connect_b3_active_ind { struct connect_b3_active_ind {
__u16 ncci; __u16 ncci;
actcapi_ncpi ncpi; actcapi_ncpi ncpi;
} connect_b3_active_ind; } __attribute__ ((packed)) connect_b3_active_ind;
struct connect_b3_active_resp { struct connect_b3_active_resp {
__u16 ncci; __u16 ncci;
} connect_b3_active_resp; } connect_b3_active_resp;
struct disconnect_b3_req { struct disconnect_b3_req {
__u16 ncci; __u16 ncci;
actcapi_ncpi ncpi; actcapi_ncpi ncpi;
} disconnect_b3_req; } __attribute__ ((packed)) disconnect_b3_req;
struct disconnect_b3_conf { struct disconnect_b3_conf {
__u16 ncci; __u16 ncci;
__u16 info; __u16 info;
@ -257,7 +257,7 @@ typedef struct actcapi_msg {
__u16 ncci; __u16 ncci;
__u16 info; __u16 info;
actcapi_ncpi ncpi; actcapi_ncpi ncpi;
} disconnect_b3_ind; } __attribute__ ((packed)) disconnect_b3_ind;
struct disconnect_b3_resp { struct disconnect_b3_resp {
__u16 ncci; __u16 ncci;
} disconnect_b3_resp; } disconnect_b3_resp;
@ -265,7 +265,7 @@ typedef struct actcapi_msg {
__u16 plci; __u16 plci;
actcapi_infonr nr; actcapi_infonr nr;
actcapi_infoel el; actcapi_infoel el;
} info_ind; } __attribute__ ((packed)) info_ind;
struct info_resp { struct info_resp {
__u16 plci; __u16 plci;
} info_resp; } info_resp;
@ -279,8 +279,8 @@ typedef struct actcapi_msg {
struct select_b2_protocol_req { struct select_b2_protocol_req {
__u16 plci; __u16 plci;
__u8 protocol; __u8 protocol;
actcapi_dlpd dlpd __attribute__ ((packed)); actcapi_dlpd dlpd;
} select_b2_protocol_req; } __attribute__ ((packed)) select_b2_protocol_req;
struct select_b2_protocol_conf { struct select_b2_protocol_conf {
__u16 plci; __u16 plci;
__u16 info; __u16 info;
@ -288,47 +288,47 @@ typedef struct actcapi_msg {
struct select_b3_protocol_req { struct select_b3_protocol_req {
__u16 plci; __u16 plci;
__u8 protocol; __u8 protocol;
actcapi_ncpd ncpd __attribute__ ((packed)); actcapi_ncpd ncpd;
} select_b3_protocol_req; } __attribute__ ((packed)) select_b3_protocol_req;
struct select_b3_protocol_conf { struct select_b3_protocol_conf {
__u16 plci; __u16 plci;
__u16 info; __u16 info;
} select_b3_protocol_conf; } select_b3_protocol_conf;
struct listen_req { struct listen_req {
__u8 controller; __u8 controller;
__u32 infomask __attribute__ ((packed)); __u32 infomask;
__u16 eazmask __attribute__ ((packed)); __u16 eazmask;
__u16 simask __attribute__ ((packed)); __u16 simask;
} listen_req; } __attribute__ ((packed)) listen_req;
struct listen_conf { struct listen_conf {
__u8 controller; __u8 controller;
__u16 info __attribute__ ((packed)); __u16 info;
} listen_conf; } __attribute__ ((packed)) listen_conf;
struct data_b3_req { struct data_b3_req {
__u16 fakencci; __u16 fakencci;
__u16 datalen; __u16 datalen;
__u32 unused; __u32 unused;
__u8 blocknr; __u8 blocknr;
__u16 flags __attribute__ ((packed)); __u16 flags;
} data_b3_req; } __attribute ((packed)) data_b3_req;
struct data_b3_ind { struct data_b3_ind {
__u16 fakencci; __u16 fakencci;
__u16 datalen; __u16 datalen;
__u32 unused; __u32 unused;
__u8 blocknr; __u8 blocknr;
__u16 flags __attribute__ ((packed)); __u16 flags;
} data_b3_ind; } __attribute__ ((packed)) data_b3_ind;
struct data_b3_resp { struct data_b3_resp {
__u16 ncci; __u16 ncci;
__u8 blocknr; __u8 blocknr;
} data_b3_resp; } __attribute__ ((packed)) data_b3_resp;
struct data_b3_conf { struct data_b3_conf {
__u16 ncci; __u16 ncci;
__u8 blocknr; __u8 blocknr;
__u16 info __attribute__ ((packed)); __u16 info;
} data_b3_conf; } __attribute__ ((packed)) data_b3_conf;
} msg; } msg;
} actcapi_msg; } __attribute__ ((packed)) actcapi_msg;
static inline unsigned short static inline unsigned short
actcapi_nextsmsg(act2000_card *card) actcapi_nextsmsg(act2000_card *card)