Commit Graph

125 Commits

Author SHA1 Message Date
Ronnie Sahlberg
53dda35d38 Add patch to provide iscsi functionality in the MTX package 2011-03-27 18:30:12 +11:00
Ronnie Sahlberg
40d3928c64 oops used the wrong sg3 patch
this adds the right sg3 patch to iscsi enable sg3 utils
2011-03-27 18:24:34 +11: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
cedcc55796 Add SG3 utils patch to the patches subdirectory 2011-03-27 18:00:55 +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
4e6e39ee23 Support for REJECT PDUs. 2011-02-27 13:49:49 +11:00
Ronnie Sahlberg
8784a72f0e ISCSICLIENT update the example to use the _task() function for task management 2011-02-27 10:35:49 +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
bdbf6b5d00 Dont free the scsi task from iscsi_scsi_command_async(), leave that for the caller to do if required. 2011-02-25 15:53:56 +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
b5c1c8705a Merge branch 'prefix_fix' of https://github.com/stefanha/libiscsi into stefanha-prefix_fix 2011-02-25 14:11:28 +11:00
Ronnie Sahlberg
d1fdaef5c6 Username/password separator: Allow ':' to separate the chap username/password in addition to '%' 2011-02-20 10:44:53 +11:00
Stefan Hajnoczi
7ed8707633 Let DESTDIR and LIBDIR override prefix and libdir
The following used to fail:

  ./configure --prefix=/tmp/libiscsi
  make install

This was because DESTDIR was unconditionally used in Makefile.in.
Instead, use the prefix from ./configure unless overriden by DESTDIR
and/or LIBDIR.

Note that this commit drops ldconfig from the Makefile but I'm not sure
this is wanted outside of packaging anyway.

Signed-off-by: Stefan Hajnoczi <stefanha@gmail.com>
2011-02-19 15:57:47 +00:00
Ronnie Sahlberg
b1955c69ff TODO: We now support task management functions 2011-02-19 18:24:21 +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
fb34c5615a Update the example with a task management call to abort a task 2011-02-19 18:04:22 +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
9c7ca31482 TaskMgmt: Add handling of tm responses we receive from the target 2011-02-15 21:58:29 +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
332ea04e8d TaskMgmt: Add a functionto set the Reference cmdsn for tm pdus 2011-02-15 21:44:16 +11:00
Ronnie Sahlberg
95db35e592 TaskMgmt: add a function to set the ritt for tm pdus 2011-02-15 21:42:23 +11:00
Ronnie Sahlberg
2c093d86a6 whitespace changes to the list of pdu types 2011-02-15 21:26:26 +11:00
Ronnie Sahlberg
704288169f Add task management pdu request and response constants to the list of pdu types 2011-02-15 21:24:24 +11:00
Ronnie Sahlberg
f73e42ec26 TaskManagement: Store the ITT and CMDSN in the scsi_task structure
These are required for some of the task management functions
2011-02-15 20:57:03 +11:00
Ronnie Sahlberg
b51807e65a README update 2011-02-13 08:09:08 +11:00
Ronnie Sahlberg
e3af8903ac README remove strace from example 2011-02-13 08:06:30 +11:00
Ronnie Sahlberg
52b7ae3152 LD_PRELOAD: add dup2 support so we can use it with dd 2011-02-13 07:36:26 +11:00
Ronnie Sahlberg
0c6025b01b Using two different structures, with the same first element, and casting
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
2011-02-09 15:51:45 +11:00
Ronnie Sahlberg
7a454aa010 autogen.sh: we should create libiscsi.pc not ctdb.pc 2011-02-07 21:47:26 +11:00
Ronnie Sahlberg
947a1a7796 MAKEFILE: Add a distclean target 2011-02-07 21:46:57 +11:00
Ronnie Sahlberg
35821830d6 LD_ISCSI.SO LD_PRELOAD hack
ld_iscsi.so is a small LD_PRELOAD hack that can be used to make normal
unix utilities such as 'stat' and 'cat' become iSCSI 'aware' and fake
handling an iSCSI URL as a normal read-only file.

See README for examples.
2011-02-05 21:21:52 +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
d22a2aee3c When initializing a new session, default to set the
"random" ISID randomly.

Dont assume that users will never create multiple contexts
concurrently, in which case the previous getpid()^time(NULL)
would create duplicates.
2011-01-27 11:02:16 +11:00
Ronnie Sahlberg
ca1e152f2c New example file :
iscsi-dd can be used to copy the content of one iscsi lun onto a different
iscsi lun of the exact same sixe.

This example  illustrates how to "steal" a task structure from a callback
so we can use store it and have it remains valid after the read10 callback
has completed.
It also illustrates the async api of libiscsi for read10/write10.

Initially a number of read10 calls are made asynchronously until the
queue is full.
As each read10 completes and returns data, we issue a write10 to write
that data to the other lun.

As soon as a write10 completes, we "release" the initial read10 task corresponding to what we wrote and issue a new read10 to continue copying the next set of un-read data.

Using the async api, it should be easy to get very high performance and
throughput even from one single thread.
2011-01-23 18:35:58 +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
b2c4bdcd43 iscsi-ls: Destroy the iscsi_url when exiting. 2011-01-09 09:51:26 +11:00
Ronnie Sahlberg
f3f2031a8c Fix a compiler warning 2011-01-09 09:48:59 +11:00
Ronnie Sahlberg
b9ad4beb41 Replace rindex() with strrchr() 2011-01-09 09:47:39 +11:00
Ronnie Sahlberg
5e11bb17b1 Replace index() with strchr() 2011-01-09 09:46:42 +11:00
Ronnie Sahlberg
f1996d26a6 Check the return from asprintf() and report an error when it fails. 2011-01-09 09:43:33 +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
554670820b README: Add a blurb about HeaderDigest in libiscsi and what is the default 2011-01-09 08:58:32 +11:00