0a122b
From 2abbf288d8f8cd28b89358c50bb881b2afd974c2 Mon Sep 17 00:00:00 2001
0a122b
From: Jeffrey Cody <jcody@redhat.com>
0a122b
Date: Wed, 20 Nov 2013 19:43:52 +0100
0a122b
Subject: [PATCH 09/25] block: vhdx code movement - VHDXMetadataEntries and BDRVVHDXState to header.
0a122b
0a122b
RH-Author: Jeffrey Cody <jcody@redhat.com>
0a122b
Message-id: <9c245806ba56c5fa2386de02cffbaace28aa928c.1384975172.git.jcody@redhat.com>
0a122b
Patchwork-id: 55802
0a122b
O-Subject: [RHEL7 qemu-kvm PATCH 09/26] block: vhdx code movement - VHDXMetadataEntries and BDRVVHDXState to header.
0a122b
Bugzilla: 879234
0a122b
RH-Acked-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
0a122b
RH-Acked-by: Fam Zheng <famz@redhat.com>
0a122b
0a122b
In preparation for VHDX log support, move these structures to the
0a122b
header.
0a122b
0a122b
Signed-off-by: Jeff Cody <jcody@redhat.com>
0a122b
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
0a122b
(cherry picked from commit 28541d46280733b9afe7b106a3a6665275a45e5f)
0a122b
---
0a122b
 block/vhdx.c | 52 ----------------------------------------------------
0a122b
 block/vhdx.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
0a122b
 2 files changed, 48 insertions(+), 52 deletions(-)
0a122b
0a122b
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
0a122b
---
0a122b
 block/vhdx.c |   52 ----------------------------------------------------
0a122b
 block/vhdx.h |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
0a122b
 2 files changed, 48 insertions(+), 52 deletions(-)
0a122b
0a122b
diff --git a/block/vhdx.c b/block/vhdx.c
0a122b
index fba2aa9..16321ff 100644
0a122b
--- a/block/vhdx.c
0a122b
+++ b/block/vhdx.c
0a122b
@@ -105,16 +105,6 @@ static const MSGUID parent_vhdx_guid = { .data1 = 0xb04aefb7,
0a122b
      META_PAGE_83_PRESENT | META_LOGICAL_SECTOR_SIZE_PRESENT | \
0a122b
      META_PHYS_SECTOR_SIZE_PRESENT)
0a122b
 
0a122b
-typedef struct VHDXMetadataEntries {
0a122b
-    VHDXMetadataTableEntry file_parameters_entry;
0a122b
-    VHDXMetadataTableEntry virtual_disk_size_entry;
0a122b
-    VHDXMetadataTableEntry page83_data_entry;
0a122b
-    VHDXMetadataTableEntry logical_sector_size_entry;
0a122b
-    VHDXMetadataTableEntry phys_sector_size_entry;
0a122b
-    VHDXMetadataTableEntry parent_locator_entry;
0a122b
-    uint16_t present;
0a122b
-} VHDXMetadataEntries;
0a122b
-
0a122b
 
0a122b
 typedef struct VHDXSectorInfo {
0a122b
     uint32_t bat_idx;       /* BAT entry index */
0a122b
@@ -125,48 +115,6 @@ typedef struct VHDXSectorInfo {
0a122b
     uint64_t block_offset;  /* block offset, in bytes */
0a122b
 } VHDXSectorInfo;
0a122b
 
0a122b
-
0a122b
-
0a122b
-typedef struct BDRVVHDXState {
0a122b
-    CoMutex lock;
0a122b
-
0a122b
-    int curr_header;
0a122b
-    VHDXHeader *headers[2];
0a122b
-
0a122b
-    VHDXRegionTableHeader rt;
0a122b
-    VHDXRegionTableEntry bat_rt;         /* region table for the BAT */
0a122b
-    VHDXRegionTableEntry metadata_rt;    /* region table for the metadata */
0a122b
-
0a122b
-    VHDXMetadataTableHeader metadata_hdr;
0a122b
-    VHDXMetadataEntries metadata_entries;
0a122b
-
0a122b
-    VHDXFileParameters params;
0a122b
-    uint32_t block_size;
0a122b
-    uint32_t block_size_bits;
0a122b
-    uint32_t sectors_per_block;
0a122b
-    uint32_t sectors_per_block_bits;
0a122b
-
0a122b
-    uint64_t virtual_disk_size;
0a122b
-    uint32_t logical_sector_size;
0a122b
-    uint32_t physical_sector_size;
0a122b
-
0a122b
-    uint64_t chunk_ratio;
0a122b
-    uint32_t chunk_ratio_bits;
0a122b
-    uint32_t logical_sector_size_bits;
0a122b
-
0a122b
-    uint32_t bat_entries;
0a122b
-    VHDXBatEntry *bat;
0a122b
-    uint64_t bat_offset;
0a122b
-
0a122b
-    MSGUID session_guid;
0a122b
-
0a122b
-
0a122b
-    VHDXParentLocatorHeader parent_header;
0a122b
-    VHDXParentLocatorEntry *parent_entries;
0a122b
-
0a122b
-    Error *migration_blocker;
0a122b
-} BDRVVHDXState;
0a122b
-
0a122b
 /* Calculates new checksum.
0a122b
  *
0a122b
  * Zero is substituted during crc calculation for the original crc field
0a122b
diff --git a/block/vhdx.h b/block/vhdx.h
0a122b
index 2223b15..57375ff 100644
0a122b
--- a/block/vhdx.h
0a122b
+++ b/block/vhdx.h
0a122b
@@ -308,6 +308,54 @@ typedef struct QEMU_PACKED VHDXParentLocatorEntry {
0a122b
 
0a122b
 /* ----- END VHDX SPECIFICATION STRUCTURES ---- */
0a122b
 
0a122b
+typedef struct VHDXMetadataEntries {
0a122b
+    VHDXMetadataTableEntry file_parameters_entry;
0a122b
+    VHDXMetadataTableEntry virtual_disk_size_entry;
0a122b
+    VHDXMetadataTableEntry page83_data_entry;
0a122b
+    VHDXMetadataTableEntry logical_sector_size_entry;
0a122b
+    VHDXMetadataTableEntry phys_sector_size_entry;
0a122b
+    VHDXMetadataTableEntry parent_locator_entry;
0a122b
+    uint16_t present;
0a122b
+} VHDXMetadataEntries;
0a122b
+
0a122b
+typedef struct BDRVVHDXState {
0a122b
+    CoMutex lock;
0a122b
+
0a122b
+    int curr_header;
0a122b
+    VHDXHeader *headers[2];
0a122b
+
0a122b
+    VHDXRegionTableHeader rt;
0a122b
+    VHDXRegionTableEntry bat_rt;         /* region table for the BAT */
0a122b
+    VHDXRegionTableEntry metadata_rt;    /* region table for the metadata */
0a122b
+
0a122b
+    VHDXMetadataTableHeader metadata_hdr;
0a122b
+    VHDXMetadataEntries metadata_entries;
0a122b
+
0a122b
+    VHDXFileParameters params;
0a122b
+    uint32_t block_size;
0a122b
+    uint32_t block_size_bits;
0a122b
+    uint32_t sectors_per_block;
0a122b
+    uint32_t sectors_per_block_bits;
0a122b
+
0a122b
+    uint64_t virtual_disk_size;
0a122b
+    uint32_t logical_sector_size;
0a122b
+    uint32_t physical_sector_size;
0a122b
+
0a122b
+    uint64_t chunk_ratio;
0a122b
+    uint32_t chunk_ratio_bits;
0a122b
+    uint32_t logical_sector_size_bits;
0a122b
+
0a122b
+    uint32_t bat_entries;
0a122b
+    VHDXBatEntry *bat;
0a122b
+    uint64_t bat_offset;
0a122b
+
0a122b
+    MSGUID session_guid;
0a122b
+
0a122b
+    VHDXParentLocatorHeader parent_header;
0a122b
+    VHDXParentLocatorEntry *parent_entries;
0a122b
+
0a122b
+    Error *migration_blocker;
0a122b
+} BDRVVHDXState;
0a122b
 
0a122b
 void vhdx_guid_generate(MSGUID *guid);
0a122b
 
0a122b
-- 
0a122b
1.7.1
0a122b