On Sun, Feb 26, 2023 at 10:16:08AM +0100, Laszlo Ersek wrote:
> 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);

Indeed it does.

> 
> Either way:
> 
> Reviewed-by: Laszlo Ersek <ler...@redhat.com>

Thanks.  With that tweak, this is now in as commit 9d82aa4f

-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org
_______________________________________________
Libguestfs mailing list
Libguestfs@redhat.com
https://listman.redhat.com/mailman/listinfo/libguestfs

Reply via email to