QCowHeader and QCowExtension are structs that reside in the on-disk image format, and are read and written directly via bdrv_pread()/write(), and as such should be packed to avoid any unintentional struct padding.
Signed-off-by: Jeff Cody <jc...@redhat.com> --- block/qcow2.c | 2 +- block/qcow2.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/block/qcow2.c b/block/qcow2.c index 318d95d..02b92aa 100644 --- a/block/qcow2.c +++ b/block/qcow2.c @@ -49,7 +49,7 @@ */ -typedef struct { +typedef struct QEMU_PACKED { uint32_t magic; uint32_t len; } QCowExtension; diff --git a/block/qcow2.h b/block/qcow2.h index c90e5d6..1fe111a 100644 --- a/block/qcow2.h +++ b/block/qcow2.h @@ -64,7 +64,7 @@ #define QCOW2_OPT_DISCARD_SNAPSHOT "pass-discard-snapshot" #define QCOW2_OPT_DISCARD_OTHER "pass-discard-other" -typedef struct QCowHeader { +typedef struct QEMU_PACKED QCowHeader { uint32_t magic; uint32_t version; uint64_t backing_file_offset; -- 1.8.3.1