68 Commits

Author SHA1 Message Date
Sevan Janiyan
1100aa4aa4 examples/iscsi-dd.c: add HAVE_CLOCK_GETTIME guards
Only show time stats if clock_gettime(3) is available.
It's actually possible to have clock_gettime(3) and not yet support
CLOCK_MONOTONIC on legacy systems, however on macOS, they all arrived
together in macOS 10.12. Rather than add new configure checks for
CLOCK_MONOTONIC, I opted to use the existing HAVE_CLOCK_GETTIME.
2025-07-16 18:49:25 +01:00
Ronnie Sahlberg
7e86ed7962 Add multithreaded example using the async API
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2025-04-26 11:28:57 +10:00
Ronnie Sahlberg
edd7d9b843 Remove the small allocations
This is not compatible with multithreading and would require a complete
re-design.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2025-04-26 08:56:16 +10:00
Ronnie Sahlberg
ca0df22ede Add iscsi-pthreads-readloop
This is a tool to create multiple contexts and threads and run read operations on all
of them in a loop.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2025-04-26 08:56:16 +10:00
Ronnie Sahlberg
3c48aea225 Add initial multithreading support and example
This is the basic support for doing i/o in a separate worker thread.
It is still not threads safe but a start.
Now we need to protect all variables such as outqueue, waitpdu
and friends.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2025-04-26 08:56:16 +10:00
sallyjunjun
8592dc5883 Update iscsi-dd.c
add check after malloc to avoid referencing an illegal pointer
2022-05-31 15:12:49 -07:00
Simon Rowe
35dcf89599 examples/iscsi-dd: use stderr for all error text
Signed-off-by: Simon Rowe <simon.rowe@nutanix.com>
2021-09-05 20:00:02 -07:00
Simon Rowe
b3a30d995e examples/iscsi-dd: fix typos
Signed-off-by: Simon Rowe <simon.rowe@nutanix.com>
2021-09-05 20:00:02 -07:00
Bart Van Assche
5e6f6ec5ed MinGW: Second step of porting to MinGW 2021-07-18 20:13:03 -07:00
Bart Van Assche
2a5a0b3291 Enable -Wno-unused-parameter
Instead of adding __attribute__((unused)) to unused arguments, add the
-Wno-unused-parameter compiler flag.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2021-05-23 13:23:41 -07:00
Bart Van Assche
ea6b2282d4 Use __attribute__((format(printf, ...))) directly
Instead of defining the macro _R_(), define __attribute__() as a macro for
compilers that do not support __attribute__(), namely Microsoft Visual
Studio.

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
2021-05-23 11:52:40 -07:00
orbea
c437afa825 build: Add -no-undefined where missing
Signed-off-by: orbea <orbea@riseup.net>
2021-05-22 19:32:12 -07:00
orbea
c547d2dc7f build: Remove bogus LDADD variables
Signed-off-by: orbea <orbea@riseup.net>
2021-05-22 19:31:50 -07:00
David Disseldorp
37e6e112b6 examples/iscsi-dd: use common init function for src and dst endpoints
Remove a bunch of duplicate code by sharing a function for source and
destination endpoint initialization.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2020-08-10 01:18:06 +02:00
David Disseldorp
eb4c8e20ff examples/iscsi-dd: use common iscsi_endpoint struct
Signed-off-by: David Disseldorp <ddiss@suse.de>
2020-08-10 00:35:28 +02:00
David Disseldorp
8ae813bae9 examples/iscsi-dd: check for clock_gettime() errors
Only dump performance details if we have valid start and end times.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2020-03-04 15:49:20 +01:00
David Disseldorp
829c6351ed examples/iscsi-dd: measure throughput
Measure the elapsed time across the copy loop and print the throughput
[bKMGT]/second.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2020-02-21 19:00:02 +01:00
David Disseldorp
53471e6215 examples/iscsi-dd: print basic usage information
Add additional -h/--help parameters.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2020-02-21 18:58:12 +01:00
Ronnie Sahlberg
e6bcdf5fdb drop the LD_PRELOAD tool
I don't have time to maintain it. And it is just a toy anyway.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2020-02-12 15:21:03 +10:00
David Disseldorp
d7530757df examples: don't assume NOP-In data is zero terminated
Signed-off-by: David Disseldorp <ddiss@suse.de>
2018-10-25 23:38:59 +02:00
Bart Van Assche
3cd40965a0 libiscsi: Port to gcc 7
Avoid that building with gcc 7 fails as follows:

iscsi-dd.c: In function 'cscd_ident_inq':
iscsi-dd.c:405:8: error: this statement may fall through [-Werror=implicit-fallthrough=]
     if (prev_type <= desig->designator_type) {
        ^
iscsi-dd.c:409:4: note: here
    default:
    ^~~~~~~
cc1: all warnings being treated as errors

Signed-off-by: Bart Van Assche <bart.vanassche@wdc.com>
2018-03-02 14:02:18 -08:00
Andrei Vagin
07d03d5046 examples/iscsi-dd: parse the -x option
Signed-off-by: Andrei Vagin <avagin@openvz.org>
2017-12-15 03:45:00 +03:00
Tim Crawford
aba0f7da1a Replace WIN32 with _WIN32
Using WIN32 depends on the build environment defining the variable.
_WIN32 is a predefined MSVC macro and is always available.

Signed-off-by: Tim Crawford <crawfxrd@gmail.com>
2017-11-29 10:07:44 -05:00
David Disseldorp
30a49f97cb examples/dd: split out duplicate read capacity code
Use a helper function, rather than having duplicate source and
destination READ CAPACITY logic.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2017-01-04 19:33:00 +01:00
David Disseldorp
aaeb2dd5a5 examples/dd: add XCOPY support
EXTENDED COPY can be triggered with the new --xcopy/-x parameter. When
invoked, (--max) EXTENDED COPY requests are dispatched in parallel, with
each request attempting to copy (--blocks) from source to destination.

Signed-off-by: David Disseldorp <ddiss@suse.de>
2017-01-04 19:33:00 +01:00
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