Messages in this thread | | | Date | Wed, 27 Sep 2017 09:22:16 -0700 (PDT) | Subject | Re: [PATCH v2 02/16] thunderbolt: Add support for XDomain properties | From | David Miller <> |
| |
From: Mika Westerberg <mika.westerberg@linux.intel.com> Date: Wed, 27 Sep 2017 14:32:41 +0300
> Just for my education, is there some rule which tells when __packed is > to be used? For example the above structures are all 32-bit aligned but > how about something like: > > struct foo { > u32 value1; > u8 value2; > }; > > If the on-wire format requires such structures I assume __packed > is needed here?
Usually header elements are 32-bit aligned in a protocol, so it wouldn't be specified like that.
The only legitimate case I've seen is where things are purposefully misaligned within the header, like this:
struct foo { u16 x; u64 y; u16 z; };
Where the 'y' element is 2-byte aligned.
Fortunately, those situations are extremely rare.
| |