It is not real zero-copy since the data is still copied in the kernel,
but it avoids copying the data inside libiscsi as well as in the callback.
For SCSI tasks that will return data from the target, the application can now
specify application buffers for libiscsi to read the data directly into.
This is done by calling scsi_task_add_data_in_buffer(task, ...
These buffers need not be linear, you can specify different areas to read into
by calling this function several times.
See examples/iscsiclient.c for an example.
dont pick task up from the argument, since this callback can be invoked
from places where we dont have/know the task strucutre and it is thus NULL.
Instead pick it up from scsi_cbstruct.
This prevents a SEGV when processing REJECT to SCSI commands.
(the scsi command callback dereferences the task pointer)
Add a mechanism where residual overflow/underflow can be reportad back to
the application
We probably need somethinf for bidir residuals at some stage too
We dotn need two interfaces that only diuffer in whether they return a pointer or NULL vs an semiidentical interface that returns 0 or <0
All uses of _async() for scsi tasks should be replaced with the equivalent _task() function instead
These functions are also async functions for SCSI commands but they return
a task structure or NULL.
This task structure can be used in task management functions to abort the task or a whole task set.
LBA is uint32_t for read/write10
Also store the lba/numblocks arguments in the task structure for read10/write10
This makes it much easier to implement a fully async "read lots/write lots"
applications.
Update the "send scsi command" fucntion to honour
"FirstBurstLength" so that we only send this many bytes as unsolicited data.
The wait for a train of R2T from the target to clock out additional
busrts of data until the full task data has been sent to the Target.
We should now honour, and handle the case of
ImmediateData=No
InitialR2T=No
correctly for targets that are limited on receiveing data too fast.
Update the send pdu command to trap when we need to send data to the target
but we are not allowed to send using immediate data.
For this case, send the data as a separate DATAOUT pdu instead.
Twiddle the flags and other fields to now manage that we send the data
as two separate PDUs.
Input processing used to keep all data in one single input buffer, which
makes it hard to handle nested events as well as reading directly from the
socket into the application buffer without an extra copy.
Create a new iscsi_in_pdu structure where we store the header, and any data
for the recevied pdu and store them in a proper input queue.
Change the signature for all processing functions to tahe a iscsi_in_pdu
structure for the received pdu instead of just a pointer to a buffer.