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>
This commit is contained in:
parent
079d3266c7
commit
efdc0c103d
@ -86,15 +86,23 @@ typedef union NBDReply {
|
|||||||
} QEMU_PACKED;
|
} QEMU_PACKED;
|
||||||
} NBDReply;
|
} NBDReply;
|
||||||
|
|
||||||
/* Header of NBD_REPLY_TYPE_OFFSET_DATA, complete NBD_REPLY_TYPE_OFFSET_HOLE */
|
/* Header of chunk for NBD_REPLY_TYPE_OFFSET_DATA */
|
||||||
typedef struct NBDStructuredRead {
|
typedef struct NBDStructuredReadData {
|
||||||
NBDStructuredReplyChunk h;
|
NBDStructuredReplyChunk h; /* h.length >= 9 */
|
||||||
uint64_t offset;
|
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 */
|
/* Header of all NBD_REPLY_TYPE_ERROR* errors */
|
||||||
typedef struct NBDStructuredError {
|
typedef struct NBDStructuredError {
|
||||||
NBDStructuredReplyChunk h;
|
NBDStructuredReplyChunk h; /* h.length >= 6 */
|
||||||
uint32_t error;
|
uint32_t error;
|
||||||
uint16_t message_length;
|
uint16_t message_length;
|
||||||
} QEMU_PACKED NBDStructuredError;
|
} QEMU_PACKED NBDStructuredError;
|
||||||
|
@ -1280,7 +1280,7 @@ static int coroutine_fn nbd_co_send_structured_read(NBDClient *client,
|
|||||||
size_t size,
|
size_t size,
|
||||||
Error **errp)
|
Error **errp)
|
||||||
{
|
{
|
||||||
NBDStructuredRead chunk;
|
NBDStructuredReadData chunk;
|
||||||
struct iovec iov[] = {
|
struct iovec iov[] = {
|
||||||
{.iov_base = &chunk, .iov_len = sizeof(chunk)},
|
{.iov_base = &chunk, .iov_len = sizeof(chunk)},
|
||||||
{.iov_base = data, .iov_len = size}
|
{.iov_base = data, .iov_len = size}
|
||||||
|
Loading…
Reference in New Issue
Block a user