32 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
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
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
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
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
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
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
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
ae60611f68 AUTOTOOLS: Add Makefile.am for examples/ 2014-03-22 17:46:02 -07:00
Ronnie Sahlberg
1c5d132ed0 convert iscsi-dd to use getopt_long() 2013-04-21 10:02:05 -07: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
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
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
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