diff --git a/0018-cleanup-rename-pdu-written.patch b/0018-cleanup-rename-pdu-written.patch new file mode 100644 index 0000000..96ada81 --- /dev/null +++ b/0018-cleanup-rename-pdu-written.patch @@ -0,0 +1,89 @@ +From 6cb88eb0ce8faa4b417c3abd1a9b09d4f707037c Mon Sep 17 00:00:00 2001 +From: Ronnie Sahlberg +Date: Sun, 4 Aug 2013 17:27:29 -0700 +Subject: [PATCH] Cleanup: rename pdu->written -> pdu->outdata_written + +--- + include/iscsi-private.h | 4 ++-- + lib/connect.c | 2 +- + lib/socket.c | 16 ++++++---------- + 3 files changed, 9 insertions(+), 13 deletions(-) + +diff --git a/include/iscsi-private.h b/include/iscsi-private.h +index df20702..d386988 100644 +--- a/include/iscsi-private.h ++++ b/include/iscsi-private.h +@@ -221,9 +221,9 @@ struct iscsi_pdu { + iscsi_command_cb callback; + void *private_data; + +- int written; +- + struct iscsi_data outdata; /* Header for PDU to send */ ++ size_t outdata_written; /* How much of the header we have written */ ++ + uint32_t out_offset; /* Offset into data-out iovector */ + uint32_t out_len; /* Amount of data to sent starting at out_offset */ + uint32_t out_written; /* Number of bytes written to socket */ +diff --git a/lib/connect.c b/lib/connect.c +index 7790253..732e0cf 100644 +--- a/lib/connect.c ++++ b/lib/connect.c +@@ -343,7 +343,7 @@ try_again: + iscsi_pdu_set_expstatsn(pdu, iscsi->statsn); + iscsi->statsn++; + +- pdu->written = 0; ++ pdu->outdata_written = 0; + pdu->out_written = 0; + iscsi_add_to_outqueue(iscsi, pdu); + } +diff --git a/lib/socket.c b/lib/socket.c +index 375cfd2..f94bb1c 100644 +--- a/lib/socket.c ++++ b/lib/socket.c +@@ -596,8 +596,6 @@ iscsi_write_to_socket(struct iscsi_context *iscsi) + } + + while (iscsi->outqueue != NULL || iscsi->outqueue_current != NULL) { +- ssize_t total; +- + if (iscsi->outqueue_current == NULL) { + if (iscsi_serial32_compare(iscsi->outqueue->cmdsn, iscsi->maxcmdsn) > 0) { + /* stop sending. maxcmdsn is reached */ +@@ -616,15 +614,13 @@ iscsi_write_to_socket(struct iscsi_context *iscsi) + } + + pdu = iscsi->outqueue_current; +- +- total = pdu->outdata.size; +- total = (total + 3) & 0xfffffffc; ++ pdu->outdata.size = (pdu->outdata.size + 3) & 0xfffffffc; + + /* Write header and any immediate data */ +- if (pdu->written < total) { ++ if (pdu->outdata_written < pdu->outdata.size) { + count = send(iscsi->fd, +- pdu->outdata.data + pdu->written, +- total - pdu->written, ++ pdu->outdata.data + pdu->outdata_written, ++ pdu->outdata.size - pdu->outdata_written, + 0); + if (count == -1) { + if (errno == EAGAIN || errno == EWOULDBLOCK) { +@@ -634,10 +630,10 @@ iscsi_write_to_socket(struct iscsi_context *iscsi) + "socket :%d", errno); + return -1; + } +- pdu->written += count; ++ pdu->outdata_written += count; + } + /* if we havent written the full header yet. */ +- if (pdu->written != total) { ++ if (pdu->outdata_written != pdu->outdata.size) { + return 0; + } + +-- +1.8.3.1 + diff --git a/0018-fix-iovec-short-reads.patch b/0019-fix-iovec-short-reads.patch similarity index 98% rename from 0018-fix-iovec-short-reads.patch rename to 0019-fix-iovec-short-reads.patch index 76d3204..91526f7 100644 --- a/0018-fix-iovec-short-reads.patch +++ b/0019-fix-iovec-short-reads.patch @@ -114,11 +114,12 @@ index 13020ee..7a668c2 100644 count = recv(iscsi->fd, buf, count, 0); } -@@ -586,6 +591,7 @@ iscsi_write_to_socket(struct iscsi_context *iscsi) +@@ -586,6 +591,8 @@ iscsi_write_to_socket(struct iscsi_context *iscsi) { ssize_t count; struct iscsi_pdu *pdu; + static char padding_buf[3]; ++ size_t total; if (iscsi->fd == -1) { iscsi_set_error(iscsi, "trying to write but not connected"); diff --git a/libiscsi.spec b/libiscsi.spec index d6aef5c..7e9d4ec 100644 --- a/libiscsi.spec +++ b/libiscsi.spec @@ -1,7 +1,7 @@ Name: libiscsi Summary: iSCSI client library Version: 1.9.0 -Release: 3%{?dist} +Release: 4%{?dist} License: LGPLv2+ Group: System Environment/Libraries URL: https://github.com/sahlberg/%{name} @@ -25,7 +25,8 @@ Patch14: 0014-fix-another-aliasing-problem.patch Patch15: 0015-fix-arm-aliasing-problem.patch Patch16: 0016-avoid-casting-struct-sockaddr.patch Patch17: 0017-use-scsi_get-set_uint16-32-64-in-tests.patch -Patch18: 0018-fix-iovec-short-reads.patch +Patch18: 0018-cleanup-rename-pdu-written.patch +Patch19: 0019-fix-iovec-short-reads.patch BuildRequires: autoconf BuildRequires: automake @@ -67,6 +68,7 @@ a network. %patch16 -p1 %patch17 -p1 %patch18 -p1 +%patch19 -p1 %build sh autogen.sh @@ -127,6 +129,9 @@ The libiscsi-devel package includes the header files for libiscsi. %{_libdir}/pkgconfig/libiscsi.pc %changelog +* Mon Aug 26 2013 Paolo Bonzini - 1.9.0-4 +- Cleaned up patches 18/19 to match upstream more closely + * Mon Aug 26 2013 Paolo Bonzini - 1.9.0-3 - Improved patch 18 to cover write side too