Commit Graph

43 Commits

Author SHA1 Message Date
David Disseldorp
2b9abd9ac8 examples/dd: validate block count and max in flight params
Signed-off-by: David Disseldorp <ddiss@suse.de>
2017-01-04 19:32:05 +01:00
Vicente Olivert Riera
f27bdf64f0 Do not use -I/usr/include. This is considered unsafe when cross-compiling
Signed-off-by: Vicente Olivert Riera <Vincent.Riera@imgtec.com>
2016-10-16 10:53:13 +01:00
Roy Shterman
a628264ef0 Libiscsi: iSER implementation
This commit includes all iSER implementation in libscsi
library and utilities.

Also, adding iser option in url.

Change-Id: I55ca8a9d4db802e72eb991061260dbb0bd0ef9ba
Signed-off-by: Roy Shterman <roysh@mellanox.com>
2016-06-03 18:59:01 -07:00
Ronnie Sahlberg
5a80c7b581 Fix some clang warnings
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2016-02-21 16:13:53 -08:00
Chris Zankel
e186169064 build: fix 'out-of-tree' build
Prefix include paths with '${srcdir}' to allow 'out-of-tree' builds:

  cd $BUILD
  $LIBISCSI/configure
  make

Signed-off-by: Chris Zankel <chris@zankel.net>
2015-04-22 18:18:14 -07:00
Peter Lieven
e219f1bb97 utils/examples: avoid busy waiting on wait for reconnect
Signed-off-by: Peter Lieven <pl@kamp.de>
2015-04-13 10:26:28 +02:00
Peter Lieven
2955b2c616 init: apply settings to context in iscsi_parse_url
if iscsi_context is not NULL we apply the parsed settings
to the context.

Signed-off-by: Peter Lieven <pl@kamp.de>
2015-03-26 10:37:39 +01:00
Stefan Weil
86adf5847c Fix wrong checks for username
The variable user in struct iscsi_url is a character array, not a pointer.
Therefore its address will never be NULL.

When libscsi is built using clang instead of gcc, those errors are reported:

iscsi-perf.c:256:17: error:
 comparison of array 'iscsi_url->user' not equal to a null
 pointer is always true [-Werror,-Wtautological-pointer-compare]
iscsi-dd.c:272:17: error:
 comparison of array 'iscsi_url->user' not equal to a null
 pointer is always true [-Werror,-Wtautological-pointer-compare]
iscsi-dd.c:331:17: error:
 comparison of array 'iscsi_url->user' not equal to a null
 pointer is always true [-Werror,-Wtautological-pointer-compare]
ld_iscsi.c:99:18: error:
 comparison of array 'iscsi_url->user' not equal to a null
 pointer is always true [-Werror,-Wtautological-pointer-compare]

Fix those errors and also similar code patterns in aros/iscsi-ls.c and
test-tool/iscsi-support.c.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-03-07 09:54:38 +01:00
Stefan Weil
d7a8ab0f1e Remove trailing blanks
The files touched here need a bug fix which is applied with the
following patch.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
2015-03-07 09:54:38 +01:00
Thomas Petazzoni
80b47741c4 ld_iscsi: fix largefile related issues
This commit fixes two related issues in the ld_iscsi example with
largefile support.

The first issue appears when building libiscsi against the glibc C
library, with the flags -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE
-D_FILE_OFFSET_BITS=64:

{standard input}: Assembler messages:
{standard input}:2774: Error: symbol `__fxstat64' is already defined
{standard input}:2850: Error: symbol `__lxstat64' is already defined
{standard input}:2938: Error: symbol `__xstat64' is already defined

This is due to the fact that when _FILE_OFFSET_BITS=64 is passed, the
*64() functions are defined by the C library as aliases to the
non-64*() functions, because those ones directly support large files
(i.e 64 bits).

The second issue appears when building libiscsi against the uClibc C
library, in a configuration that doesn't have largefile support. In
this case, the ld_iscsi that tries to use stat64 or some other *64()
functions cannot build, because such functions are not provided by the
C library. Of course, ld_iscsi does not need to wrap the *64()
functions in such a situation, because they do not exist.

This commit fixes those problems by enclosing the *64() related code
of ld_iscsi in the following compile time conditional:

This ensures that the *64() function handling is here only if
largefile support is available and enabled (_LARGEFILE_SOURCE64) and
if non-*64() functions are not already 64 bits capable (in which case
the 64*() functions are just aliases for the non-64*() ones).

See also
http://www.gnu.org/software/libc/manual/html_node/Feature-Test-Macros.html
for more details about the meaning of those macros.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-09-07 14:40:02 +02:00
Ronnie Sahlberg
85cbf3c10e iscsi-dd.c: Don't use %lu for 64 bit integers
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2014-08-02 08:19:17 -07:00
Peter Lieven
8e7b0a71bb examples: iscsi-dd add option to ignore errors
Signed-off-by: Peter Lieven <pl@kamp.de>
2014-06-16 18:29:24 +02:00
Peter Lieven
c2a285760d examples: additional options to iscsi-dd
this adds progress output, 16 byte CDB support, additional checks and user
settable max_in_flight and blocks_per_io.

Signed-off-by: Peter Lieven <pl@kamp.de>
2014-06-16 18:09:19 +02:00
Michael Tokarev
14b5faf11e examples/ld_iscsi.c: format string int on 32bit
This patch uses appropriate format string specifiers for uint64_t
types taken from inttypes.h, instead of using %lu, because %lu is
wrong at least on 32bit architecture.

Also, cast size_t expressions to unsigned long, again, because on at least
32bit architectures, size_t is int, not long.

Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2014-05-07 06:50:48 -07:00
Ronnie Sahlberg
1daa323e8b Change remaining command line arguments --initiator_name to --initiator-name
Change the remaining instances to match the manpages and help texts
2014-03-26 17:58:30 -07:00
Ronnie Sahlberg
aff5ef7ed2 AUTOTOOLS: Build the ld preload thing as part of examples 2014-03-22 18:11:30 -07:00
Ronnie Sahlberg
ae60611f68 AUTOTOOLS: Add Makefile.am for examples/ 2014-03-22 17:46:02 -07:00
Ronnie Sahlberg
354f00fd4f Discovery: Create a list of portals for each discovered target.
Some targets return multiple TargetAddress for individual targets.
Create a linked list of addresses for each target instead of
failing the discovery process when this happens.
2014-01-15 19:37:40 -08:00
Ronnie Sahlberg
52a83e91af Add POWER_CONDITION modepage marshalling/unmarshalling 2013-07-20 15:35:38 -07:00
Ronnie Sahlberg
1c5d132ed0 convert iscsi-dd to use getopt_long() 2013-04-21 10:02:05 -07:00
Ronnie Sahlberg
718c71b7a3 Update iscsiclient example to use the new iovector api 2012-11-25 18:47:12 -08:00
Ronnie Sahlberg
580ef169d0 zero copy change iscsiclient so we can use it as a test tool 2012-11-25 13:34:13 -08:00
Ronnie Sahlberg
4a973e9a4e SCSI: Pass the expected opcode to scsi_cdb_unmarshall()
Pass the opcode we expect to the unmarshalling function so it can do a basic
check that we are trying to unmarshalling the right kind of cdb.
2012-11-20 19:16:42 -08:00
Ronnie Sahlberg
890471c8cc Add support to unmarshall a CDB into a structure and update iscsi-dd
Add two new helper functions scsi_get_uint32() and scsi_get_uint16()
2012-11-20 19:00:55 -08:00
Ronnie Sahlberg
e691f9cc2b ISCSI-DD: Remove some compiler warnings 2012-11-20 06:49:19 -08:00
Ronnie Sahlberg
9eb26a368d Fix compiler warnings related to 'const' 2012-11-11 10:03:45 -08:00
Ronnie Sahlberg
116af01156 TYPO: Change periperal_device_type to just device_type
but leave the old name as a define for backward compatibility
2012-09-03 09:45:59 -07:00
Chris Webb
e671ba4699 Update examples/iscsi-dd.c to new iscsi_read10_task() API
Signed-off-by: Chris Webb <chris@arachsys.com>
2012-06-24 18:32:52 +10:00
Ronnie Sahlberg
d5f646099d READ10/WRITE10: Change these functions to sue the same signatures as the other READ/WRITE
Harmonize the signatures for READ10/WRITE10 to match the ones for READ12/16 and WRITE12/16

This breaks the API/ABI so this forces the next version of the library to bump the major version to 2.0

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-06-05 19:20:02 +10:00
Ronnie Sahlberg
db8dadab21 win32 updat ethe example app iscsiclient to compile and link with the compatibility functions 2012-05-15 21:59:59 +10:00
Ronnie Sahlberg
c2da7c9680 Update the licence texts 2012-03-05 13:50:10 +11:00
Ronnie Sahlberg
c3d3123981 Windows: Add support to build as a DLL under windows 2011-08-31 13:12:30 +10:00
Ronnie Sahlberg
de97dbdde8 start implementing mode page unmarshalling 2011-04-23 14:02:59 +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
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
8784a72f0e ISCSICLIENT update the example to use the _task() function for task management 2011-02-27 10:35:49 +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
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
9ddce8dc24 Replace bzero() with memset() 2011-01-03 15:35:36 +11:00
Ronnie Sahlberg
74fadc9337 Add support for R2T PDUs.
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.
2011-01-02 19:27:32 +11:00
Ronnie Sahlberg
098bc5a9a7 Initial import of libiscsi 2010-12-05 08:24:57 +11:00