Thread (28 messages) flat view 28 messages, 4 authors, 2017-09-27

Re: [PATCH v2 02/16] thunderbolt: Add support for XDomain properties

From: David Miller <davem@davemloft.net>
Date: 2017-09-27 16:22:19
Also in: lkml

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.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help