for a read10 call, the application might have specified too few buffers
for the full I/O.
For example if the application tries to read just 512 bytes off a MMC device.
In this case we wopuld run out of buffers and fail with a SEGV.
Instead of failing like this, return NULL from the function to locate a suitable buffer and read the remaining data from the command into the callback buffer instead, just like when no read-buffer at all has been specified.
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.
between them makes compilers complain about aliasing.
Merge the two and use one single structure bot both iscsi and scsi sync
commands so that gcc stops crying about strict-aliasing
are in flight at the moment.
Aside from commands, we also consider the "has not yet connected completely" as being an i/o.
When this command returns 0 it means we are connected ant the iscsi connection is idle, with no commands in flight.
KVM needs a function to detect idleness like this for its block layer io_flush
function.