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
119 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */119 unsigned char h_dest[ETH_ALEN]; /* destination eth addr */
120 unsigned char h_source[ETH_ALEN]; /* source ether addr */120 unsigned char h_source[ETH_ALEN]; /* source ether addr */
121 __be16 h_proto; /* packet type ID field */121 __be16 h_proto; /* packet type ID field */
122} __packed;122} __attribute__((packed));
123 123
124#ifdef __KERNEL__124#ifdef __KERNEL__
125#include <linux/skbuff.h>125#include <linux/skbuff.h>
include/linux/if_fddi.h+4−4
@@ -67,7 +67,7 @@ struct fddi_8022_1_hdr { · 66 unmodified lines
67 __u8 dsap; /* destination service access point */67 __u8 dsap; /* destination service access point */
68 __u8 ssap; /* source service access point */68 __u8 ssap; /* source service access point */
69 __u8 ctrl; /* control byte #1 */69 __u8 ctrl; /* control byte #1 */
70} __packed;70} __attribute__((packed));
71 71
72/* Define 802.2 Type 2 header */72/* Define 802.2 Type 2 header */
73struct fddi_8022_2_hdr {73struct fddi_8022_2_hdr {
@@ -75,7 +75,7 @@ struct fddi_8022_2_hdr { · 1 unmodified line
75 __u8 ssap; /* source service access point */75 __u8 ssap; /* source service access point */
76 __u8 ctrl_1; /* control byte #1 */76 __u8 ctrl_1; /* control byte #1 */
77 __u8 ctrl_2; /* control byte #2 */77 __u8 ctrl_2; /* control byte #2 */
78} __packed;78} __attribute__((packed));
79 79
80/* Define 802.2 SNAP header */80/* Define 802.2 SNAP header */
81#define FDDI_K_OUI_LEN 381#define FDDI_K_OUI_LEN 3
@@ -85,7 +85,7 @@ struct fddi_snap_hdr { · 3 unmodified lines
85 __u8 ctrl; /* always 0x03 */85 __u8 ctrl; /* always 0x03 */
86 __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */86 __u8 oui[FDDI_K_OUI_LEN]; /* organizational universal id */
87 __be16 ethertype; /* packet type ID field */87 __be16 ethertype; /* packet type ID field */
88} __packed;88} __attribute__((packed));
89 89
90/* Define FDDI LLC frame header */90/* Define FDDI LLC frame header */
91struct fddihdr {91struct fddihdr {
@@ -98,7 +98,7 @@ struct fddihdr { · 6 unmodified lines
98 struct fddi_8022_2_hdr llc_8022_2;98 struct fddi_8022_2_hdr llc_8022_2;
99 struct fddi_snap_hdr llc_snap;99 struct fddi_snap_hdr llc_snap;
100 } hdr;100 } hdr;
101} __packed;101} __attribute__((packed));
102 102
103#ifdef __KERNEL__103#ifdef __KERNEL__
104#include <linux/netdevice.h>104#include <linux/netdevice.h>
include/linux/if_hippi.h+4−4
@@ -104,7 +104,7 @@ struct hippi_fp_hdr { · 103 unmodified lines
104 __be32 fixed;104 __be32 fixed;
105#endif105#endif
106 __be32 d2_size;106 __be32 d2_size;
107} __packed;107} __attribute__((packed));
108 108
109struct hippi_le_hdr {109struct hippi_le_hdr {
110#if defined (__BIG_ENDIAN_BITFIELD)110#if defined (__BIG_ENDIAN_BITFIELD)
@@ -129,7 +129,7 @@ struct hippi_le_hdr { · 18 unmodified lines
129 __u8 daddr[HIPPI_ALEN];129 __u8 daddr[HIPPI_ALEN];
130 __u16 locally_administered;130 __u16 locally_administered;
131 __u8 saddr[HIPPI_ALEN];131 __u8 saddr[HIPPI_ALEN];
132} __packed;132} __attribute__((packed));
133 133
134#define HIPPI_OUI_LEN 3134#define HIPPI_OUI_LEN 3
135/*135/*
@@ -142,12 +142,12 @@ struct hippi_snap_hdr { · 6 unmodified lines
142 __u8 ctrl; /* always 0x03 */142 __u8 ctrl; /* always 0x03 */
143 __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/143 __u8 oui[HIPPI_OUI_LEN]; /* organizational universal id (zero)*/
144 __be16 ethertype; /* packet type ID field */144 __be16 ethertype; /* packet type ID field */
145} __packed;145} __attribute__((packed));
146 146
147struct hippi_hdr {147struct hippi_hdr {
148 struct hippi_fp_hdr fp;148 struct hippi_fp_hdr fp;
149 struct hippi_le_hdr le;149 struct hippi_le_hdr le;
150 struct hippi_snap_hdr snap;150 struct hippi_snap_hdr snap;
151} __packed;151} __attribute__((packed));
152 152
153#endif /* _LINUX_IF_HIPPI_H */153#endif /* _LINUX_IF_HIPPI_H */
include/linux/if_pppox.h+5−5
@@ -59,7 +59,7 @@ struct sockaddr_pppox { · 58 unmodified lines
59 union{ 59 union{
60 struct pppoe_addr pppoe; 60 struct pppoe_addr pppoe;
61 }sa_addr; 61 }sa_addr;
62} __packed;62} __attribute__((packed));
63 63
64/* The use of the above union isn't viable because the size of this64/* The use of the above union isn't viable because the size of this
65 * struct must stay fixed over time -- applications use sizeof(struct65 * struct must stay fixed over time -- applications use sizeof(struct
@@ -70,7 +70,7 @@ struct sockaddr_pppol2tp { · 4 unmodified lines
70 sa_family_t sa_family; /* address family, AF_PPPOX */70 sa_family_t sa_family; /* address family, AF_PPPOX */
71 unsigned int sa_protocol; /* protocol identifier */71 unsigned int sa_protocol; /* protocol identifier */
72 struct pppol2tp_addr pppol2tp;72 struct pppol2tp_addr pppol2tp;
73} __packed;73} __attribute__((packed));
74 74
75/* The L2TPv3 protocol changes tunnel and session ids from 16 to 3275/* The L2TPv3 protocol changes tunnel and session ids from 16 to 32
76 * bits. So we need a different sockaddr structure.76 * bits. So we need a different sockaddr structure.
@@ -79,7 +79,7 @@ struct sockaddr_pppol2tpv3 { · 2 unmodified lines
79 sa_family_t sa_family; /* address family, AF_PPPOX */79 sa_family_t sa_family; /* address family, AF_PPPOX */
80 unsigned int sa_protocol; /* protocol identifier */80 unsigned int sa_protocol; /* protocol identifier */
81 struct pppol2tpv3_addr pppol2tp;81 struct pppol2tpv3_addr pppol2tp;
82} __packed;82} __attribute__((packed));
83 83
84/*********************************************************************84/*********************************************************************
85 *85 *
@@ -101,7 +101,7 @@ struct pppoe_tag { · 15 unmodified lines
101 __be16 tag_type;101 __be16 tag_type;
102 __be16 tag_len;102 __be16 tag_len;
103 char tag_data[0];103 char tag_data[0];
104} __attribute ((packed));104} __attribute__ ((packed));
105 105
106/* Tag identifiers */106/* Tag identifiers */
107#define PTT_EOL __cpu_to_be16(0x0000)107#define PTT_EOL __cpu_to_be16(0x0000)
@@ -129,7 +129,7 @@ struct pppoe_hdr { · 21 unmodified lines
129 __be16 sid;129 __be16 sid;
130 __be16 length;130 __be16 length;
131 struct pppoe_tag tag[0];131 struct pppoe_tag tag[0];
132} __packed;132} __attribute__((packed));
133 133
134/* Length of entire PPPoE + PPP header */134/* Length of entire PPPoE + PPP header */
135#define PPPOE_SES_HLEN 8135#define PPPOE_SES_HLEN 8
include/linux/ipv6.h+2−2
@@ -58,7 +58,7 @@ struct ipv6_opt_hdr { · 57 unmodified lines
58 /* 58 /*
59 * TLV encoded option data follows.59 * TLV encoded option data follows.
60 */60 */
61} __packed; /* required for some archs */61} __attribute__((packed)); /* required for some archs */
62 62
63#define ipv6_destopt_hdr ipv6_opt_hdr63#define ipv6_destopt_hdr ipv6_opt_hdr
64#define ipv6_hopopt_hdr ipv6_opt_hdr64#define ipv6_hopopt_hdr ipv6_opt_hdr
@@ -99,7 +99,7 @@ struct ipv6_destopt_hao { · 34 unmodified lines
99 __u8 type;99 __u8 type;
100 __u8 length;100 __u8 length;
101 struct in6_addr addr;101 struct in6_addr addr;
102} __packed;102} __attribute__((packed));
103 103
104/*104/*
105 * IPv6 fixed header105 * IPv6 fixed header
include/linux/nbd.h+1−1
@@ -88,7 +88,7 @@ struct nbd_request { · 87 unmodified lines
88 char handle[8];88 char handle[8];
89 __be64 from;89 __be64 from;
90 __be32 len;90 __be32 len;
91} __packed;91} __attribute__((packed));
92 92
93/*93/*
94 * This is the reply packet that nbd-server sends back to the client after94 * 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
27 __u8 conn_high;27 __u8 conn_high;
28 __u8 function;28 __u8 function;
29 __u8 data[0];29 __u8 data[0];
30} __packed;30} __attribute__((packed));
31 31
32#define NCP_REPLY (0x3333)32#define NCP_REPLY (0x3333)
33#define NCP_WATCHDOG (0x3E3E)33#define NCP_WATCHDOG (0x3E3E)
@@ -42,7 +42,7 @@ struct ncp_reply_header { · 8 unmodified lines
42 __u8 completion_code;42 __u8 completion_code;
43 __u8 connection_state;43 __u8 connection_state;
44 __u8 data[0];44 __u8 data[0];
45} __packed;45} __attribute__((packed));
46 46
47#define NCP_VOLNAME_LEN (16)47#define NCP_VOLNAME_LEN (16)
48#define NCP_NUMBER_OF_VOLUMES (256)48#define NCP_NUMBER_OF_VOLUMES (256)
@@ -158,7 +158,7 @@ struct nw_info_struct { · 109 unmodified lines
158#ifdef __KERNEL__158#ifdef __KERNEL__
159 struct nw_nfs_info nfs;159 struct nw_nfs_info nfs;
160#endif160#endif
161} __packed;161} __attribute__((packed));
162 162
163/* modify mask - use with MODIFY_DOS_INFO structure */163/* modify mask - use with MODIFY_DOS_INFO structure */
164#define DM_ATTRIBUTES (cpu_to_le32(0x02))164#define DM_ATTRIBUTES (cpu_to_le32(0x02))
@@ -190,12 +190,12 @@ struct nw_modify_dos_info { · 25 unmodified lines
190 __u16 inheritanceGrantMask;190 __u16 inheritanceGrantMask;
191 __u16 inheritanceRevokeMask;191 __u16 inheritanceRevokeMask;
192 __u32 maximumSpace;192 __u32 maximumSpace;
193} __packed;193} __attribute__((packed));
194 194
195struct nw_search_sequence {195struct nw_search_sequence {
196 __u8 volNumber;196 __u8 volNumber;
197 __u32 dirBase;197 __u32 dirBase;
198 __u32 sequence;198 __u32 sequence;
199} __packed;199} __attribute__((packed));
200 200
201#endif /* _LINUX_NCP_H */201#endif /* _LINUX_NCP_H */
include/linux/netfilter/xt_IDLETIMER.h+1−1
@@ -39,7 +39,7 @@ struct idletimer_tg_info { · 38 unmodified lines
39 char label[MAX_IDLETIMER_LABEL_SIZE];39 char label[MAX_IDLETIMER_LABEL_SIZE];
40 40
41 /* for kernel module internal use only */41 /* for kernel module internal use only */
42 struct idletimer_tg *timer __attribute((aligned(8)));42 struct idletimer_tg *timer __attribute__((aligned(8)));
43};43};
44 44
45#endif45#endif
include/linux/phonet.h+2−2
@@ -56,7 +56,7 @@ struct phonethdr { · 55 unmodified lines
56 __be16 pn_length;56 __be16 pn_length;
57 __u8 pn_robj;57 __u8 pn_robj;
58 __u8 pn_sobj;58 __u8 pn_sobj;
59} __packed;59} __attribute__((packed));
60 60
61/* Common Phonet payload header */61/* Common Phonet payload header */
62struct phonetmsg {62struct phonetmsg {
@@ -98,7 +98,7 @@ struct sockaddr_pn { · 35 unmodified lines
98 __u8 spn_dev;98 __u8 spn_dev;
99 __u8 spn_resource;99 __u8 spn_resource;
100 __u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3];100 __u8 spn_zero[sizeof(struct sockaddr) - sizeof(sa_family_t) - 3];
101} __packed;101} __attribute__((packed));
102 102
103/* Well known address */103/* Well known address */
104#define PN_DEV_PC 0x10104#define PN_DEV_PC 0x10
include/linux/rfkill.h+1−1
@@ -81,7 +81,7 @@ struct rfkill_event { · 80 unmodified lines
81 __u8 type;81 __u8 type;
82 __u8 op;82 __u8 op;
83 __u8 soft, hard;83 __u8 soft, hard;
84} __packed;84} __attribute__((packed));
85 85
86/*86/*
87 * We are planning to be backward and forward compatible with changes87 * 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