From patchwork Wed Jul 24 17:54:40 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Cody X-Patchwork-Id: 261482 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 549AB2C007C for ; Thu, 25 Jul 2013 03:57:16 +1000 (EST) Received: from localhost ([::1]:54819 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V23JJ-0006l9-SR for incoming@patchwork.ozlabs.org; Wed, 24 Jul 2013 13:57:13 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41071) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V23HE-00049W-DP for qemu-devel@nongnu.org; Wed, 24 Jul 2013 13:55:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V23HA-0001h7-Fj for qemu-devel@nongnu.org; Wed, 24 Jul 2013 13:55:04 -0400 Received: from mx1.redhat.com ([209.132.183.28]:16415) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V23HA-0001gw-5y for qemu-devel@nongnu.org; Wed, 24 Jul 2013 13:55:00 -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 r6OHsx1n031531 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 24 Jul 2013 13:54:59 -0400 Received: from localhost ([10.3.112.10]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id r6OHsvaQ011012 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 24 Jul 2013 13:54:58 -0400 From: Jeff Cody To: qemu-devel@nongnu.org Date: Wed, 24 Jul 2013 13:54:40 -0400 Message-Id: <803cc31a021f57b4310f133ea5b03e2af7ef7f04.1374687002.git.jcody@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: kwolf@redhat.com, stefanha@redhat.com Subject: [Qemu-devel] [PATCH 4/9] block: vhdx - log support struct and defines X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This adds some magic number defines, and internal structure definitions for VHDX log replay support. Signed-off-by: Jeff Cody --- block/vhdx.h | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/block/vhdx.h b/block/vhdx.h index c8d8593..2db6615 100644 --- a/block/vhdx.h +++ b/block/vhdx.h @@ -151,7 +151,10 @@ typedef struct QEMU_PACKED VHDXRegionTableEntry { /* ---- LOG ENTRY STRUCTURES ---- */ +#define VHDX_LOG_MIN_SIZE (1024*1024) +#define VHDX_LOG_SECTOR_SIZE 4096 #define VHDX_LOG_HDR_SIZE 64 +#define VHDX_LOG_SIGNATURE 0x65676f6c typedef struct QEMU_PACKED VHDXLogEntryHeader { uint32_t signature; /* "loge" in ASCII */ uint32_t checksum; /* CRC-32C hash of the 64KB table */ @@ -174,7 +177,8 @@ typedef struct QEMU_PACKED VHDXLogEntryHeader { } VHDXLogEntryHeader; #define VHDX_LOG_DESC_SIZE 32 - +#define VHDX_LOG_DESC_SIGNATURE 0x63736564 +#define VHDX_LOG_ZERO_SIGNATURE 0x6f72657a typedef struct QEMU_PACKED VHDXLogDescriptor { uint32_t signature; /* "zero" or "desc" in ASCII */ union { @@ -194,6 +198,7 @@ typedef struct QEMU_PACKED VHDXLogDescriptor { vhdx_log_entry_header */ } VHDXLogDescriptor; +#define VHDX_LOG_DATA_SIGNATURE 0x61746164 typedef struct QEMU_PACKED VHDXLogDataSector { uint32_t data_signature; /* "data" in ASCII */ uint32_t sequence_high; /* 4 MSB of 8 byte sequence_number */ @@ -318,6 +323,18 @@ typedef struct VHDXMetadataEntries { uint16_t present; } VHDXMetadataEntries; +typedef struct VHDXLogEntries { + uint64_t offset; + uint64_t length; + uint32_t head; + uint32_t tail; +} VHDXLogEntries; + +typedef struct VHDXLogEntryInfo { + uint64_t sector_start; + uint32_t desc_count; +} VHDXLogEntryInfo; + typedef struct BDRVVHDXState { CoMutex lock; @@ -351,6 +368,8 @@ typedef struct BDRVVHDXState { MSGUID session_guid; + VHDXLogEntries log; + VHDXParentLocatorHeader parent_header; VHDXParentLocatorEntry *parent_entries;