diff options
author | Eric Blake <eblake@redhat.com> | 2017-11-08 15:57:00 -0600 |
---|---|---|
committer | Eric Blake <eblake@redhat.com> | 2017-11-09 10:17:12 -0600 |
commit | efdc0c103d7919e5cabfc0b12a5699c1f8e482db (patch) | |
tree | 130da66f3b904081527fa365703e1e42732f2f37 /include/block | |
parent | 079d3266c79a41b2b00780f74d1c5e0b1756be95 (diff) | |
download | qemu-efdc0c103d7919e5cabfc0b12a5699c1f8e482db.zip qemu-efdc0c103d7919e5cabfc0b12a5699c1f8e482db.tar.gz qemu-efdc0c103d7919e5cabfc0b12a5699c1f8e482db.tar.bz2 |
nbd: Fix struct name for structured reads
A closer read of the NBD spec shows that a structured reply chunk
for a hole is not quite identical to the prefix of a data chunk,
because the hole has to also send a 32-bit size field. Although
we do not yet send holes, we should fix the misleading information
in our header and make it easier for a future patch to support
sparse reads. Messed up in commit bae245d1.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20171108215703.9295-5-eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Diffstat (limited to 'include/block')
-rw-r--r-- | include/block/nbd.h | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/include/block/nbd.h b/include/block/nbd.h index 92d1723..113c707 100644 --- a/include/block/nbd.h +++ b/include/block/nbd.h @@ -86,15 +86,23 @@ typedef union NBDReply { } QEMU_PACKED; } NBDReply; -/* Header of NBD_REPLY_TYPE_OFFSET_DATA, complete NBD_REPLY_TYPE_OFFSET_HOLE */ -typedef struct NBDStructuredRead { - NBDStructuredReplyChunk h; +/* Header of chunk for NBD_REPLY_TYPE_OFFSET_DATA */ +typedef struct NBDStructuredReadData { + NBDStructuredReplyChunk h; /* h.length >= 9 */ uint64_t offset; -} QEMU_PACKED NBDStructuredRead; + /* At least one byte of data payload follows, calculated from h.length */ +} QEMU_PACKED NBDStructuredReadData; + +/* Complete chunk for NBD_REPLY_TYPE_OFFSET_HOLE */ +typedef struct NBDStructuredReadHole { + NBDStructuredReplyChunk h; /* h.length == 12 */ + uint64_t offset; + uint32_t length; +} QEMU_PACKED NBDStructuredReadHole; /* Header of all NBD_REPLY_TYPE_ERROR* errors */ typedef struct NBDStructuredError { - NBDStructuredReplyChunk h; + NBDStructuredReplyChunk h; /* h.length >= 6 */ uint32_t error; uint16_t message_length; } QEMU_PACKED NBDStructuredError; |