block: qcow2 - used QEMU_PACKED for on-disk structures

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 <jcody@redhat.com>
Reviewed-by: Richard Henderson <rth@twiddle.net>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
This commit is contained in:
Jeff Cody 2013-09-25 12:08:50 -04:00 committed by Kevin Wolf
parent e54835c06d
commit c4217f645d
2 changed files with 2 additions and 2 deletions

View File

@ -52,7 +52,7 @@
typedef struct {
uint32_t magic;
uint32_t len;
} QCowExtension;
} QEMU_PACKED QCowExtension;
#define QCOW2_EXT_MAGIC_END 0
#define QCOW2_EXT_MAGIC_BACKING_FORMAT 0xE2792ACA

View File

@ -86,7 +86,7 @@ typedef struct QCowHeader {
uint32_t refcount_order;
uint32_t header_length;
} QCowHeader;
} QEMU_PACKED QCowHeader;
typedef struct QCowSnapshot {
uint64_t l1_table_offset;