slist.h: rename SLIST_ to ISCSI_LIST_ to avoid clash on *BSD
Rename the macros for managing the linked lists from SLIST_* to ISCSI_LIST_* to avoid a clash on *BSD which already have other macros SLIST_* Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
This commit is contained in:
+5
-5
@@ -18,15 +18,15 @@
|
|||||||
#ifndef __iscsi_slist_h__
|
#ifndef __iscsi_slist_h__
|
||||||
#define __iscsi_slist_h__
|
#define __iscsi_slist_h__
|
||||||
|
|
||||||
#define SLIST_ADD(list, item) \
|
#define ISCSI_LIST_ADD(list, item) \
|
||||||
do { \
|
do { \
|
||||||
(item)->next = (*list); \
|
(item)->next = (*list); \
|
||||||
(*list) = (item); \
|
(*list) = (item); \
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
#define SLIST_ADD_END(list, item) \
|
#define ISCSI_LIST_ADD_END(list, item) \
|
||||||
if ((*list) == NULL) { \
|
if ((*list) == NULL) { \
|
||||||
SLIST_ADD((list), (item)); \
|
ISCSI_LIST_ADD((list), (item)); \
|
||||||
} else { \
|
} else { \
|
||||||
void *head = (*list); \
|
void *head = (*list); \
|
||||||
while ((*list)->next) \
|
while ((*list)->next) \
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
(*list) = head; \
|
(*list) = head; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SLIST_REMOVE(list, item) \
|
#define ISCSI_LIST_REMOVE(list, item) \
|
||||||
if ((*list) == (item)) { \
|
if ((*list) == (item)) { \
|
||||||
(*list) = (item)->next; \
|
(*list) = (item)->next; \
|
||||||
} else { \
|
} else { \
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
(*list) = head; \
|
(*list) = head; \
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SLIST_LENGTH(list,length) \
|
#define ISCSI_LIST_LENGTH(list,length) \
|
||||||
do { \
|
do { \
|
||||||
(length) = 0; \
|
(length) = 0; \
|
||||||
void *head = (*list); \
|
void *head = (*list); \
|
||||||
|
|||||||
+5
-5
@@ -204,7 +204,7 @@ void iscsi_defer_reconnect(struct iscsi_context *iscsi)
|
|||||||
ISCSI_LOG(iscsi, 2, "reconnect deferred, cancelling all tasks");
|
ISCSI_LOG(iscsi, 2, "reconnect deferred, cancelling all tasks");
|
||||||
|
|
||||||
while ((pdu = iscsi->outqueue)) {
|
while ((pdu = iscsi->outqueue)) {
|
||||||
SLIST_REMOVE(&iscsi->outqueue, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->outqueue, pdu);
|
||||||
if ( !(pdu->flags & ISCSI_PDU_NO_CALLBACK)) {
|
if ( !(pdu->flags & ISCSI_PDU_NO_CALLBACK)) {
|
||||||
/* If an error happened during connect/login,
|
/* If an error happened during connect/login,
|
||||||
we don't want to call any of the callbacks.
|
we don't want to call any of the callbacks.
|
||||||
@@ -217,7 +217,7 @@ void iscsi_defer_reconnect(struct iscsi_context *iscsi)
|
|||||||
iscsi_free_pdu(iscsi, pdu);
|
iscsi_free_pdu(iscsi, pdu);
|
||||||
}
|
}
|
||||||
while ((pdu = iscsi->waitpdu)) {
|
while ((pdu = iscsi->waitpdu)) {
|
||||||
SLIST_REMOVE(&iscsi->waitpdu, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||||
/* If an error happened during connect/login,
|
/* If an error happened during connect/login,
|
||||||
we don't want to call any of the callbacks.
|
we don't want to call any of the callbacks.
|
||||||
*/
|
*/
|
||||||
@@ -316,14 +316,14 @@ try_again:
|
|||||||
|
|
||||||
while (old_iscsi->outqueue) {
|
while (old_iscsi->outqueue) {
|
||||||
struct iscsi_pdu *pdu = old_iscsi->outqueue;
|
struct iscsi_pdu *pdu = old_iscsi->outqueue;
|
||||||
SLIST_REMOVE(&old_iscsi->outqueue, pdu);
|
ISCSI_LIST_REMOVE(&old_iscsi->outqueue, pdu);
|
||||||
SLIST_ADD_END(&old_iscsi->waitpdu, pdu);
|
ISCSI_LIST_ADD_END(&old_iscsi->waitpdu, pdu);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (old_iscsi->waitpdu) {
|
while (old_iscsi->waitpdu) {
|
||||||
struct iscsi_pdu *pdu = old_iscsi->waitpdu;
|
struct iscsi_pdu *pdu = old_iscsi->waitpdu;
|
||||||
|
|
||||||
SLIST_REMOVE(&old_iscsi->waitpdu, pdu);
|
ISCSI_LIST_REMOVE(&old_iscsi->waitpdu, pdu);
|
||||||
if (pdu->itt == 0xffffffff) {
|
if (pdu->itt == 0xffffffff) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -294,7 +294,7 @@ iscsi_destroy_context(struct iscsi_context *iscsi)
|
|||||||
}
|
}
|
||||||
|
|
||||||
while ((pdu = iscsi->outqueue)) {
|
while ((pdu = iscsi->outqueue)) {
|
||||||
SLIST_REMOVE(&iscsi->outqueue, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->outqueue, pdu);
|
||||||
if ( !(pdu->flags & ISCSI_PDU_NO_CALLBACK)) {
|
if ( !(pdu->flags & ISCSI_PDU_NO_CALLBACK)) {
|
||||||
/* If an error happened during connect/login, we don't want to
|
/* If an error happened during connect/login, we don't want to
|
||||||
call any of the callbacks.
|
call any of the callbacks.
|
||||||
@@ -307,7 +307,7 @@ iscsi_destroy_context(struct iscsi_context *iscsi)
|
|||||||
iscsi_free_pdu(iscsi, pdu);
|
iscsi_free_pdu(iscsi, pdu);
|
||||||
}
|
}
|
||||||
while ((pdu = iscsi->waitpdu)) {
|
while ((pdu = iscsi->waitpdu)) {
|
||||||
SLIST_REMOVE(&iscsi->waitpdu, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||||
/* If an error happened during connect/login, we don't want to
|
/* If an error happened during connect/login, we don't want to
|
||||||
call any of the callbacks.
|
call any of the callbacks.
|
||||||
*/
|
*/
|
||||||
|
|||||||
+9
-9
@@ -87,8 +87,8 @@ iscsi_send_data_out(struct iscsi_context *iscsi, struct iscsi_pdu *cmd_pdu,
|
|||||||
if (pdu == NULL) {
|
if (pdu == NULL) {
|
||||||
iscsi_set_error(iscsi, "Out-of-memory, Failed to allocate "
|
iscsi_set_error(iscsi, "Out-of-memory, Failed to allocate "
|
||||||
"scsi data out pdu.");
|
"scsi data out pdu.");
|
||||||
SLIST_REMOVE(&iscsi->outqueue, cmd_pdu);
|
ISCSI_LIST_REMOVE(&iscsi->outqueue, cmd_pdu);
|
||||||
SLIST_REMOVE(&iscsi->waitpdu, cmd_pdu);
|
ISCSI_LIST_REMOVE(&iscsi->waitpdu, cmd_pdu);
|
||||||
cmd_pdu->callback(iscsi, SCSI_STATUS_ERROR, NULL,
|
cmd_pdu->callback(iscsi, SCSI_STATUS_ERROR, NULL,
|
||||||
cmd_pdu->private_data);
|
cmd_pdu->private_data);
|
||||||
iscsi_free_pdu(iscsi, cmd_pdu);
|
iscsi_free_pdu(iscsi, cmd_pdu);
|
||||||
@@ -137,8 +137,8 @@ iscsi_send_data_out(struct iscsi_context *iscsi, struct iscsi_pdu *cmd_pdu,
|
|||||||
if (iscsi_queue_pdu(iscsi, pdu) != 0) {
|
if (iscsi_queue_pdu(iscsi, pdu) != 0) {
|
||||||
iscsi_set_error(iscsi, "Out-of-memory: failed to queue iscsi "
|
iscsi_set_error(iscsi, "Out-of-memory: failed to queue iscsi "
|
||||||
"scsi pdu.");
|
"scsi pdu.");
|
||||||
SLIST_REMOVE(&iscsi->outqueue, cmd_pdu);
|
ISCSI_LIST_REMOVE(&iscsi->outqueue, cmd_pdu);
|
||||||
SLIST_REMOVE(&iscsi->waitpdu, cmd_pdu);
|
ISCSI_LIST_REMOVE(&iscsi->waitpdu, cmd_pdu);
|
||||||
cmd_pdu->callback(iscsi, SCSI_STATUS_ERROR, NULL,
|
cmd_pdu->callback(iscsi, SCSI_STATUS_ERROR, NULL,
|
||||||
cmd_pdu->private_data);
|
cmd_pdu->private_data);
|
||||||
iscsi_free_pdu(iscsi, cmd_pdu);
|
iscsi_free_pdu(iscsi, cmd_pdu);
|
||||||
@@ -180,7 +180,7 @@ iscsi_timeout_scan(struct iscsi_context *iscsi)
|
|||||||
scsi_cbdata = &pdu->scsi_cbdata;
|
scsi_cbdata = &pdu->scsi_cbdata;
|
||||||
task = scsi_cbdata->task;
|
task = scsi_cbdata->task;
|
||||||
|
|
||||||
SLIST_REMOVE(&iscsi->waitpdu, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||||
pdu->callback(iscsi, SCSI_STATUS_TIMEOUT,
|
pdu->callback(iscsi, SCSI_STATUS_TIMEOUT,
|
||||||
task, pdu->private_data);
|
task, pdu->private_data);
|
||||||
iscsi_set_error(iscsi, "SCSI command timed out");
|
iscsi_set_error(iscsi, "SCSI command timed out");
|
||||||
@@ -1883,7 +1883,7 @@ iscsi_scsi_cancel_task(struct iscsi_context *iscsi,
|
|||||||
|
|
||||||
for (pdu = iscsi->waitpdu; pdu; pdu = pdu->next) {
|
for (pdu = iscsi->waitpdu; pdu; pdu = pdu->next) {
|
||||||
if (pdu->itt == task->itt) {
|
if (pdu->itt == task->itt) {
|
||||||
SLIST_REMOVE(&iscsi->waitpdu, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||||
if ( !(pdu->flags & ISCSI_PDU_NO_CALLBACK)) {
|
if ( !(pdu->flags & ISCSI_PDU_NO_CALLBACK)) {
|
||||||
pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL,
|
pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL,
|
||||||
pdu->private_data);
|
pdu->private_data);
|
||||||
@@ -1894,7 +1894,7 @@ iscsi_scsi_cancel_task(struct iscsi_context *iscsi,
|
|||||||
}
|
}
|
||||||
for (pdu = iscsi->outqueue; pdu; pdu = pdu->next) {
|
for (pdu = iscsi->outqueue; pdu; pdu = pdu->next) {
|
||||||
if (pdu->itt == task->itt) {
|
if (pdu->itt == task->itt) {
|
||||||
SLIST_REMOVE(&iscsi->outqueue, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->outqueue, pdu);
|
||||||
if ( !(pdu->flags & ISCSI_PDU_NO_CALLBACK)) {
|
if ( !(pdu->flags & ISCSI_PDU_NO_CALLBACK)) {
|
||||||
pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL,
|
pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL,
|
||||||
pdu->private_data);
|
pdu->private_data);
|
||||||
@@ -1912,7 +1912,7 @@ iscsi_scsi_cancel_all_tasks(struct iscsi_context *iscsi)
|
|||||||
struct iscsi_pdu *pdu;
|
struct iscsi_pdu *pdu;
|
||||||
|
|
||||||
while ((pdu = iscsi->waitpdu)) {
|
while ((pdu = iscsi->waitpdu)) {
|
||||||
SLIST_REMOVE(&iscsi->waitpdu, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||||
if ( !(pdu->flags & ISCSI_PDU_NO_CALLBACK)) {
|
if ( !(pdu->flags & ISCSI_PDU_NO_CALLBACK)) {
|
||||||
pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL,
|
pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL,
|
||||||
pdu->private_data);
|
pdu->private_data);
|
||||||
@@ -1920,7 +1920,7 @@ iscsi_scsi_cancel_all_tasks(struct iscsi_context *iscsi)
|
|||||||
iscsi_free_pdu(iscsi, pdu);
|
iscsi_free_pdu(iscsi, pdu);
|
||||||
}
|
}
|
||||||
while ((pdu = iscsi->outqueue)) {
|
while ((pdu = iscsi->outqueue)) {
|
||||||
SLIST_REMOVE(&iscsi->outqueue, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->outqueue, pdu);
|
||||||
if ( !(pdu->flags & ISCSI_PDU_NO_CALLBACK)) {
|
if ( !(pdu->flags & ISCSI_PDU_NO_CALLBACK)) {
|
||||||
pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL,
|
pdu->callback(iscsi, SCSI_STATUS_CANCELLED, NULL,
|
||||||
pdu->private_data);
|
pdu->private_data);
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ int iscsi_process_reject(struct iscsi_context *iscsi,
|
|||||||
pdu->callback(iscsi, SCSI_STATUS_ERROR, NULL,
|
pdu->callback(iscsi, SCSI_STATUS_ERROR, NULL,
|
||||||
pdu->private_data);
|
pdu->private_data);
|
||||||
|
|
||||||
SLIST_REMOVE(&iscsi->waitpdu, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||||
iscsi_free_pdu(iscsi, pdu);
|
iscsi_free_pdu(iscsi, pdu);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -426,7 +426,7 @@ iscsi_process_pdu(struct iscsi_context *iscsi, struct iscsi_in_pdu *in)
|
|||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case ISCSI_PDU_LOGIN_RESPONSE:
|
case ISCSI_PDU_LOGIN_RESPONSE:
|
||||||
if (iscsi_process_login_reply(iscsi, pdu, in) != 0) {
|
if (iscsi_process_login_reply(iscsi, pdu, in) != 0) {
|
||||||
SLIST_REMOVE(&iscsi->waitpdu, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||||
iscsi_free_pdu(iscsi, pdu);
|
iscsi_free_pdu(iscsi, pdu);
|
||||||
iscsi_set_error(iscsi, "iscsi login reply "
|
iscsi_set_error(iscsi, "iscsi login reply "
|
||||||
"failed");
|
"failed");
|
||||||
@@ -435,7 +435,7 @@ iscsi_process_pdu(struct iscsi_context *iscsi, struct iscsi_in_pdu *in)
|
|||||||
break;
|
break;
|
||||||
case ISCSI_PDU_TEXT_RESPONSE:
|
case ISCSI_PDU_TEXT_RESPONSE:
|
||||||
if (iscsi_process_text_reply(iscsi, pdu, in) != 0) {
|
if (iscsi_process_text_reply(iscsi, pdu, in) != 0) {
|
||||||
SLIST_REMOVE(&iscsi->waitpdu, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||||
iscsi_free_pdu(iscsi, pdu);
|
iscsi_free_pdu(iscsi, pdu);
|
||||||
iscsi_set_error(iscsi, "iscsi text reply "
|
iscsi_set_error(iscsi, "iscsi text reply "
|
||||||
"failed");
|
"failed");
|
||||||
@@ -444,7 +444,7 @@ iscsi_process_pdu(struct iscsi_context *iscsi, struct iscsi_in_pdu *in)
|
|||||||
break;
|
break;
|
||||||
case ISCSI_PDU_LOGOUT_RESPONSE:
|
case ISCSI_PDU_LOGOUT_RESPONSE:
|
||||||
if (iscsi_process_logout_reply(iscsi, pdu, in) != 0) {
|
if (iscsi_process_logout_reply(iscsi, pdu, in) != 0) {
|
||||||
SLIST_REMOVE(&iscsi->waitpdu, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||||
iscsi_free_pdu(iscsi, pdu);
|
iscsi_free_pdu(iscsi, pdu);
|
||||||
iscsi_set_error(iscsi, "iscsi logout reply "
|
iscsi_set_error(iscsi, "iscsi logout reply "
|
||||||
"failed");
|
"failed");
|
||||||
@@ -453,7 +453,7 @@ iscsi_process_pdu(struct iscsi_context *iscsi, struct iscsi_in_pdu *in)
|
|||||||
break;
|
break;
|
||||||
case ISCSI_PDU_SCSI_RESPONSE:
|
case ISCSI_PDU_SCSI_RESPONSE:
|
||||||
if (iscsi_process_scsi_reply(iscsi, pdu, in) != 0) {
|
if (iscsi_process_scsi_reply(iscsi, pdu, in) != 0) {
|
||||||
SLIST_REMOVE(&iscsi->waitpdu, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||||
iscsi_free_pdu(iscsi, pdu);
|
iscsi_free_pdu(iscsi, pdu);
|
||||||
iscsi_set_error(iscsi, "iscsi response reply "
|
iscsi_set_error(iscsi, "iscsi response reply "
|
||||||
"failed");
|
"failed");
|
||||||
@@ -463,7 +463,7 @@ iscsi_process_pdu(struct iscsi_context *iscsi, struct iscsi_in_pdu *in)
|
|||||||
case ISCSI_PDU_DATA_IN:
|
case ISCSI_PDU_DATA_IN:
|
||||||
if (iscsi_process_scsi_data_in(iscsi, pdu, in,
|
if (iscsi_process_scsi_data_in(iscsi, pdu, in,
|
||||||
&is_finished) != 0) {
|
&is_finished) != 0) {
|
||||||
SLIST_REMOVE(&iscsi->waitpdu, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||||
iscsi_free_pdu(iscsi, pdu);
|
iscsi_free_pdu(iscsi, pdu);
|
||||||
iscsi_set_error(iscsi, "iscsi data in "
|
iscsi_set_error(iscsi, "iscsi data in "
|
||||||
"failed");
|
"failed");
|
||||||
@@ -472,7 +472,7 @@ iscsi_process_pdu(struct iscsi_context *iscsi, struct iscsi_in_pdu *in)
|
|||||||
break;
|
break;
|
||||||
case ISCSI_PDU_NOP_IN:
|
case ISCSI_PDU_NOP_IN:
|
||||||
if (iscsi_process_nop_out_reply(iscsi, pdu, in) != 0) {
|
if (iscsi_process_nop_out_reply(iscsi, pdu, in) != 0) {
|
||||||
SLIST_REMOVE(&iscsi->waitpdu, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||||
iscsi_free_pdu(iscsi, pdu);
|
iscsi_free_pdu(iscsi, pdu);
|
||||||
iscsi_set_error(iscsi, "iscsi nop-in failed");
|
iscsi_set_error(iscsi, "iscsi nop-in failed");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -481,7 +481,7 @@ iscsi_process_pdu(struct iscsi_context *iscsi, struct iscsi_in_pdu *in)
|
|||||||
case ISCSI_PDU_SCSI_TASK_MANAGEMENT_RESPONSE:
|
case ISCSI_PDU_SCSI_TASK_MANAGEMENT_RESPONSE:
|
||||||
if (iscsi_process_task_mgmt_reply(iscsi, pdu,
|
if (iscsi_process_task_mgmt_reply(iscsi, pdu,
|
||||||
in) != 0) {
|
in) != 0) {
|
||||||
SLIST_REMOVE(&iscsi->waitpdu, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||||
iscsi_free_pdu(iscsi, pdu);
|
iscsi_free_pdu(iscsi, pdu);
|
||||||
iscsi_set_error(iscsi, "iscsi task-mgmt failed");
|
iscsi_set_error(iscsi, "iscsi task-mgmt failed");
|
||||||
return -1;
|
return -1;
|
||||||
@@ -489,7 +489,7 @@ iscsi_process_pdu(struct iscsi_context *iscsi, struct iscsi_in_pdu *in)
|
|||||||
break;
|
break;
|
||||||
case ISCSI_PDU_R2T:
|
case ISCSI_PDU_R2T:
|
||||||
if (iscsi_process_r2t(iscsi, pdu, in) != 0) {
|
if (iscsi_process_r2t(iscsi, pdu, in) != 0) {
|
||||||
SLIST_REMOVE(&iscsi->waitpdu, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||||
iscsi_free_pdu(iscsi, pdu);
|
iscsi_free_pdu(iscsi, pdu);
|
||||||
iscsi_set_error(iscsi, "iscsi r2t "
|
iscsi_set_error(iscsi, "iscsi r2t "
|
||||||
"failed");
|
"failed");
|
||||||
@@ -504,7 +504,7 @@ iscsi_process_pdu(struct iscsi_context *iscsi, struct iscsi_in_pdu *in)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (is_finished) {
|
if (is_finished) {
|
||||||
SLIST_REMOVE(&iscsi->waitpdu, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||||
iscsi_free_pdu(iscsi, pdu);
|
iscsi_free_pdu(iscsi, pdu);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
+2
-2
@@ -70,7 +70,7 @@ scsi_free_scsi_task(struct scsi_task *task)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
while ((mem = task->mem)) {
|
while ((mem = task->mem)) {
|
||||||
SLIST_REMOVE(&task->mem, mem);
|
ISCSI_LIST_REMOVE(&task->mem, mem);
|
||||||
free(mem);
|
free(mem);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ scsi_malloc(struct scsi_task *task, size_t size)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memset(mem, 0, sizeof(struct scsi_allocated_memory) + size);
|
memset(mem, 0, sizeof(struct scsi_allocated_memory) + size);
|
||||||
SLIST_ADD(&task->mem, mem);
|
ISCSI_LIST_ADD(&task->mem, mem);
|
||||||
return &mem->buf[0];
|
return &mem->buf[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+4
-4
@@ -578,7 +578,7 @@ iscsi_read_from_socket(struct iscsi_context *iscsi)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
SLIST_ADD_END(&iscsi->inqueue, in);
|
ISCSI_LIST_ADD_END(&iscsi->inqueue, in);
|
||||||
iscsi->incoming = NULL;
|
iscsi->incoming = NULL;
|
||||||
|
|
||||||
|
|
||||||
@@ -588,7 +588,7 @@ iscsi_read_from_socket(struct iscsi_context *iscsi)
|
|||||||
if (iscsi_process_pdu(iscsi, current) != 0) {
|
if (iscsi_process_pdu(iscsi, current) != 0) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
SLIST_REMOVE(&iscsi->inqueue, current);
|
ISCSI_LIST_REMOVE(&iscsi->inqueue, current);
|
||||||
iscsi_free_iscsi_in_pdu(iscsi, current);
|
iscsi_free_iscsi_in_pdu(iscsi, current);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -617,13 +617,13 @@ iscsi_write_to_socket(struct iscsi_context *iscsi)
|
|||||||
}
|
}
|
||||||
/* pop first element of the outqueue */
|
/* pop first element of the outqueue */
|
||||||
iscsi->outqueue_current = iscsi->outqueue;
|
iscsi->outqueue_current = iscsi->outqueue;
|
||||||
SLIST_REMOVE(&iscsi->outqueue, iscsi->outqueue_current);
|
ISCSI_LIST_REMOVE(&iscsi->outqueue, iscsi->outqueue_current);
|
||||||
if (!(iscsi->outqueue_current->flags & ISCSI_PDU_DELETE_WHEN_SENT)) {
|
if (!(iscsi->outqueue_current->flags & ISCSI_PDU_DELETE_WHEN_SENT)) {
|
||||||
/* we have to add the pdu to the waitqueue already here
|
/* we have to add the pdu to the waitqueue already here
|
||||||
since the storage might sent a R2T as soon as it has
|
since the storage might sent a R2T as soon as it has
|
||||||
received the header. if we sent immediate data in a
|
received the header. if we sent immediate data in a
|
||||||
cmd PDU the R2T might get lost otherwise. */
|
cmd PDU the R2T might get lost otherwise. */
|
||||||
SLIST_ADD_END(&iscsi->waitpdu, iscsi->outqueue_current);
|
ISCSI_LIST_ADD_END(&iscsi->waitpdu, iscsi->outqueue_current);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -163,10 +163,10 @@ wait_until_test_finished(struct iscsi_context *iscsi, struct iscsi_async_state *
|
|||||||
state->task->status = SCSI_STATUS_CANCELLED;
|
state->task->status = SCSI_STATUS_CANCELLED;
|
||||||
/* this may leak memory since we don't free the pdu */
|
/* this may leak memory since we don't free the pdu */
|
||||||
while ((pdu = iscsi->outqueue)) {
|
while ((pdu = iscsi->outqueue)) {
|
||||||
SLIST_REMOVE(&iscsi->outqueue, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->outqueue, pdu);
|
||||||
}
|
}
|
||||||
while ((pdu = iscsi->waitpdu)) {
|
while ((pdu = iscsi->waitpdu)) {
|
||||||
SLIST_REMOVE(&iscsi->waitpdu, pdu);
|
ISCSI_LIST_REMOVE(&iscsi->waitpdu, pdu);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user