Merge pull request #128 from plieven/revert_iovector

socket: rename max_read parameter to count in iscsi_iovector_readv_write...
This commit is contained in:
Ronnie Sahlberg
2014-07-14 06:24:05 -07:00

View File

@@ -411,7 +411,7 @@ iscsi_queue_length(struct iscsi_context *iscsi)
} }
ssize_t ssize_t
iscsi_iovector_readv_writev(struct iscsi_context *iscsi, struct scsi_iovector *iovector, uint32_t pos, ssize_t max_read, int do_write) iscsi_iovector_readv_writev(struct iscsi_context *iscsi, struct scsi_iovector *iovector, uint32_t pos, ssize_t count, int do_write)
{ {
if (iovector->iov == NULL) { if (iovector->iov == NULL) {
errno = EINVAL; errno = EINVAL;
@@ -452,10 +452,10 @@ iscsi_iovector_readv_writev(struct iscsi_context *iscsi, struct scsi_iovector *i
struct scsi_iovec *iov2 = iov; struct scsi_iovec *iov2 = iov;
int niov=1; /* number of iovectors to pass */ int niov=1; /* number of iovectors to pass */
uint32_t len2 = pos + max_read; /* adjust length of iov2 */ uint32_t len2 = pos + count; /* adjust length of iov2 */
/* forward until iov2 points to the last iovec we pass later. it might /* forward until iov2 points to the last iovec we pass later. it might
happen that we have a lot of iovectors but are limited by max_read */ happen that we have a lot of iovectors but are limited by count */
while (len2 > iov2->iov_len) { while (len2 > iov2->iov_len) {
if (iovector->niov <= iovector->consumed+niov-1) { if (iovector->niov <= iovector->consumed+niov-1) {
errno = EINVAL; errno = EINVAL;
@@ -487,7 +487,7 @@ iscsi_iovector_readv_writev(struct iscsi_context *iscsi, struct scsi_iovector *i
iov->iov_len += pos; iov->iov_len += pos;
iov2->iov_len = _len2; iov2->iov_len = _len2;
if (n > max_read) { if (n > count) {
/* we read/write more bytes than expected, this MUST not happen */ /* we read/write more bytes than expected, this MUST not happen */
errno = EINVAL; errno = EINVAL;
return -1; return -1;