aboutsummaryrefslogtreecommitdiff
path: root/block/vhdx.h
diff options
context:
space:
mode:
authorJeff Cody <jcody@redhat.com>2013-10-30 10:44:45 -0400
committerStefan Hajnoczi <stefanha@redhat.com>2013-11-07 13:58:58 +0100
commit0a43a1b5d7c33208120eeb2d98ebb9ab15dc2c87 (patch)
tree9167c27dbc1f182482aa3fd645962aefa3f0b3c9 /block/vhdx.h
parentc46415afc2c99ea052f52f9d68ed9a78799f2c10 (diff)
block: vhdx - log parsing, replay, and flush support
This adds support for VHDX v0 logs, as specified in Microsoft's VHDX Specification Format v1.00: https://www.microsoft.com/en-us/download/details.aspx?id=34750 The following support is added: * Log parsing, and validation - validate that an existing log is correct. * Log search - search through an existing log, to find any valid sequence of entries. * Log replay and flush - replay an existing log, and flush/clear the log when complete. The VHDX log is a circular buffer, with elements (sectors) of 4KB. A log entry is a variably-length number of sectors, that is comprised of a header and 'descriptors', that describe each sector. A log may contain multiple entries, know as a log sequence. In a log sequence, each log entry immediately follows the previous entry, with an incrementing sequence number. There can only ever be one active and valid sequence in the log. Each log entry must match the file log GUID in order to be valid (along with other criteria). Once we have flushed all valid log entries, we marked the file log GUID to be zero, which indicates a buffer with no valid entries. Signed-off-by: Jeff Cody <jcody@redhat.com> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'block/vhdx.h')
-rw-r--r--block/vhdx.h7
1 files changed, 6 insertions, 1 deletions
diff --git a/block/vhdx.h b/block/vhdx.h
index 6c35737b07..584ebec8fc 100644
--- a/block/vhdx.h
+++ b/block/vhdx.h
@@ -326,7 +326,11 @@ typedef struct VHDXMetadataEntries {
typedef struct VHDXLogEntries {
uint64_t offset;
uint64_t length;
- uint32_t head;
+ uint32_t write;
+ uint32_t read;
+ VHDXLogEntryHeader *hdr;
+ void *desc_buffer;
+ uint64_t sequence;
uint32_t tail;
} VHDXLogEntries;
@@ -383,6 +387,7 @@ uint32_t vhdx_checksum_calc(uint32_t crc, uint8_t *buf, size_t size,
bool vhdx_checksum_is_valid(uint8_t *buf, size_t size, int crc_offset);
+int vhdx_parse_log(BlockDriverState *bs, BDRVVHDXState *s, bool *flushed);
static inline void leguid_to_cpus(MSGUID *guid)
{