On 2/24/23 23:59, Eric Blake wrote:
@@ -752,14 +742,15 @@ protocol_recv_request_send_reply (void)
(cmd == NBD_CMD_READ || cmd == NBD_CMD_BLOCK_STATUS)) {
if (!error) {
if (cmd == NBD_CMD_READ)
- send_structured_reply_read (request.handle, cmd, buf, count, offset);
+ return send_structured_reply_read (request.handle, cmd, buf, count,
+ offset);
else /* NBD_CMD_BLOCK_STATUS */
- send_structured_reply_block_status (request.handle, cmd, flags,
- count, offset, extents);
+ return send_structured_reply_block_status (request.handle, cmd, flags,
+ count, offset, extents);
}
else
- send_structured_reply_error (request.handle, cmd, flags, error);
+ return send_structured_reply_error (request.handle, cmd, flags, error);
}
else
- send_simple_reply (request.handle, cmd, flags, buf, count, error);
+ return send_simple_reply (request.handle, cmd, flags, buf, count, error);
}
I think this would look better:
if (!conn->structured_replies ||
(cmd != NBD_CMD_READ && cmd != NBD_CMD_BLOCK_STATUS))
return send_simple_reply (request.handle, cmd, flags, buf, count, error);
if (error) {
return send_structured_reply_error (request.handle, cmd, flags, error);
if (cmd == NBD_CMD_READ)
return send_structured_reply_read (request.handle, cmd, buf, count, offset);
/* NBD_CMD_BLOCK_STATUS */
return send_structured_reply_block_status (request.handle, cmd, flags,
count, offset, extents);
Either way:
Reviewed-by: Laszlo Ersek <lersek(a)redhat.com>