aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Cody <jcody@redhat.com>2013-09-25 12:08:50 -0400
committerKevin Wolf <kwolf@redhat.com>2013-09-25 20:51:13 +0200
commitc4217f645dfdfd405cd0c50af953515e1114436a (patch)
tree10c54129685ed5c7347c5746a3674356f254dbbc
parente54835c06d1f4896941c1505a86532aa1403ebe8 (diff)
downloadqemu-c4217f645dfdfd405cd0c50af953515e1114436a.zip
qemu-c4217f645dfdfd405cd0c50af953515e1114436a.tar.gz
qemu-c4217f645dfdfd405cd0c50af953515e1114436a.tar.bz2
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>
-rw-r--r--block/qcow2.c2
-rw-r--r--block/qcow2.h2
2 files changed, 2 insertions, 2 deletions
diff --git a/block/qcow2.c b/block/qcow2.c
index 318d95d..4a9888c 100644
--- a/block/qcow2.c
+++ b/block/qcow2.c
@@ -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
diff --git a/block/qcow2.h b/block/qcow2.h
index c90e5d6..455e38d 100644
--- a/block/qcow2.h
+++ b/block/qcow2.h
@@ -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;