diff mbox

[3/5] block: qcow2 - used QEMU_PACKED for on-disk structures

Message ID b8c2e03240fa9f5e83034b037d9e307c7868e37a.1379615569.git.jcody@redhat.com
State New
Headers show

Commit Message

Jeff Cody Sept. 19, 2013, 6:43 p.m. UTC
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>
---
 block/qcow2.c | 2 +-
 block/qcow2.h | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

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;