diff options
author | Jeff Cody <jcody@redhat.com> | 2013-10-30 10:44:39 -0400 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2013-11-07 13:58:58 +0100 |
commit | 4f18b7824ab5eda9fe051f5b24e90e5f34d08a23 (patch) | |
tree | 98191a54c95590cb3aceb99145c115d18210fd1f /block/vhdx.h | |
parent | 6e9d290bf62406098ca3d7bf3796463681ed3c39 (diff) | |
download | qemu-4f18b7824ab5eda9fe051f5b24e90e5f34d08a23.zip |
block: vhdx - add header update capability.
This adds the ability to update the headers in a VHDX image, including
generating a new MS-compatible GUID.
As VHDX depends on uuid.h, VHDX is now a configurable build option. If
VHDX support is enabled, that will also enable uuid as well. The
default is to have VHDX enabled.
To enable/disable VHDX: --enable-vhdx, --disable-vhdx
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.h | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/block/vhdx.h b/block/vhdx.h index 9eb6b9723f..403f766456 100644 --- a/block/vhdx.h +++ b/block/vhdx.h @@ -67,7 +67,7 @@ typedef struct VHDXFileIdentifier { * Microsoft is not just 16 bytes though - it is a structure that is defined, * so we need to follow it here so that endianness does not trip us up */ -typedef struct MSGUID { +typedef struct QEMU_PACKED MSGUID { uint32_t data1; uint16_t data2; uint16_t data3; @@ -309,17 +309,27 @@ typedef struct QEMU_PACKED VHDXParentLocatorEntry { /* ----- END VHDX SPECIFICATION STRUCTURES ---- */ +void vhdx_guid_generate(MSGUID *guid); + +uint32_t vhdx_update_checksum(uint8_t *buf, size_t size, int crc_offset); uint32_t vhdx_checksum_calc(uint32_t crc, uint8_t *buf, size_t size, int crc_offset); bool vhdx_checksum_is_valid(uint8_t *buf, size_t size, int crc_offset); -static void leguid_to_cpus(MSGUID *guid) +static inline void leguid_to_cpus(MSGUID *guid) { le32_to_cpus(&guid->data1); le16_to_cpus(&guid->data2); le16_to_cpus(&guid->data3); } +static inline void cpu_to_leguids(MSGUID *guid) +{ + cpu_to_le32s(&guid->data1); + cpu_to_le16s(&guid->data2); + cpu_to_le16s(&guid->data3); +} + #endif |