From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39853) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMjCW-00030G-FL for qemu-devel@nongnu.org; Thu, 19 Sep 2013 14:43:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VMjCP-0000US-Mq for qemu-devel@nongnu.org; Thu, 19 Sep 2013 14:43:40 -0400 Received: from mx1.redhat.com ([209.132.183.28]:4471) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VMjCP-0000UN-F8 for qemu-devel@nongnu.org; Thu, 19 Sep 2013 14:43:33 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id r8JIhWgi028557 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 19 Sep 2013 14:43:32 -0400 From: Jeff Cody Date: Thu, 19 Sep 2013 14:43:21 -0400 Message-Id: In-Reply-To: References: In-Reply-To: References: Subject: [Qemu-devel] [PATCH 3/5] block: qcow2 - used QEMU_PACKED for on-disk structures List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: kwolf@redhat.com, stefanha@redhat.com 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 --- 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