Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1740862

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

From David Laight <David.Laight@ACULAB.COM>
Newsgroups linux.kernel
Subject RE: [PATCH v2 02/16] thunderbolt: Add support for XDomain properties
Date 2017-09-27 18:20 +0200
Message-ID <uune2-5qx-7@gated-at.bofh.it> (permalink)
References <utzqV-5xX-3@gated-at.bofh.it> <utzAD-5BH-23@gated-at.bofh.it> <uuciB-5Yf-7@gated-at.bofh.it> <uuiR4-1LQ-19@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


From: Mika Westerberg
> Sent: 27 September 2017 12:33
...
> 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?

You've endianness considerations as well with on-wire formats.

__packed indicates two things:
1) There will be no padding bytes between fields.
2) The structure itself might appear on any byte boundary.

The latter causes the compiler to do byte memory accesses and
shifts to load/store the data on some architectures.
So only mark things __packed when they might be misaligned in
memory.

	David

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH v2 02/16] thunderbolt: Add support for XDomain  properties David Miller <davem@davemloft.net> - 2017-09-27 06:40 +0200
  Re: [PATCH v2 02/16] thunderbolt: Add support for XDomain properties Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-09-27 13:40 +0200
    RE: [PATCH v2 02/16] thunderbolt: Add support for XDomain properties David Laight <David.Laight@ACULAB.COM> - 2017-09-27 18:20 +0200
    Re: [PATCH v2 02/16] thunderbolt: Add support for XDomain  properties David Miller <davem@davemloft.net> - 2017-09-27 18:30 +0200

csiph-web