From 511c2fdbd1e4aabf99106d8170dc786a1b9ed22a Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Mon, 23 Feb 2015 20:21:43 -0800 Subject: [PATCH] pdu.c: remove iscsi_allocate_pdu_with_itt_flags() Remove iscsi_allocate_pdu() which is just a wrapper. Rename iscsi_allocate_pdu_with_itt_flags() to iscsi_allocate_pdu() and update all callers. This only removes a wrapper function and contains no logic changes. Signed-off-by: Ronnie Sahlberg --- include/iscsi-private.h | 9 +++------ lib/discovery.c | 4 +++- lib/iscsi-command.c | 16 ++++++++++------ lib/login.c | 16 ++++++++++------ lib/nop.c | 16 ++++++++++------ lib/pdu.c | 12 +++--------- lib/task_mgmt.c | 7 +++++-- 7 files changed, 44 insertions(+), 36 deletions(-) diff --git a/include/iscsi-private.h b/include/iscsi-private.h index 0dd73b0..b1431da 100644 --- a/include/iscsi-private.h +++ b/include/iscsi-private.h @@ -257,12 +257,9 @@ struct iscsi_pdu { struct iscsi_pdu *iscsi_allocate_pdu(struct iscsi_context *iscsi, enum iscsi_opcode opcode, - enum iscsi_opcode response_opcode); -struct iscsi_pdu *iscsi_allocate_pdu_with_itt_flags(struct iscsi_context *iscsi, - enum iscsi_opcode opcode, - enum iscsi_opcode response_opcode, - uint32_t itt, - uint32_t flags); + enum iscsi_opcode response_opcode, + uint32_t itt, + uint32_t flags); void iscsi_free_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu); void iscsi_pdu_set_pduflags(struct iscsi_pdu *pdu, unsigned char flags); void iscsi_pdu_set_immediate(struct iscsi_pdu *pdu); diff --git a/lib/discovery.c b/lib/discovery.c index a8f7432..a716626 100644 --- a/lib/discovery.c +++ b/lib/discovery.c @@ -46,7 +46,9 @@ iscsi_discovery_async(struct iscsi_context *iscsi, iscsi_command_cb cb, } pdu = iscsi_allocate_pdu(iscsi, ISCSI_PDU_TEXT_REQUEST, - ISCSI_PDU_TEXT_RESPONSE); + ISCSI_PDU_TEXT_RESPONSE, + iscsi_itt_post_increment(iscsi), + 0); if (pdu == NULL) { iscsi_set_error(iscsi, "Out-of-memory: Failed to allocate " "text pdu."); diff --git a/lib/iscsi-command.c b/lib/iscsi-command.c index 4ba5a55..aea6e3c 100644 --- a/lib/iscsi-command.c +++ b/lib/iscsi-command.c @@ -78,10 +78,11 @@ iscsi_send_data_out(struct iscsi_context *iscsi, struct iscsi_pdu *cmd_pdu, len = MIN(len, iscsi->target_max_recv_data_segment_length); - pdu = iscsi_allocate_pdu_with_itt_flags(iscsi, ISCSI_PDU_DATA_OUT, - ISCSI_PDU_NO_PDU, - cmd_pdu->itt, - ISCSI_PDU_DROP_ON_RECONNECT|ISCSI_PDU_DELETE_WHEN_SENT|ISCSI_PDU_NO_CALLBACK); + pdu = iscsi_allocate_pdu(iscsi, + ISCSI_PDU_DATA_OUT, + ISCSI_PDU_NO_PDU, + cmd_pdu->itt, + ISCSI_PDU_DROP_ON_RECONNECT|ISCSI_PDU_DELETE_WHEN_SENT|ISCSI_PDU_NO_CALLBACK); if (pdu == NULL) { iscsi_set_error(iscsi, "Out-of-memory, Failed to allocate " "scsi data out pdu."); @@ -235,8 +236,11 @@ iscsi_scsi_command_async(struct iscsi_context *iscsi, int lun, scsi_task_set_iov_out(task, iov, 1); } - pdu = iscsi_allocate_pdu(iscsi, ISCSI_PDU_SCSI_REQUEST, - ISCSI_PDU_SCSI_RESPONSE); + pdu = iscsi_allocate_pdu(iscsi, + ISCSI_PDU_SCSI_REQUEST, + ISCSI_PDU_SCSI_RESPONSE, + iscsi_itt_post_increment(iscsi), + 0); if (pdu == NULL) { iscsi_set_error(iscsi, "Out-of-memory, Failed to allocate " "scsi pdu."); diff --git a/lib/login.c b/lib/login.c index 59c55d2..02b98d2 100644 --- a/lib/login.c +++ b/lib/login.c @@ -730,10 +730,11 @@ iscsi_login_async(struct iscsi_context *iscsi, iscsi_command_cb cb, return -1; } - pdu = iscsi_allocate_pdu_with_itt_flags(iscsi, - ISCSI_PDU_LOGIN_REQUEST, - ISCSI_PDU_LOGIN_RESPONSE, - iscsi->itt, 0); + pdu = iscsi_allocate_pdu(iscsi, + ISCSI_PDU_LOGIN_REQUEST, + ISCSI_PDU_LOGIN_RESPONSE, + iscsi->itt, + 0); if (pdu == NULL) { iscsi_set_error(iscsi, "Out-of-memory: Failed to allocate " "login pdu."); @@ -1122,8 +1123,11 @@ iscsi_logout_async_internal(struct iscsi_context *iscsi, iscsi_command_cb cb, return -1; } - pdu = iscsi_allocate_pdu(iscsi, ISCSI_PDU_LOGOUT_REQUEST, - ISCSI_PDU_LOGOUT_RESPONSE); + pdu = iscsi_allocate_pdu(iscsi, + ISCSI_PDU_LOGOUT_REQUEST, + ISCSI_PDU_LOGOUT_RESPONSE, + iscsi_itt_post_increment(iscsi), + 0); if (pdu == NULL) { iscsi_set_error(iscsi, "Out-of-memory: Failed to allocate " "logout pdu."); diff --git a/lib/nop.c b/lib/nop.c index f228017..1729d1b 100644 --- a/lib/nop.c +++ b/lib/nop.c @@ -36,15 +36,16 @@ iscsi_nop_out_async(struct iscsi_context *iscsi, iscsi_command_cb cb, return -1; } - pdu = iscsi_allocate_pdu(iscsi, ISCSI_PDU_NOP_OUT, ISCSI_PDU_NOP_IN); + pdu = iscsi_allocate_pdu(iscsi, + ISCSI_PDU_NOP_OUT, + ISCSI_PDU_NOP_IN, + iscsi_itt_post_increment(iscsi), + ISCSI_PDU_DROP_ON_RECONNECT); if (pdu == NULL) { iscsi_set_error(iscsi, "Failed to allocate nop-out pdu"); return -1; } - /* We don't want to requeue these on reconnect */ - pdu->flags |= ISCSI_PDU_DROP_ON_RECONNECT; - /* immediate flag */ iscsi_pdu_set_immediate(pdu); @@ -91,8 +92,11 @@ iscsi_send_target_nop_out(struct iscsi_context *iscsi, uint32_t ttt) { struct iscsi_pdu *pdu; - pdu = iscsi_allocate_pdu_with_itt_flags(iscsi, ISCSI_PDU_NOP_OUT, ISCSI_PDU_NO_PDU, - 0xffffffff,ISCSI_PDU_DROP_ON_RECONNECT|ISCSI_PDU_DELETE_WHEN_SENT|ISCSI_PDU_NO_CALLBACK); + pdu = iscsi_allocate_pdu(iscsi, + ISCSI_PDU_NOP_OUT, + ISCSI_PDU_NO_PDU, + 0xffffffff, + ISCSI_PDU_DROP_ON_RECONNECT|ISCSI_PDU_DELETE_WHEN_SENT|ISCSI_PDU_NO_CALLBACK); if (pdu == NULL) { iscsi_set_error(iscsi, "Failed to allocate nop-out pdu"); return -1; diff --git a/lib/pdu.c b/lib/pdu.c index 21b3549..f4029ee 100644 --- a/lib/pdu.c +++ b/lib/pdu.c @@ -104,8 +104,9 @@ void iscsi_dump_pdu_header(struct iscsi_context *iscsi, unsigned char *data) { } struct iscsi_pdu * -iscsi_allocate_pdu_with_itt_flags(struct iscsi_context *iscsi, enum iscsi_opcode opcode, - enum iscsi_opcode response_opcode, uint32_t itt, uint32_t flags) +iscsi_allocate_pdu(struct iscsi_context *iscsi, enum iscsi_opcode opcode, + enum iscsi_opcode response_opcode, uint32_t itt, + uint32_t flags) { struct iscsi_pdu *pdu; @@ -143,13 +144,6 @@ iscsi_allocate_pdu_with_itt_flags(struct iscsi_context *iscsi, enum iscsi_opcode return pdu; } -struct iscsi_pdu * -iscsi_allocate_pdu(struct iscsi_context *iscsi, enum iscsi_opcode opcode, - enum iscsi_opcode response_opcode) -{ - return iscsi_allocate_pdu_with_itt_flags(iscsi, opcode, response_opcode, iscsi_itt_post_increment(iscsi), 0); -} - void iscsi_free_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) { diff --git a/lib/task_mgmt.c b/lib/task_mgmt.c index 7a3d749..89fb207 100644 --- a/lib/task_mgmt.c +++ b/lib/task_mgmt.c @@ -49,8 +49,11 @@ iscsi_task_mgmt_async(struct iscsi_context *iscsi, return -1; } - pdu = iscsi_allocate_pdu(iscsi, ISCSI_PDU_SCSI_TASK_MANAGEMENT_REQUEST, - ISCSI_PDU_SCSI_TASK_MANAGEMENT_RESPONSE); + pdu = iscsi_allocate_pdu(iscsi, + ISCSI_PDU_SCSI_TASK_MANAGEMENT_REQUEST, + ISCSI_PDU_SCSI_TASK_MANAGEMENT_RESPONSE, + iscsi_itt_post_increment(iscsi), + 0); if (pdu == NULL) { iscsi_set_error(iscsi, "Failed to allocate task mgmt pdu"); return -1;