mirror of
https://git.proxmox.com/git/qemu
synced 2025-08-14 21:35:07 +00:00
block: vhdx - log support struct and defines
This adds some magic number defines, and internal structure definitions for VHDX log replay support. The struct VHDXLogEntries does not reflect an on-disk data structure, and thus does not need to be packed. Some minor code style fixes are applied as well. Signed-off-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
parent
28541d4628
commit
625565d27e
24
block/vhdx.h
24
block/vhdx.h
@ -151,7 +151,10 @@ typedef struct QEMU_PACKED VHDXRegionTableEntry {
|
|||||||
|
|
||||||
|
|
||||||
/* ---- LOG ENTRY STRUCTURES ---- */
|
/* ---- 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_HDR_SIZE 64
|
||||||
|
#define VHDX_LOG_SIGNATURE 0x65676f6c
|
||||||
typedef struct QEMU_PACKED VHDXLogEntryHeader {
|
typedef struct QEMU_PACKED VHDXLogEntryHeader {
|
||||||
uint32_t signature; /* "loge" in ASCII */
|
uint32_t signature; /* "loge" in ASCII */
|
||||||
uint32_t checksum; /* CRC-32C hash of the 64KB table */
|
uint32_t checksum; /* CRC-32C hash of the 64KB table */
|
||||||
@ -174,7 +177,8 @@ typedef struct QEMU_PACKED VHDXLogEntryHeader {
|
|||||||
} VHDXLogEntryHeader;
|
} VHDXLogEntryHeader;
|
||||||
|
|
||||||
#define VHDX_LOG_DESC_SIZE 32
|
#define VHDX_LOG_DESC_SIZE 32
|
||||||
|
#define VHDX_LOG_DESC_SIGNATURE 0x63736564
|
||||||
|
#define VHDX_LOG_ZERO_SIGNATURE 0x6f72657a
|
||||||
typedef struct QEMU_PACKED VHDXLogDescriptor {
|
typedef struct QEMU_PACKED VHDXLogDescriptor {
|
||||||
uint32_t signature; /* "zero" or "desc" in ASCII */
|
uint32_t signature; /* "zero" or "desc" in ASCII */
|
||||||
union {
|
union {
|
||||||
@ -194,6 +198,7 @@ typedef struct QEMU_PACKED VHDXLogDescriptor {
|
|||||||
vhdx_log_entry_header */
|
vhdx_log_entry_header */
|
||||||
} VHDXLogDescriptor;
|
} VHDXLogDescriptor;
|
||||||
|
|
||||||
|
#define VHDX_LOG_DATA_SIGNATURE 0x61746164
|
||||||
typedef struct QEMU_PACKED VHDXLogDataSector {
|
typedef struct QEMU_PACKED VHDXLogDataSector {
|
||||||
uint32_t data_signature; /* "data" in ASCII */
|
uint32_t data_signature; /* "data" in ASCII */
|
||||||
uint32_t sequence_high; /* 4 MSB of 8 byte sequence_number */
|
uint32_t sequence_high; /* 4 MSB of 8 byte sequence_number */
|
||||||
@ -252,8 +257,8 @@ typedef struct QEMU_PACKED VHDXMetadataTableEntry {
|
|||||||
metadata region */
|
metadata region */
|
||||||
/* note: if length = 0, so is offset */
|
/* note: if length = 0, so is offset */
|
||||||
uint32_t length; /* length of metadata. <= 1MB. */
|
uint32_t length; /* length of metadata. <= 1MB. */
|
||||||
uint32_t data_bits; /* least-significant 3 bits are flags, the
|
uint32_t data_bits; /* least-significant 3 bits are flags,
|
||||||
rest are reserved (see above) */
|
the rest are reserved (see above) */
|
||||||
uint32_t reserved2;
|
uint32_t reserved2;
|
||||||
} VHDXMetadataTableEntry;
|
} VHDXMetadataTableEntry;
|
||||||
|
|
||||||
@ -265,8 +270,8 @@ typedef struct QEMU_PACKED VHDXMetadataTableEntry {
|
|||||||
typedef struct QEMU_PACKED VHDXFileParameters {
|
typedef struct QEMU_PACKED VHDXFileParameters {
|
||||||
uint32_t block_size; /* size of each payload block, always
|
uint32_t block_size; /* size of each payload block, always
|
||||||
power of 2, <= 256MB and >= 1MB. */
|
power of 2, <= 256MB and >= 1MB. */
|
||||||
uint32_t data_bits; /* least-significant 2 bits are flags, the rest
|
uint32_t data_bits; /* least-significant 2 bits are flags,
|
||||||
are reserved (see above) */
|
the rest are reserved (see above) */
|
||||||
} VHDXFileParameters;
|
} VHDXFileParameters;
|
||||||
|
|
||||||
typedef struct QEMU_PACKED VHDXVirtualDiskSize {
|
typedef struct QEMU_PACKED VHDXVirtualDiskSize {
|
||||||
@ -318,6 +323,13 @@ typedef struct VHDXMetadataEntries {
|
|||||||
uint16_t present;
|
uint16_t present;
|
||||||
} VHDXMetadataEntries;
|
} VHDXMetadataEntries;
|
||||||
|
|
||||||
|
typedef struct VHDXLogEntries {
|
||||||
|
uint64_t offset;
|
||||||
|
uint64_t length;
|
||||||
|
uint32_t head;
|
||||||
|
uint32_t tail;
|
||||||
|
} VHDXLogEntries;
|
||||||
|
|
||||||
typedef struct BDRVVHDXState {
|
typedef struct BDRVVHDXState {
|
||||||
CoMutex lock;
|
CoMutex lock;
|
||||||
|
|
||||||
@ -351,6 +363,8 @@ typedef struct BDRVVHDXState {
|
|||||||
|
|
||||||
MSGUID session_guid;
|
MSGUID session_guid;
|
||||||
|
|
||||||
|
VHDXLogEntries log;
|
||||||
|
|
||||||
VHDXParentLocatorHeader parent_header;
|
VHDXParentLocatorHeader parent_header;
|
||||||
VHDXParentLocatorEntry *parent_entries;
|
VHDXParentLocatorEntry *parent_entries;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user