diff mbox

[7/7] slirp: Fix packing for w32

Message ID 1314564200-6872-8-git-send-email-weil@mail.berlios.de
State Superseded
Headers show

Commit Message

Stefan Weil Aug. 28, 2011, 8:43 p.m. UTC
Use QEMU_PACKED to eliminate the effects of compiler option
-mms-bitfields.

Cc: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 slirp/slirp.h |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

Jan Kiszka Aug. 29, 2011, 10:12 a.m. UTC | #1
On 2011-08-28 22:43, Stefan Weil wrote:
> Use QEMU_PACKED to eliminate the effects of compiler option
> -mms-bitfields.
> 
> Cc: Jan Kiszka <jan.kiszka@siemens.com>
> Signed-off-by: Stefan Weil <weil@mail.berlios.de>
> ---
>  slirp/slirp.h |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/slirp/slirp.h b/slirp/slirp.h
> index dcf99d5..28a5c03 100644
> --- a/slirp/slirp.h
> +++ b/slirp/slirp.h
> @@ -199,7 +199,7 @@ struct arphdr {
>      uint32_t      ar_sip;           /* sender IP address       */
>      unsigned char ar_tha[ETH_ALEN]; /* target hardware address */
>      uint32_t      ar_tip;           /* target IP address       */
> -} __attribute__((packed));
> +} QEMU_PACKED;
>  
>  #define ARP_TABLE_SIZE 16
>  

There are further cases in slirp. Please address them as well.

Jan
Stefan Weil Aug. 29, 2011, 6:22 p.m. UTC | #2
Am 29.08.2011 12:12, schrieb Jan Kiszka:
> On 2011-08-28 22:43, Stefan Weil wrote:
>> Use QEMU_PACKED to eliminate the effects of compiler option
>> -mms-bitfields.
>>
>> Cc: Jan Kiszka<jan.kiszka@siemens.com>
>> Signed-off-by: Stefan Weil<weil@mail.berlios.de>
>> ---
>>   slirp/slirp.h |    2 +-
>>   1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/slirp/slirp.h b/slirp/slirp.h
>> index dcf99d5..28a5c03 100644
>> --- a/slirp/slirp.h
>> +++ b/slirp/slirp.h
>> @@ -199,7 +199,7 @@ struct arphdr {
>>       uint32_t      ar_sip;           /* sender IP address       */
>>       unsigned char ar_tha[ETH_ALEN]; /* target hardware address */
>>       uint32_t      ar_tip;           /* target IP address       */
>> -} __attribute__((packed));
>> +} QEMU_PACKED;
>>
>>   #define ARP_TABLE_SIZE 16
>>
>
> There are further cases in slirp. Please address them as well.
>
> Jan

I only addressed those cases which are affected by -mms-bitfields, see
http://lists.gnu.org/archive/html/qemu-devel/2011-08/msg03428.html.

Other files with __attribute__((packed)) will be handled in separate 
patches.

I don't think that I missed a case which breaks slirp, but if I did,
just tell me the struct name so I can fix it, too.

Stefan
Jan Kiszka Aug. 29, 2011, 9:15 p.m. UTC | #3
On 2011-08-29 20:22, Stefan Weil wrote:
> Am 29.08.2011 12:12, schrieb Jan Kiszka:
>> On 2011-08-28 22:43, Stefan Weil wrote:
>>> Use QEMU_PACKED to eliminate the effects of compiler option
>>> -mms-bitfields.
>>>
>>> Cc: Jan Kiszka<jan.kiszka@siemens.com>
>>> Signed-off-by: Stefan Weil<weil@mail.berlios.de>
>>> ---
>>>   slirp/slirp.h |    2 +-
>>>   1 files changed, 1 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/slirp/slirp.h b/slirp/slirp.h
>>> index dcf99d5..28a5c03 100644
>>> --- a/slirp/slirp.h
>>> +++ b/slirp/slirp.h
>>> @@ -199,7 +199,7 @@ struct arphdr {
>>>       uint32_t      ar_sip;           /* sender IP address       */
>>>       unsigned char ar_tha[ETH_ALEN]; /* target hardware address */
>>>       uint32_t      ar_tip;           /* target IP address       */
>>> -} __attribute__((packed));
>>> +} QEMU_PACKED;
>>>
>>>   #define ARP_TABLE_SIZE 16
>>>
>>
>> There are further cases in slirp. Please address them as well.
>>
>> Jan
> 
> I only addressed those cases which are affected by -mms-bitfields, see
> http://lists.gnu.org/archive/html/qemu-devel/2011-08/msg03428.html.
> 
> Other files with __attribute__((packed)) will be handled in separate
> patches.

OK, but this was not clear from the patch description.

> 
> I don't think that I missed a case which breaks slirp, but if I did,
> just tell me the struct name so I can fix it, too.

From just looking at the slirp struct, you are likely safe as none
should have odd layouts.

Jan
diff mbox

Patch

diff --git a/slirp/slirp.h b/slirp/slirp.h
index dcf99d5..28a5c03 100644
--- a/slirp/slirp.h
+++ b/slirp/slirp.h
@@ -199,7 +199,7 @@  struct arphdr {
     uint32_t      ar_sip;           /* sender IP address       */
     unsigned char ar_tha[ETH_ALEN]; /* target hardware address */
     uint32_t      ar_tip;           /* target IP address       */
-} __attribute__((packed));
+} QEMU_PACKED;
 
 #define ARP_TABLE_SIZE 16