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 <ronniesahlberg@gmail.com>
This commit is contained in:
@@ -257,12 +257,9 @@ struct iscsi_pdu {
|
|||||||
|
|
||||||
struct iscsi_pdu *iscsi_allocate_pdu(struct iscsi_context *iscsi,
|
struct iscsi_pdu *iscsi_allocate_pdu(struct iscsi_context *iscsi,
|
||||||
enum iscsi_opcode opcode,
|
enum iscsi_opcode opcode,
|
||||||
enum iscsi_opcode response_opcode);
|
enum iscsi_opcode response_opcode,
|
||||||
struct iscsi_pdu *iscsi_allocate_pdu_with_itt_flags(struct iscsi_context *iscsi,
|
uint32_t itt,
|
||||||
enum iscsi_opcode opcode,
|
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_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_pduflags(struct iscsi_pdu *pdu, unsigned char flags);
|
||||||
void iscsi_pdu_set_immediate(struct iscsi_pdu *pdu);
|
void iscsi_pdu_set_immediate(struct iscsi_pdu *pdu);
|
||||||
|
|||||||
@@ -46,7 +46,9 @@ iscsi_discovery_async(struct iscsi_context *iscsi, iscsi_command_cb cb,
|
|||||||
}
|
}
|
||||||
|
|
||||||
pdu = iscsi_allocate_pdu(iscsi, ISCSI_PDU_TEXT_REQUEST,
|
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) {
|
if (pdu == NULL) {
|
||||||
iscsi_set_error(iscsi, "Out-of-memory: Failed to allocate "
|
iscsi_set_error(iscsi, "Out-of-memory: Failed to allocate "
|
||||||
"text pdu.");
|
"text pdu.");
|
||||||
|
|||||||
@@ -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);
|
len = MIN(len, iscsi->target_max_recv_data_segment_length);
|
||||||
|
|
||||||
pdu = iscsi_allocate_pdu_with_itt_flags(iscsi, ISCSI_PDU_DATA_OUT,
|
pdu = iscsi_allocate_pdu(iscsi,
|
||||||
ISCSI_PDU_NO_PDU,
|
ISCSI_PDU_DATA_OUT,
|
||||||
cmd_pdu->itt,
|
ISCSI_PDU_NO_PDU,
|
||||||
ISCSI_PDU_DROP_ON_RECONNECT|ISCSI_PDU_DELETE_WHEN_SENT|ISCSI_PDU_NO_CALLBACK);
|
cmd_pdu->itt,
|
||||||
|
ISCSI_PDU_DROP_ON_RECONNECT|ISCSI_PDU_DELETE_WHEN_SENT|ISCSI_PDU_NO_CALLBACK);
|
||||||
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.");
|
||||||
@@ -235,8 +236,11 @@ iscsi_scsi_command_async(struct iscsi_context *iscsi, int lun,
|
|||||||
scsi_task_set_iov_out(task, iov, 1);
|
scsi_task_set_iov_out(task, iov, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
pdu = iscsi_allocate_pdu(iscsi, ISCSI_PDU_SCSI_REQUEST,
|
pdu = iscsi_allocate_pdu(iscsi,
|
||||||
ISCSI_PDU_SCSI_RESPONSE);
|
ISCSI_PDU_SCSI_REQUEST,
|
||||||
|
ISCSI_PDU_SCSI_RESPONSE,
|
||||||
|
iscsi_itt_post_increment(iscsi),
|
||||||
|
0);
|
||||||
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 pdu.");
|
"scsi pdu.");
|
||||||
|
|||||||
16
lib/login.c
16
lib/login.c
@@ -730,10 +730,11 @@ iscsi_login_async(struct iscsi_context *iscsi, iscsi_command_cb cb,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdu = iscsi_allocate_pdu_with_itt_flags(iscsi,
|
pdu = iscsi_allocate_pdu(iscsi,
|
||||||
ISCSI_PDU_LOGIN_REQUEST,
|
ISCSI_PDU_LOGIN_REQUEST,
|
||||||
ISCSI_PDU_LOGIN_RESPONSE,
|
ISCSI_PDU_LOGIN_RESPONSE,
|
||||||
iscsi->itt, 0);
|
iscsi->itt,
|
||||||
|
0);
|
||||||
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 "
|
||||||
"login pdu.");
|
"login pdu.");
|
||||||
@@ -1122,8 +1123,11 @@ iscsi_logout_async_internal(struct iscsi_context *iscsi, iscsi_command_cb cb,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdu = iscsi_allocate_pdu(iscsi, ISCSI_PDU_LOGOUT_REQUEST,
|
pdu = iscsi_allocate_pdu(iscsi,
|
||||||
ISCSI_PDU_LOGOUT_RESPONSE);
|
ISCSI_PDU_LOGOUT_REQUEST,
|
||||||
|
ISCSI_PDU_LOGOUT_RESPONSE,
|
||||||
|
iscsi_itt_post_increment(iscsi),
|
||||||
|
0);
|
||||||
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 "
|
||||||
"logout pdu.");
|
"logout pdu.");
|
||||||
|
|||||||
16
lib/nop.c
16
lib/nop.c
@@ -36,15 +36,16 @@ iscsi_nop_out_async(struct iscsi_context *iscsi, iscsi_command_cb cb,
|
|||||||
return -1;
|
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) {
|
if (pdu == NULL) {
|
||||||
iscsi_set_error(iscsi, "Failed to allocate nop-out pdu");
|
iscsi_set_error(iscsi, "Failed to allocate nop-out pdu");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We don't want to requeue these on reconnect */
|
|
||||||
pdu->flags |= ISCSI_PDU_DROP_ON_RECONNECT;
|
|
||||||
|
|
||||||
/* immediate flag */
|
/* immediate flag */
|
||||||
iscsi_pdu_set_immediate(pdu);
|
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;
|
struct iscsi_pdu *pdu;
|
||||||
|
|
||||||
pdu = iscsi_allocate_pdu_with_itt_flags(iscsi, ISCSI_PDU_NOP_OUT, ISCSI_PDU_NO_PDU,
|
pdu = iscsi_allocate_pdu(iscsi,
|
||||||
0xffffffff,ISCSI_PDU_DROP_ON_RECONNECT|ISCSI_PDU_DELETE_WHEN_SENT|ISCSI_PDU_NO_CALLBACK);
|
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) {
|
if (pdu == NULL) {
|
||||||
iscsi_set_error(iscsi, "Failed to allocate nop-out pdu");
|
iscsi_set_error(iscsi, "Failed to allocate nop-out pdu");
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
12
lib/pdu.c
12
lib/pdu.c
@@ -104,8 +104,9 @@ void iscsi_dump_pdu_header(struct iscsi_context *iscsi, unsigned char *data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
struct iscsi_pdu *
|
struct iscsi_pdu *
|
||||||
iscsi_allocate_pdu_with_itt_flags(struct iscsi_context *iscsi, enum iscsi_opcode opcode,
|
iscsi_allocate_pdu(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)
|
||||||
{
|
{
|
||||||
struct iscsi_pdu *pdu;
|
struct iscsi_pdu *pdu;
|
||||||
|
|
||||||
@@ -143,13 +144,6 @@ iscsi_allocate_pdu_with_itt_flags(struct iscsi_context *iscsi, enum iscsi_opcode
|
|||||||
return pdu;
|
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
|
void
|
||||||
iscsi_free_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu)
|
iscsi_free_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -49,8 +49,11 @@ iscsi_task_mgmt_async(struct iscsi_context *iscsi,
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
pdu = iscsi_allocate_pdu(iscsi, ISCSI_PDU_SCSI_TASK_MANAGEMENT_REQUEST,
|
pdu = iscsi_allocate_pdu(iscsi,
|
||||||
ISCSI_PDU_SCSI_TASK_MANAGEMENT_RESPONSE);
|
ISCSI_PDU_SCSI_TASK_MANAGEMENT_REQUEST,
|
||||||
|
ISCSI_PDU_SCSI_TASK_MANAGEMENT_RESPONSE,
|
||||||
|
iscsi_itt_post_increment(iscsi),
|
||||||
|
0);
|
||||||
if (pdu == NULL) {
|
if (pdu == NULL) {
|
||||||
iscsi_set_error(iscsi, "Failed to allocate task mgmt pdu");
|
iscsi_set_error(iscsi, "Failed to allocate task mgmt pdu");
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
Reference in New Issue
Block a user