blob: 0b74924cee987ca57132bf90eeee0cd197278069 [file] [log] [blame]
Jeff Cody203cdba2013-04-29 14:48:17 -04001/*
2 * Block driver for Hyper-V VHDX Images
3 *
4 * Copyright (c) 2013 Red Hat, Inc.,
5 *
6 * Authors:
7 * Jeff Cody <jcody@redhat.com>
8 *
Jeff Cody6e9d2902013-10-30 10:44:38 -04009 * This is based on the "VHDX Format Specification v1.00", published 8/25/2012
Jeff Cody203cdba2013-04-29 14:48:17 -040010 * by Microsoft:
Jeff Cody6e9d2902013-10-30 10:44:38 -040011 * https://www.microsoft.com/en-us/download/details.aspx?id=34750
Jeff Cody203cdba2013-04-29 14:48:17 -040012 *
13 * This work is licensed under the terms of the GNU LGPL, version 2 or later.
14 * See the COPYING.LIB file in the top-level directory.
15 *
16 */
17
18#ifndef BLOCK_VHDX_H
19#define BLOCK_VHDX_H
Stefano Garzarellae9991e22019-03-27 10:56:33 +010020#include "qemu/units.h"
Jeff Cody3412f7b2013-10-30 10:44:53 -040021
Chunyan Liu53660922014-06-05 17:21:08 +080022#define DEFAULT_LOG_SIZE 1048576 /* 1MiB */
Stefano Garzarella0cb98af2019-03-27 10:56:34 +010023/* Note: can't use 1 * MiB, because it's passed to stringify() */
24
Jeff Cody203cdba2013-04-29 14:48:17 -040025/* Structures and fields present in the VHDX file */
26
27/* The header section has the following blocks,
28 * each block is 64KB:
29 *
30 * _____________________________________________________________________________
31 * | File Id. | Header 1 | Header 2 | Region Table | Reserved (768KB) |
32 * |----------|---------------|------------|--------------|--------------------|
33 * | | | | | |
34 * 0.........64KB...........128KB........192KB..........256KB................1MB
35 */
36
Stefano Garzarella0cb98af2019-03-27 10:56:34 +010037#define VHDX_HEADER_BLOCK_SIZE (64 * KiB)
Jeff Cody203cdba2013-04-29 14:48:17 -040038
39#define VHDX_FILE_ID_OFFSET 0
Jeff Cody625565d2013-10-30 10:44:41 -040040#define VHDX_HEADER1_OFFSET (VHDX_HEADER_BLOCK_SIZE * 1)
41#define VHDX_HEADER2_OFFSET (VHDX_HEADER_BLOCK_SIZE * 2)
42#define VHDX_REGION_TABLE_OFFSET (VHDX_HEADER_BLOCK_SIZE * 3)
Jeff Cody3412f7b2013-10-30 10:44:53 -040043#define VHDX_REGION_TABLE2_OFFSET (VHDX_HEADER_BLOCK_SIZE * 4)
Jeff Cody203cdba2013-04-29 14:48:17 -040044
Jeff Cody3412f7b2013-10-30 10:44:53 -040045#define VHDX_HEADER_SECTION_END (1 * MiB)
Jeff Cody203cdba2013-04-29 14:48:17 -040046/*
47 * A note on the use of MS-GUID fields. For more details on the GUID,
48 * please see: https://en.wikipedia.org/wiki/Globally_unique_identifier.
49 *
50 * The VHDX specification only states that these are MS GUIDs, and which
51 * bytes are data1-data4. It makes no mention of what algorithm should be used
52 * to generate the GUID, nor what standard. However, looking at the specified
53 * known GUID fields, it appears the GUIDs are:
54 * Standard/DCE GUID type (noted by 10b in the MSB of byte 0 of .data4)
55 * Random algorithm (noted by 0x4XXX for .data3)
56 */
57
58/* ---- HEADER SECTION STRUCTURES ---- */
59
60/* These structures are ones that are defined in the VHDX specification
61 * document */
62
Jeff Cody62e466e2014-03-14 06:50:37 -040063#define VHDX_FILE_SIGNATURE 0x656C696678646876ULL /* "vhdxfile" in ASCII */
Jeff Cody203cdba2013-04-29 14:48:17 -040064typedef struct VHDXFileIdentifier {
65 uint64_t signature; /* "vhdxfile" in ASCII */
66 uint16_t creator[256]; /* optional; utf-16 string to identify
Jeff Cody61c02e52013-10-30 10:44:52 -040067 the vhdx file creator. Diagnostic
Jeff Cody203cdba2013-04-29 14:48:17 -040068 only */
69} VHDXFileIdentifier;
70
71
72/* the guid is a 16 byte unique ID - the definition for this used by
73 * Microsoft is not just 16 bytes though - it is a structure that is defined,
74 * so we need to follow it here so that endianness does not trip us up */
75
Jeff Cody4f18b782013-10-30 10:44:39 -040076typedef struct QEMU_PACKED MSGUID {
Jeff Cody203cdba2013-04-29 14:48:17 -040077 uint32_t data1;
78 uint16_t data2;
79 uint16_t data3;
80 uint8_t data4[8];
81} MSGUID;
82
83#define guid_eq(a, b) \
84 (memcmp(&(a), &(b), sizeof(MSGUID)) == 0)
85
Stefano Garzarella0cb98af2019-03-27 10:56:34 +010086#define VHDX_HEADER_SIZE (4 * KiB) /* although the vhdx_header struct in disk
Jeff Cody625565d2013-10-30 10:44:41 -040087 is only 582 bytes, for purposes of crc
88 the header is the first 4KB of the 64KB
89 block */
Jeff Cody203cdba2013-04-29 14:48:17 -040090
91/* The full header is 4KB, although the actual header data is much smaller.
92 * But for the checksum calculation, it is over the entire 4KB structure,
93 * not just the defined portion of it */
Jeff Cody3412f7b2013-10-30 10:44:53 -040094#define VHDX_HEADER_SIGNATURE 0x64616568
Jeff Cody203cdba2013-04-29 14:48:17 -040095typedef struct QEMU_PACKED VHDXHeader {
96 uint32_t signature; /* "head" in ASCII */
97 uint32_t checksum; /* CRC-32C hash of the whole header */
98 uint64_t sequence_number; /* Seq number of this header. Each
99 VHDX file has 2 of these headers,
100 and only the header with the highest
101 sequence number is valid */
Jeff Cody625565d2013-10-30 10:44:41 -0400102 MSGUID file_write_guid; /* 128 bit unique identifier. Must be
Jeff Cody203cdba2013-04-29 14:48:17 -0400103 updated to new, unique value before
104 the first modification is made to
105 file */
106 MSGUID data_write_guid; /* 128 bit unique identifier. Must be
107 updated to new, unique value before
108 the first modification is made to
109 visible data. Visbile data is
110 defined as:
111 - system & user metadata
112 - raw block data
113 - disk size
114 - any change that will
115 cause the virtual disk
116 sector read to differ
117
118 This does not need to change if
119 blocks are re-arranged */
120 MSGUID log_guid; /* 128 bit unique identifier. If zero,
121 there is no valid log. If non-zero,
122 log entries with this guid are
123 valid. */
Jeff Cody61c02e52013-10-30 10:44:52 -0400124 uint16_t log_version; /* version of the log format. Must be
125 set to zero */
Jeff Cody6e9d2902013-10-30 10:44:38 -0400126 uint16_t version; /* version of the vhdx file. Currently,
Jeff Cody203cdba2013-04-29 14:48:17 -0400127 only supported version is "1" */
128 uint32_t log_length; /* length of the log. Must be multiple
129 of 1MB */
130 uint64_t log_offset; /* byte offset in the file of the log.
131 Must also be a multiple of 1MB */
132} VHDXHeader;
133
134/* Header for the region table block */
Jeff Cody3412f7b2013-10-30 10:44:53 -0400135#define VHDX_REGION_SIGNATURE 0x69676572 /* "regi" in ASCII */
Jeff Cody203cdba2013-04-29 14:48:17 -0400136typedef struct QEMU_PACKED VHDXRegionTableHeader {
137 uint32_t signature; /* "regi" in ASCII */
138 uint32_t checksum; /* CRC-32C hash of the 64KB table */
139 uint32_t entry_count; /* number of valid entries */
140 uint32_t reserved;
141} VHDXRegionTableHeader;
142
143/* Individual region table entry. There may be a maximum of 2047 of these
144 *
145 * There are two known region table properties. Both are required.
146 * BAT (block allocation table): 2DC27766F62342009D64115E9BFD4A08
147 * Metadata: 8B7CA20647904B9AB8FE575F050F886E
148 */
149#define VHDX_REGION_ENTRY_REQUIRED 0x01 /* if set, parser must understand
150 this entry in order to open
151 file */
152typedef struct QEMU_PACKED VHDXRegionTableEntry {
153 MSGUID guid; /* 128-bit unique identifier */
154 uint64_t file_offset; /* offset of the object in the file.
155 Must be multiple of 1MB */
156 uint32_t length; /* length, in bytes, of the object */
157 uint32_t data_bits;
158} VHDXRegionTableEntry;
159
160
161/* ---- LOG ENTRY STRUCTURES ---- */
Stefano Garzarella0cb98af2019-03-27 10:56:34 +0100162#define VHDX_LOG_MIN_SIZE (1 * MiB)
163#define VHDX_LOG_SECTOR_SIZE (4 * KiB)
Jeff Cody203cdba2013-04-29 14:48:17 -0400164#define VHDX_LOG_HDR_SIZE 64
Jeff Cody625565d2013-10-30 10:44:41 -0400165#define VHDX_LOG_SIGNATURE 0x65676f6c
Jeff Cody203cdba2013-04-29 14:48:17 -0400166typedef struct QEMU_PACKED VHDXLogEntryHeader {
167 uint32_t signature; /* "loge" in ASCII */
168 uint32_t checksum; /* CRC-32C hash of the 64KB table */
169 uint32_t entry_length; /* length in bytes, multiple of 1MB */
170 uint32_t tail; /* byte offset of first log entry of a
171 seq, where this entry is the last
172 entry */
173 uint64_t sequence_number; /* incremented with each log entry.
174 May not be zero. */
175 uint32_t descriptor_count; /* number of descriptors in this log
176 entry, must be >= 0 */
177 uint32_t reserved;
178 MSGUID log_guid; /* value of the log_guid from
179 vhdx_header. If not found in
180 vhdx_header, it is invalid */
181 uint64_t flushed_file_offset; /* see spec for full details - this
Stefan Weil52f35022013-07-24 19:48:56 +0200182 should be vhdx file size in bytes */
Jeff Cody203cdba2013-04-29 14:48:17 -0400183 uint64_t last_file_offset; /* size in bytes that all allocated
184 file structures fit into */
185} VHDXLogEntryHeader;
186
187#define VHDX_LOG_DESC_SIZE 32
Jeff Cody625565d2013-10-30 10:44:41 -0400188#define VHDX_LOG_DESC_SIGNATURE 0x63736564
189#define VHDX_LOG_ZERO_SIGNATURE 0x6f72657a
Jeff Cody203cdba2013-04-29 14:48:17 -0400190typedef struct QEMU_PACKED VHDXLogDescriptor {
191 uint32_t signature; /* "zero" or "desc" in ASCII */
192 union {
193 uint32_t reserved; /* zero desc */
194 uint32_t trailing_bytes; /* data desc: bytes 4092-4096 of the
195 data sector */
196 };
197 union {
198 uint64_t zero_length; /* zero desc: length of the section to
199 zero */
200 uint64_t leading_bytes; /* data desc: bytes 0-7 of the data
201 sector */
202 };
203 uint64_t file_offset; /* file offset to write zeros - multiple
204 of 4kB */
205 uint64_t sequence_number; /* must match same field in
206 vhdx_log_entry_header */
207} VHDXLogDescriptor;
208
Jeff Cody625565d2013-10-30 10:44:41 -0400209#define VHDX_LOG_DATA_SIGNATURE 0x61746164
Jeff Cody203cdba2013-04-29 14:48:17 -0400210typedef struct QEMU_PACKED VHDXLogDataSector {
211 uint32_t data_signature; /* "data" in ASCII */
212 uint32_t sequence_high; /* 4 MSB of 8 byte sequence_number */
213 uint8_t data[4084]; /* raw data, bytes 8-4091 (inclusive).
214 see the data descriptor field for the
215 other mising bytes */
216 uint32_t sequence_low; /* 4 LSB of 8 byte sequence_number */
217} VHDXLogDataSector;
218
219
220
221/* block states - different state values depending on whether it is a
222 * payload block, or a sector block. */
223
224#define PAYLOAD_BLOCK_NOT_PRESENT 0
225#define PAYLOAD_BLOCK_UNDEFINED 1
226#define PAYLOAD_BLOCK_ZERO 2
Jeff Codya9d1e9d2014-12-08 01:07:43 -0500227#define PAYLOAD_BLOCK_UNMAPPED 3
228#define PAYLOAD_BLOCK_UNMAPPED_v095 5
Jeff Codyd92aa882013-10-30 10:44:48 -0400229#define PAYLOAD_BLOCK_FULLY_PRESENT 6
Jeff Cody203cdba2013-04-29 14:48:17 -0400230#define PAYLOAD_BLOCK_PARTIALLY_PRESENT 7
231
232#define SB_BLOCK_NOT_PRESENT 0
233#define SB_BLOCK_PRESENT 6
234
235/* per the spec */
Jeff Cody625565d2013-10-30 10:44:41 -0400236#define VHDX_MAX_SECTORS_PER_BLOCK (1 << 23)
Jeff Cody203cdba2013-04-29 14:48:17 -0400237
238/* upper 44 bits are the file offset in 1MB units lower 3 bits are the state
239 other bits are reserved */
240#define VHDX_BAT_STATE_BIT_MASK 0x07
Jeff Cody62e466e2014-03-14 06:50:37 -0400241#define VHDX_BAT_FILE_OFF_MASK 0xFFFFFFFFFFF00000ULL /* upper 44 bits */
Jeff Cody203cdba2013-04-29 14:48:17 -0400242typedef uint64_t VHDXBatEntry;
243
244/* ---- METADATA REGION STRUCTURES ---- */
245
246#define VHDX_METADATA_ENTRY_SIZE 32
247#define VHDX_METADATA_MAX_ENTRIES 2047 /* not including the header */
248#define VHDX_METADATA_TABLE_MAX_SIZE \
249 (VHDX_METADATA_ENTRY_SIZE * (VHDX_METADATA_MAX_ENTRIES+1))
Jeff Cody62e466e2014-03-14 06:50:37 -0400250#define VHDX_METADATA_SIGNATURE 0x617461646174656DULL /* "metadata" in ASCII */
Jeff Cody203cdba2013-04-29 14:48:17 -0400251typedef struct QEMU_PACKED VHDXMetadataTableHeader {
252 uint64_t signature; /* "metadata" in ASCII */
253 uint16_t reserved;
254 uint16_t entry_count; /* number table entries. <= 2047 */
255 uint32_t reserved2[5];
256} VHDXMetadataTableHeader;
257
258#define VHDX_META_FLAGS_IS_USER 0x01 /* max 1024 entries */
259#define VHDX_META_FLAGS_IS_VIRTUAL_DISK 0x02 /* virtual disk metadata if set,
260 otherwise file metdata */
261#define VHDX_META_FLAGS_IS_REQUIRED 0x04 /* parse must understand this
262 entry to open the file */
263typedef struct QEMU_PACKED VHDXMetadataTableEntry {
264 MSGUID item_id; /* 128-bit identifier for metadata */
265 uint32_t offset; /* byte offset of the metadata. At
266 least 64kB. Relative to start of
267 metadata region */
268 /* note: if length = 0, so is offset */
269 uint32_t length; /* length of metadata. <= 1MB. */
Jeff Cody625565d2013-10-30 10:44:41 -0400270 uint32_t data_bits; /* least-significant 3 bits are flags,
271 the rest are reserved (see above) */
Jeff Cody203cdba2013-04-29 14:48:17 -0400272 uint32_t reserved2;
273} VHDXMetadataTableEntry;
274
275#define VHDX_PARAMS_LEAVE_BLOCKS_ALLOCED 0x01 /* Do not change any blocks to
276 be BLOCK_NOT_PRESENT.
277 If set indicates a fixed
278 size VHDX file */
279#define VHDX_PARAMS_HAS_PARENT 0x02 /* has parent / backing file */
Jeff Cody3412f7b2013-10-30 10:44:53 -0400280#define VHDX_BLOCK_SIZE_MIN (1 * MiB)
281#define VHDX_BLOCK_SIZE_MAX (256 * MiB)
Jeff Cody203cdba2013-04-29 14:48:17 -0400282typedef struct QEMU_PACKED VHDXFileParameters {
283 uint32_t block_size; /* size of each payload block, always
284 power of 2, <= 256MB and >= 1MB. */
Jeff Cody625565d2013-10-30 10:44:41 -0400285 uint32_t data_bits; /* least-significant 2 bits are flags,
286 the rest are reserved (see above) */
Jeff Cody203cdba2013-04-29 14:48:17 -0400287} VHDXFileParameters;
288
Jeff Cody3412f7b2013-10-30 10:44:53 -0400289#define VHDX_MAX_IMAGE_SIZE ((uint64_t) 64 * TiB)
Jeff Cody203cdba2013-04-29 14:48:17 -0400290typedef struct QEMU_PACKED VHDXVirtualDiskSize {
291 uint64_t virtual_disk_size; /* Size of the virtual disk, in bytes.
292 Must be multiple of the sector size,
293 max of 64TB */
294} VHDXVirtualDiskSize;
295
296typedef struct QEMU_PACKED VHDXPage83Data {
Jeff Cody61c02e52013-10-30 10:44:52 -0400297 MSGUID page_83_data; /* unique id for scsi devices that
Jeff Cody203cdba2013-04-29 14:48:17 -0400298 support page 0x83 */
299} VHDXPage83Data;
300
301typedef struct QEMU_PACKED VHDXVirtualDiskLogicalSectorSize {
302 uint32_t logical_sector_size; /* virtual disk sector size (in bytes).
303 Can only be 512 or 4096 bytes */
304} VHDXVirtualDiskLogicalSectorSize;
305
306typedef struct QEMU_PACKED VHDXVirtualDiskPhysicalSectorSize {
307 uint32_t physical_sector_size; /* physical sector size (in bytes).
308 Can only be 512 or 4096 bytes */
309} VHDXVirtualDiskPhysicalSectorSize;
310
311typedef struct QEMU_PACKED VHDXParentLocatorHeader {
Jeff Cody61c02e52013-10-30 10:44:52 -0400312 MSGUID locator_type; /* type of the parent virtual disk. */
Jeff Cody203cdba2013-04-29 14:48:17 -0400313 uint16_t reserved;
314 uint16_t key_value_count; /* number of key/value pairs for this
315 locator */
316} VHDXParentLocatorHeader;
317
318/* key and value strings are UNICODE strings, UTF-16 LE encoding, no NULs */
319typedef struct QEMU_PACKED VHDXParentLocatorEntry {
320 uint32_t key_offset; /* offset in metadata for key, > 0 */
321 uint32_t value_offset; /* offset in metadata for value, >0 */
322 uint16_t key_length; /* length of entry key, > 0 */
323 uint16_t value_length; /* length of entry value, > 0 */
324} VHDXParentLocatorEntry;
325
326
327/* ----- END VHDX SPECIFICATION STRUCTURES ---- */
328
Jeff Cody28541d42013-10-30 10:44:40 -0400329typedef struct VHDXMetadataEntries {
330 VHDXMetadataTableEntry file_parameters_entry;
331 VHDXMetadataTableEntry virtual_disk_size_entry;
332 VHDXMetadataTableEntry page83_data_entry;
333 VHDXMetadataTableEntry logical_sector_size_entry;
334 VHDXMetadataTableEntry phys_sector_size_entry;
335 VHDXMetadataTableEntry parent_locator_entry;
336 uint16_t present;
337} VHDXMetadataEntries;
338
Jeff Cody625565d2013-10-30 10:44:41 -0400339typedef struct VHDXLogEntries {
340 uint64_t offset;
341 uint64_t length;
Jeff Cody0a43a1b2013-10-30 10:44:45 -0400342 uint32_t write;
343 uint32_t read;
344 VHDXLogEntryHeader *hdr;
345 void *desc_buffer;
346 uint64_t sequence;
Jeff Cody625565d2013-10-30 10:44:41 -0400347 uint32_t tail;
348} VHDXLogEntries;
349
Jeff Cody1a848fd2013-10-30 10:44:46 -0400350typedef struct VHDXRegionEntry {
351 uint64_t start;
352 uint64_t end;
353 QLIST_ENTRY(VHDXRegionEntry) entries;
354} VHDXRegionEntry;
355
Jeff Cody28541d42013-10-30 10:44:40 -0400356typedef struct BDRVVHDXState {
357 CoMutex lock;
358
359 int curr_header;
360 VHDXHeader *headers[2];
361
362 VHDXRegionTableHeader rt;
363 VHDXRegionTableEntry bat_rt; /* region table for the BAT */
364 VHDXRegionTableEntry metadata_rt; /* region table for the metadata */
365
366 VHDXMetadataTableHeader metadata_hdr;
367 VHDXMetadataEntries metadata_entries;
368
369 VHDXFileParameters params;
370 uint32_t block_size;
371 uint32_t block_size_bits;
372 uint32_t sectors_per_block;
373 uint32_t sectors_per_block_bits;
374
375 uint64_t virtual_disk_size;
376 uint32_t logical_sector_size;
377 uint32_t physical_sector_size;
378
379 uint64_t chunk_ratio;
380 uint32_t chunk_ratio_bits;
381 uint32_t logical_sector_size_bits;
382
383 uint32_t bat_entries;
384 VHDXBatEntry *bat;
385 uint64_t bat_offset;
386
Jeff Codyc3906c52013-10-30 10:44:43 -0400387 bool first_visible_write;
Jeff Cody28541d42013-10-30 10:44:40 -0400388 MSGUID session_guid;
389
Jeff Cody625565d2013-10-30 10:44:41 -0400390 VHDXLogEntries log;
391
Jeff Cody28541d42013-10-30 10:44:40 -0400392 VHDXParentLocatorHeader parent_header;
393 VHDXParentLocatorEntry *parent_entries;
394
395 Error *migration_blocker;
Jeff Cody1a848fd2013-10-30 10:44:46 -0400396
Jeff Cody7e30e6a2013-12-17 05:33:37 -0500397 bool log_replayed_on_open;
398
Paolo Bonzinib58deb32018-12-06 11:58:10 +0100399 QLIST_HEAD(, VHDXRegionEntry) regions;
Jeff Cody28541d42013-10-30 10:44:40 -0400400} BDRVVHDXState;
Jeff Codye8d4e5f2013-04-29 14:48:18 -0400401
Jeff Cody4f18b782013-10-30 10:44:39 -0400402void vhdx_guid_generate(MSGUID *guid);
403
Jeff Codyc3906c52013-10-30 10:44:43 -0400404int vhdx_update_headers(BlockDriverState *bs, BDRVVHDXState *s, bool rw,
405 MSGUID *log_guid);
406
Jeff Cody4f18b782013-10-30 10:44:39 -0400407uint32_t vhdx_update_checksum(uint8_t *buf, size_t size, int crc_offset);
Jeff Codye8d4e5f2013-04-29 14:48:18 -0400408uint32_t vhdx_checksum_calc(uint32_t crc, uint8_t *buf, size_t size,
409 int crc_offset);
410
411bool vhdx_checksum_is_valid(uint8_t *buf, size_t size, int crc_offset);
412
Jeff Cody7e30e6a2013-12-17 05:33:37 -0500413int vhdx_parse_log(BlockDriverState *bs, BDRVVHDXState *s, bool *flushed,
414 Error **errp);
Jeff Codye8d4e5f2013-04-29 14:48:18 -0400415
Jeff Cody8adc5232013-10-30 10:44:47 -0400416int vhdx_log_write_and_flush(BlockDriverState *bs, BDRVVHDXState *s,
417 void *data, uint32_t length, uint64_t offset);
418
Jeff Cody4f18b782013-10-30 10:44:39 -0400419static inline void leguid_to_cpus(MSGUID *guid)
Jeff Codye8d4e5f2013-04-29 14:48:18 -0400420{
Peter Maydell1229e462018-10-16 18:09:38 +0100421 guid->data1 = le32_to_cpu(guid->data1);
422 guid->data2 = le16_to_cpu(guid->data2);
423 guid->data3 = le16_to_cpu(guid->data3);
Jeff Codye8d4e5f2013-04-29 14:48:18 -0400424}
425
Jeff Cody4f18b782013-10-30 10:44:39 -0400426static inline void cpu_to_leguids(MSGUID *guid)
427{
Peter Maydell1229e462018-10-16 18:09:38 +0100428 guid->data1 = cpu_to_le32(guid->data1);
429 guid->data2 = cpu_to_le16(guid->data2);
430 guid->data3 = cpu_to_le16(guid->data3);
Jeff Cody4f18b782013-10-30 10:44:39 -0400431}
432
Jeff Cody0f48e8f2013-10-30 10:44:42 -0400433void vhdx_header_le_import(VHDXHeader *h);
434void vhdx_header_le_export(VHDXHeader *orig_h, VHDXHeader *new_h);
435void vhdx_log_desc_le_import(VHDXLogDescriptor *d);
436void vhdx_log_desc_le_export(VHDXLogDescriptor *d);
Jeff Cody4f75b522014-08-06 15:54:58 -0400437void vhdx_log_data_le_import(VHDXLogDataSector *d);
Jeff Cody0f48e8f2013-10-30 10:44:42 -0400438void vhdx_log_data_le_export(VHDXLogDataSector *d);
439void vhdx_log_entry_hdr_le_import(VHDXLogEntryHeader *hdr);
440void vhdx_log_entry_hdr_le_export(VHDXLogEntryHeader *hdr);
Jeff Codyc325ee12013-10-30 10:44:50 -0400441void vhdx_region_header_le_import(VHDXRegionTableHeader *hdr);
442void vhdx_region_header_le_export(VHDXRegionTableHeader *hdr);
443void vhdx_region_entry_le_import(VHDXRegionTableEntry *e);
444void vhdx_region_entry_le_export(VHDXRegionTableEntry *e);
445void vhdx_metadata_header_le_import(VHDXMetadataTableHeader *hdr);
446void vhdx_metadata_header_le_export(VHDXMetadataTableHeader *hdr);
447void vhdx_metadata_entry_le_import(VHDXMetadataTableEntry *e);
448void vhdx_metadata_entry_le_export(VHDXMetadataTableEntry *e);
Jeff Codyc3906c52013-10-30 10:44:43 -0400449int vhdx_user_visible_write(BlockDriverState *bs, BDRVVHDXState *s);
450
Jeff Cody203cdba2013-04-29 14:48:17 -0400451#endif