]> git.ipfire.org Git - thirdparty/libvirt.git/commit
blockjob: avoid compiler uncertainty in info sizing
authorEric Blake <eblake@redhat.com>
Sat, 14 Jun 2014 12:42:41 +0000 (06:42 -0600)
committerEric Blake <eblake@redhat.com>
Mon, 16 Jun 2014 17:13:35 +0000 (11:13 -0600)
commitcfe087a211a11a554c396b2b94505c0ae0585b4d
tree25131874327cfc1aa2fe6b27752640070e572155
parent3de3294de166b1a815cf3072706e04e8d33f365f
blockjob: avoid compiler uncertainty in info sizing

We have a policy of avoiding enum types in structs in our public
API, because it is possible for a client to choose compiler options
that can change the in-memory ABI of that struct based on whether
the enum value occupies an int or a minimal size.  But we missed
this for virDomainBlockJobInfo.  We got lucky on little-endian
machines - if the enum fits minimal size (a char), we still end
up padding to the next long before the next field; but on
big-endian, a client interpreting the enum as a char would always
see 0 when the server supplies contents as an int.

* include/libvirt/libvirt.h.in (virDomainBlockJobInfo): Enforce
particular sizing.

Signed-off-by: Eric Blake <eblake@redhat.com>
include/libvirt/libvirt.h.in