diff mbox

[03/17] nbd/client: refactor nbd_receive_reply

Message ID 5e0d3570-11c3-ac91-6a06-7f6f1e0a093d@redhat.com
State New
Headers show

Commit Message

Eric Blake Aug. 25, 2017, 9:16 p.m. UTC
On 08/04/2017 10:14 AM, Vladimir Sementsov-Ogievskiy wrote:
> Refactor nbd_receive_reply to return 1 on success, 0 on eof, when no
> data was read and <0 for other cases, because returned size of read
> data is not actually used.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
> ---
>  include/block/nbd.h |  2 +-
>  nbd/client.c        | 12 +++++++++---
>  2 files changed, 10 insertions(+), 4 deletions(-)
> 

> +++ b/nbd/client.c
> @@ -914,11 +914,16 @@ ssize_t nbd_send_request(QIOChannel *ioc, NBDRequest *request)
>      return nbd_write(ioc, buf, sizeof(buf), NULL);
>  }
>  
> -ssize_t nbd_receive_reply(QIOChannel *ioc, NBDReply *reply, Error **errp)
> +/* nbd_receive_reply
> + * Returns 1 on success
> + *         0 on eof, when no data was read from @ioc (errp is not set)
> + *         < 0 on fail

Similar to the previous patch, I'd like to squash in:

 {

With that,
Reviewed-by: Eric Blake <eblake@redhat.com>
diff mbox

Patch

diff --git i/nbd/client.c w/nbd/client.c
index a1758a1931..f8c213bc96 100644
--- i/nbd/client.c
+++ w/nbd/client.c
@@ -916,8 +916,8 @@  ssize_t nbd_send_request(QIOChannel *ioc, NBDRequest
*request)

 /* nbd_receive_reply
  * Returns 1 on success
- *         0 on eof, when no data was read from @ioc (errp is not set)
- *         < 0 on fail
+ *         0 on eof, when no data was read (errp is not set)
+ *         negative errno on failure (errp is set)
  */
 int nbd_receive_reply(QIOChannel *ioc, NBDReply *reply, Error **errp)