History

header: fix broken headers for user space

__packed is only defined in kernel space, so we should use __attribute__((packed)) for the code shared between kernel and user space. Two __attribute() annotations are replaced with __attribute__() too.

Changli Gao committed 16 years ago

Commit 09cd2b91 parent 48d3ff810 files · +26 −26Browse files

Unified · Split

10 files
  1. include/linux/if_ether.h +1 −1
  2. include/linux/if_fddi.h +4 −4
  3. include/linux/if_hippi.h +4 −4
  4. include/linux/if_pppox.h +5 −5
  5. include/linux/ipv6.h +2 −2
  6. include/linux/nbd.h +1 −1
  7. include/linux/ncp.h +5 −5
  8. include/linux/netfilter/xt_IDLETIMER.h +1 −1
  9. include/linux/phonet.h +2 −2
  10. include/linux/rfkill.h +1 −1
include/linux/if_ether.h+1−1
@@ -119,7 +119,7 @@ struct ethhdr { · 118 unmodified lines
119119 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
120120 unsigned char h_source[ETH_ALEN]; /* source ether addr */
121121 __be16 h_proto; /* packet type ID field */
122−} __packed;
122+} __attribute__((packed));
123123
124124 #ifdef __KERNEL__
125125 #include <linux/skbuff.h>
include/linux/if_fddi.h+4−4
@@ -67,7 +67,7 @@ struct fddi_8022_1_hdr { · 66 unmodified lines
6767 __u8 dsap; /* destination service access point */
6868 __u8 ssap; /* source service access point */
6969 __u8 ctrl; /* control byte #1 */
70−} __packed;
70+} __attribute__((packed));
7171
7272 /* Define 802.2 Type 2 header */
7373 struct fddi_8022_2_hdr {
@@ -75,7 +75,7 @@ struct fddi_8022_2_hdr { · 1 unmodified line
7575 __u8 ssap; /* source service access point */
7676 __u8 ctrl_1; /* control byte #1 */
7777 __u8 ctrl_2; /* control byte #2 */
78−} __packed;
78+} __attribute__((packed));
7979
8080 /* Define 802.2 SNAP header */
8181 #define FDDI_K_OUI_LEN 3
@@ -85,7 +85,7 @@ struct fddi_snap_hdr { · 3 unmodified lines
8585 __u8 ctrl; /* always 0x03 */
8686 __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */
8787 __be16 ethertype; /* packet type ID field */
88−} __packed;
88+} __attribute__((packed));
8989
9090 /* Define FDDI LLC frame header */
9191 struct fddihdr {
@@ -98,7 +98,7 @@ struct fddihdr { · 6 unmodified lines
9898 struct fddi_8022_2_hdr llc_8022_2;
9999 struct fddi_snap_hdr llc_snap;
100100 } hdr;
101−} __packed;
101+} __attribute__((packed));
102102
103103 #ifdef __KERNEL__
104104 #include <linux/netdevice.h>
include/linux/if_hippi.h+4−4
@@ -104,7 +104,7 @@ struct hippi_fp_hdr { · 103 unmodified lines
104104 __be32 fixed;
105105 #endif
106106 __be32 d2_size;
107−} __packed;
107+} __attribute__((packed));
108108
109109 struct hippi_le_hdr {
110110 #if defined (__BIG_ENDIAN_BITFIELD)
@@ -129,7 +129,7 @@ struct hippi_le_hdr { · 18 unmodified lines
129129 __u8 daddr[HIPPI_ALEN];
130130 __u16 locally_administered;
131131 __u8 saddr[HIPPI_ALEN];
132−} __packed;
132+} __attribute__((packed));
133133
134134 #define HIPPI_OUI_LEN 3
135135 /*
@@ -142,12 +142,12 @@ struct hippi_snap_hdr { · 6 unmodified lines
142142 __u8 ctrl; /* always 0x03 */
143143 __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/
144144 __be16 ethertype; /* packet type ID field */
145−} __packed;
145+} __attribute__((packed));
146146
147147 struct hippi_hdr {
148148 struct hippi_fp_hdr fp;
149149 struct hippi_le_hdr le;
150150 struct hippi_snap_hdr snap;
151−} __packed;
151+} __attribute__((packed));
152152
153153 #endif /* _LINUX_IF_HIPPI_H */
include/linux/if_pppox.h+5−5
@@ -59,7 +59,7 @@ struct sockaddr_pppox { · 58 unmodified lines
5959 union{
6060 struct pppoe_addr pppoe;
6161 }sa_addr;
62−} __packed;
62+} __attribute__((packed));
6363
6464 /* The use of the above union isn't viable because the size of this
6565 * struct must stay fixed over time -- applications use sizeof(struct
@@ -70,7 +70,7 @@ struct sockaddr_pppol2tp { · 4 unmodified lines
7070 sa_family_t sa_family; /* address family, AF_PPPOX */
7171 unsigned int sa_protocol; /* protocol identifier */
7272 struct pppol2tp_addr pppol2tp;
73−} __packed;
73+} __attribute__((packed));
7474
7575 /* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
7676 * bits. So we need a different sockaddr structure.
@@ -79,7 +79,7 @@ struct sockaddr_pppol2tpv3 { · 2 unmodified lines
7979 sa_family_t sa_family; /* address family, AF_PPPOX */
8080 unsigned int sa_protocol; /* protocol identifier */
8181 struct pppol2tpv3_addr pppol2tp;
82−} __packed;
82+} __attribute__((packed));
8383
8484 /*********************************************************************
8585 *
@@ -101,7 +101,7 @@ struct pppoe_tag { · 15 unmodified lines
101101 __be16 tag_type;
102102 __be16 tag_len;
103103 char tag_data[0];
104−} __attribute ((packed));
104+} __attribute__ ((packed));
105105
106106 /* Tag identifiers */
107107 #define PTT_EOL __cpu_to_be16(0x0000)
@@ -129,7 +129,7 @@ struct pppoe_hdr { · 21 unmodified lines
129129 __be16 sid;
130130 __be16 length;
131131 struct pppoe_tag tag[0];
132−} __packed;
132+} __attribute__((packed));
133133
134134 /* Length of entire PPPoE + PPP header */
135135 #define PPPOE_SES_HLEN 8
include/linux/ipv6.h+2−2
@@ -58,7 +58,7 @@ struct ipv6_opt_hdr { · 57 unmodified lines
5858 /*
5959 * TLV encoded option data follows.
6060 */
61−} __packed; /* required for some archs */
61+} __attribute__((packed)); /* required for some archs */
6262
6363 #define ipv6_destopt_hdr ipv6_opt_hdr
6464 #define ipv6_hopopt_hdr ipv6_opt_hdr
@@ -99,7 +99,7 @@ struct ipv6_destopt_hao { · 34 unmodified lines
9999 __u8 type;
100100 __u8 length;
101101 struct in6_addr addr;
102−} __packed;
102+} __attribute__((packed));
103103
104104 /*
105105 * IPv6 fixed header
include/linux/nbd.h+1−1
@@ -88,7 +88,7 @@ struct nbd_request { · 87 unmodified lines
8888 char handle[8];
8989 __be64 from;
9090 __be32 len;
91−} __packed;
91+} __attribute__((packed));
9292
9393 /*
9494 * This is the reply packet that nbd-server sends back to the client after
include/linux/ncp.h+5−5
@@ -27,7 +27,7 @@ struct ncp_request_header { · 26 unmodified lines
2727 __u8 conn_high;
2828 __u8 function;
2929 __u8 data[0];
30−} __packed;
30+} __attribute__((packed));
3131
3232 #define NCP_REPLY (0x3333)
3333 #define NCP_WATCHDOG (0x3E3E)
@@ -42,7 +42,7 @@ struct ncp_reply_header { · 8 unmodified lines
4242 __u8 completion_code;
4343 __u8 connection_state;
4444 __u8 data[0];
45−} __packed;
45+} __attribute__((packed));
4646
4747 #define NCP_VOLNAME_LEN (16)
4848 #define NCP_NUMBER_OF_VOLUMES (256)
@@ -158,7 +158,7 @@ struct nw_info_struct { · 109 unmodified lines
158158 #ifdef __KERNEL__
159159 struct nw_nfs_info nfs;
160160 #endif
161−} __packed;
161+} __attribute__((packed));
162162
163163 /* modify mask - use with MODIFY_DOS_INFO structure */
164164 #define DM_ATTRIBUTES (cpu_to_le32(0x02))
@@ -190,12 +190,12 @@ struct nw_modify_dos_info { · 25 unmodified lines
190190 __u16 inheritanceGrantMask;
191191 __u16 inheritanceRevokeMask;
192192 __u32 maximumSpace;
193−} __packed;
193+} __attribute__((packed));
194194
195195 struct nw_search_sequence {
196196 __u8 volNumber;
197197 __u32 dirBase;
198198 __u32 sequence;
199−} __packed;
199+} __attribute__((packed));
200200
201201 #endif /* _LINUX_NCP_H */
include/linux/netfilter/xt_IDLETIMER.h+1−1
@@ -39,7 +39,7 @@ struct idletimer_tg_info { · 38 unmodified lines
3939 char label[MAX_IDLETIMER_LABEL_SIZE];
4040
4141 /* for kernel module internal use only */
42− struct idletimer_tg *timer __attribute((aligned(8)));
42+ struct idletimer_tg *timer __attribute__((aligned(8)));
4343 };
4444
4545 #endif
include/linux/phonet.h+2−2
@@ -56,7 +56,7 @@ struct phonethdr { · 55 unmodified lines
5656 __be16 pn_length;
5757 __u8 pn_robj;
5858 __u8 pn_sobj;
59−} __packed;
59+} __attribute__((packed));
6060
6161 /* Common Phonet payload header */
6262 struct phonetmsg {
@@ -98,7 +98,7 @@ struct sockaddr_pn { · 35 unmodified lines
9898 __u8 spn_dev;
9999 __u8 spn_resource;
100100 __u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3];
101−} __packed;
101+} __attribute__((packed));
102102
103103 /* Well known address */
104104 #define PN_DEV_PC 0x10
include/linux/rfkill.h+1−1
@@ -81,7 +81,7 @@ struct rfkill_event { · 80 unmodified lines
8181 __u8 type;
8282 __u8 op;
8383 __u8 soft, hard;
84−} __packed;
84+} __attribute__((packed));
8585
8686 /*
8787 * We are planning to be backward and forward compatible with changes

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