Commit Graph

33 Commits

Author SHA1 Message Date
Paolo Bonzini
a1975e90f6 fix warning from -Wuninitialized 2011-09-21 12:00:20 +02:00
Ronnie Sahlberg
3c11c3598b Add a function to cancel a scsi task from libiscsi. 2011-09-19 21:21:40 +10:00
Ronnie Sahlberg
c3d3123981 Windows: Add support to build as a DLL under windows 2011-08-31 13:12:30 +10:00
Ronnie Sahlberg
7a4b1d2640 Fix documentation of how to use 'zero-copy' reads.
The function to specify the read buffers is called
scsi_task_add_data_in_buffer, not scsi_task_add_data_buffer

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2011-04-22 07:51:47 +10:00
Ronnie Sahlberg
3a39201543 Add 'zero-copy' in libiscsi for reads.
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.
2011-04-20 05:46:17 +10:00
Ronnie Sahlberg
07ad0572f2 Add support for READ6 2011-04-16 08:06:16 +10:00
Ronnie Sahlberg
b6782dd7c8 TCP KEEPALIVE support
Add tcp keeplaive support on platforms that support these socket options.
Set default to fail the socket after 120 seconds
2011-04-13 21:37:28 +10:00
Ronnie Sahlberg
cfe19486ee Add RESERVATION CONFLICT
From Richard Sharpe,  add support to handle when a target responds with
RESERVATION CONFLICT to a scsi i/o
2011-04-09 12:00:10 +10:00
Ronnie Sahlberg
343d86dca7 get rid of the _async() scsi functions.
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
2011-03-27 18:17:12 +11:00
Ronnie Sahlberg
f4f6ef5033 change dont automatically free the scsi_task once the callback completes.
Freeing the scsi_task structure is the responsibility of the application
to either do so during the callback, or later.
2011-03-27 17:53:05 +11:00
Ronnie Sahlberg
3561dbbd61 Document the async _task() functions 2011-02-27 10:32:23 +11:00
Ronnie Sahlberg
76208e1eff Rename the _send() functions to _task()
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.
2011-02-27 10:29:51 +11:00
Ronnie Sahlberg
356a6571bb Login: remember what the TargetAddress returned during login is so we can
handle redirect 'errors'.
2011-02-25 15:35:49 +11:00
Ronnie Sahlberg
e9749ee68c Add ifdefs to protect the header files from being included
multiple times

From Richard Sharpe
2011-02-25 14:25:45 +11:00
Ronnie Sahlberg
c07dee474c TaskManagement: Add LunReset, TargetWarmReset, TargetColdReset 2011-02-19 18:23:03 +11:00
Ronnie Sahlberg
6a2a8b5187 TaskManagement: Add a function for abort task set 2011-02-19 18:18:56 +11:00
Ronnie Sahlberg
b81d21ce8c TaskManagement: Add a function to abort a scsi_task 2011-02-19 18:04:55 +11:00
Ronnie Sahlberg
4315ee9225 Create _send() functions for all scsi commands that return a 'handle'
we can use to abort the task later.
2011-02-19 17:30:03 +11:00
Ronnie Sahlberg
09446737aa TaskMgmt: add a enum for the task management functions 2011-02-15 22:03:41 +11:00
Ronnie Sahlberg
3dfdebcba7 TaskMgmt : Add an initial function to create a iscsi tm PDU 2011-02-15 21:53:47 +11:00
Ronnie Sahlberg
eba0a2de81 SYNC READ10 : add a sync version for read10 2011-02-05 20:41:02 +11:00
Ronnie Sahlberg
c29b9a2aae Add a new "iscsi_queue_length()" which will tell us how many commands
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.
2011-02-03 19:08:16 +11:00
Ronnie Sahlberg
ec08fe7a45 Read10/Write10 parameters
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.
2011-01-23 18:34:16 +11:00
Ronnie Sahlberg
7b5ff1095c Improve help/usage strings for iscsi-ls and iscsi-inq
For help output, also print the syntax for the iscsi url required.
2011-01-09 10:36:53 +11:00
Ronnie Sahlberg
e312aa2ae0 ISID: Add helper functions to set any type of ISID value for the iscsi context.
Let default be to create a 'random' ISID during context creation.
2011-01-09 09:26:03 +11:00
Ronnie Sahlberg
b5d5370b8c TYPO, fix typo in iscsi.h 2011-01-09 09:04:13 +11:00
Ronnie Sahlberg
7253a667ae Add a helper function to parse a Portal URL.
A Portal URL is of the form
   iscsi://[<username>[%<password>]@]<host>[:<port>]
and is used by command such as iscsi-ls during the discovery login phase.

During discovery we do not yet know the target iqn name, nor the lun of
any devices.
2011-01-03 15:22:01 +11:00
Ronnie Sahlberg
a0acddb627 Update to the public header to better document the api 2010-12-31 12:26:46 +11:00
Ronnie Sahlberg
40abe849b0 CHAP
Add unidirectional chap support so we can authenticate to the target.

Make the login phase more "intelligent" so we can iterate over login
pdus until we have reached full feature phase

Add a new helper functions to parse a iscsi url and break it down
into elements in a structure

Update iscsi-inq to allow CHAP authentication
2010-12-22 22:23:55 +11:00
Ronnie Sahlberg
cf0ddbd0d9 URL PARSER
Add a function to parse a common iscsi://... URL so we dont have to re
implement the same code in every application
2010-12-22 18:40:46 +11:00
Ronnie Sahlberg
8a6665a092 Licence
Change to LGPL 2.1+ to be compatible with kvm/qemu
2010-12-11 11:47:28 +11:00
Ronnie Sahlberg
709d85c4da Add a COPYING file and updat ehte LGPL boilerplate 2010-12-05 11:11:37 +11:00
Ronnie Sahlberg
098bc5a9a7 Initial import of libiscsi 2010-12-05 08:24:57 +11:00