On Mon, Mar 05, 2018 at 05:58:15PM +0100, Christophe de Dinechin wrote: > > Perhaps you lost the mails saying that the protocol structure don't and > > won't have internal padding. > > Only on x86. It has padding on any ABI with a natural 64-bit alignment. > > I don’t have an Itanium handy, but computing the offsetof(msg.msg) and > offsetof(msg.StreamNotifyError::msg) on a Raspberry Pi using > -mstructure-size-boundary=64 yields: > > offsetof msg.msg=8 > offsetof msg.StreamNotifyError::msg=4
For what it's worth, at the moment stream-device.h expects that its
struct members are going to be "naturally aligned", ie that struct
members are aligned to a multiple of their size in byte within the
struct. This seems to be the case with the ABIs/arch we are interested
in. If there is a real-world ABI which does not match this, then we'll
indeed need to adapt stream-device.h assumptions.
The rest of spice-protocol is using __attribute__("packed"). The
disadvantage with that is that you have to do some manual handling of
unaligned accesses on some arches (older 32 bits ARM come to mind).
Christophe
signature.asc
Description: PGP signature
_______________________________________________ Spice-devel mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/spice-devel
