From cfe087a211a11a554c396b2b94505c0ae0585b4d Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Sat, 14 Jun 2014 06:42:41 -0600 Subject: [PATCH] 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 --- include/libvirt/libvirt.h.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/libvirt/libvirt.h.in b/include/libvirt/libvirt.h.in index 10ce4a172d..dc88c401c3 100644 --- a/include/libvirt/libvirt.h.in +++ b/include/libvirt/libvirt.h.in @@ -2544,7 +2544,7 @@ typedef unsigned long long virDomainBlockJobCursor; typedef struct _virDomainBlockJobInfo virDomainBlockJobInfo; struct _virDomainBlockJobInfo { - virDomainBlockJobType type; + int type; /* virDomainBlockJobType */ unsigned long bandwidth; /* * The following fields provide an indication of block job progress. @cur -- GitLab