Skip to contentSkip to conversation

tools/libxl: Restore errnoval behavior for datacopier callback

PATCH In review Ross Lagerwall 2 participants 2 messages Mar 20, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/libxl: Restore errnoval behavior for datacopier callback

6d896e1357ff ("tools/libxl: Extend datacopier to support reading into a buffer") changed the semantics of the errnoval parameter for the datacopier callback without updating all callers. Restore the original behavior for now.

---
 tools/libxl/libxl_aoutils.c  | 2 +-
 tools/libxl/libxl_internal.h | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)
tools/libxl/libxl_aoutils.c +1 -1
index 0d4c8af..3b77286 100644
@@ -148,7 +148,7 @@ static void datacopier_check_state(libxl__egc *egc, libxl__datacopier_state *dc)
     } else if (!libxl__ev_fd_isregistered(&dc->toread) ||
                dc->bytes_to_read == 0) {
         /* we have had eof */
-        datacopier_callback(egc, dc, 0, dc->readbuf ? dc->used : 0);
+        datacopier_callback(egc, dc, 0, 0);
         return;
     } else {
         /* nothing buffered, but still reading */
tools/libxl/libxl_internal.h +2 -3
index 931c00c..269d2cd 100644
@@ -2524,9 +2524,8 @@ typedef struct libxl__datacopier_buf libxl__datacopier_buf;
 
 /* onwrite==1 means failure happened when writing, logged, errnoval is valid
  * onwrite==0 means failure happened when reading
- *     errnoval>=0 means we got eof and all data was written or number of bytes
- *                 written when in read mode
- *     errnoval<0 means we had a read error, logged
+ *     errnoval==0 means we got eof and all data was written
+ *     errnoval!=0 means we had a read error, logged
  * onwrite==-1 means some other internal failure, errnoval not valid, logged
  * If we get POLLHUP, we call callback_pollhup(..., onwrite, -1);
  * or if callback_pollhup==0 this is an internal failure, as above.
Signature · 1 line
2.1.0
#1 lore raw
Quoted 5 lines · Ross Lagerwall

6d896e1357ff ("tools/libxl: Extend datacopier to support reading into a buffer") changed the semantics of the errnoval parameter for the datacopier callback without updating all callers. Restore the original behavior for now.

Acked + applied, thanks for the speedy turnaround.