# Re: \[PATCH\] net: define \_\_packed for the userspace code

- From: Changli Gao \<hidden\>
- Date: 2010-08-22 13:47:41 
- List: netdev
- Page: https://ratatoskr.run/netdev/2010/08/3607988
- Thread: https://ratatoskr.run/netdev/2010/08/3607981/t.md

```text
On Sun, Aug 22, 2010 at 9:07 PM, Arnd Bergmann [ref] wrote:
> On Sunday 22 August 2010 13:23:42 Changli Gao wrote:
>> On Sun, Aug 22, 2010 at 7:12 PM, Changli Gao [ref] wrote:
>> > This commit
>> >
>> >  commit bc10502dba37d3b210efd9f3867212298f13b78e
>> >  Author: Eric Dumazet [ref]
>> >  Date:   Thu Jun 3 03:21:52 2010 -0700
>> >
>> >    net: use __packed annotation
>> >
>> > makes use of __packed in the userspace code. So we'd better define __packed
>> > for the userspace code too.
>> >
>>
>> Oh, sorry. This patch can't work as include/linux/compiler.h isn't
>> exported to the userspace. But where should we define __packed for the
>> userspace code? include/linux/types.h?
>
> I would try to avoid making those structures packed to start with.
> From what I can see, they structures annotated in the above commit
> mostly don't even require explicit packing because they are already
> packed. Not marking them packed makes the code portable to non-gcc
> compilers.
>

Maybe __packed is used somewhere to hint that some members of a
structure maybe unaligned.

-- 
Regards,
Changli Gao(xiaosuo@gmail.com)
```
