From 9cd03ca559610b3aa464627730fe3152b7f2eb1b Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Sun, 2 Jan 2011 17:49:12 +1100 Subject: [PATCH] Add a new helper function iscsi_allocate_pdu_with_itt_flags() This function can allocate a new pdu using a specific itt value and specific flags instead of using the defaults of, next iff, no flags set. This can be used when we need to allocate additional PDUs in a chain, for commands that span across multiple PDUs and where all need to keep the same itt value. For example ->WRITE10 cdb ->DATAOUT -outdata.data[16] = htonl(iscsi->itt); - pdu->itt = iscsi->itt; + iscsi_pdu_set_itt(pdu, itt); + pdu->itt = itt; - iscsi->itt++; + /* flags */ + pdu->flags = flags; 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++, 0); +} + void iscsi_free_pdu(struct iscsi_context *iscsi, struct iscsi_pdu *pdu) {