Commit Graph

59 Commits

Author SHA1 Message Date
Ronnie Sahlberg
c0d1c122c3 ISCSI-LS : Change from popt to the slightly less portable getopt_long
win32 and amiga/aros does not have getopt_long() so we will need a
replacement for the platforms where getopt_long() is missing.
2013-04-21 09:44:23 -07:00
Ronnie Sahlberg
402653b9f3 portability updates
add check if ipv6/sockaddr_in6 is availavble or not
add check for poll.h and only include when available
add includes for AROS
2013-04-18 19:43:36 -07:00
Ronnie Sahlberg
b1da7311c4 change u_int to uint 2012-11-29 19:14:26 -08:00
Bernhard Kohl
219533dc7b Returned buffers from poptGetArgs() are free()ed in poptFreeContext()
Calling "free(url);" causes a core dump in glibc-2.15.

Signed-off-by: Bernhard Kohl <bernhard.kohl@gmx.net>
2012-11-18 14:12:30 -08:00
Ronnie Sahlberg
9eb26a368d Fix compiler warnings related to 'const' 2012-11-11 10:03:45 -08:00
Peter Lieven
8512f19911 ISCSI-READCAPACITY16 fix missing free of scsi_task 2012-11-11 08:32:05 -08:00
Peter Lieven
864a4d60a0 LD_ISCSI invalidate get_lba_status cache on write 2012-11-11 08:17:27 -08:00
Peter Lieven
f331556d65 LD_ISCSI add pwrite and dlsym it at init 2012-11-11 08:15:51 -08:00
Peter Lieven
bd04f4bfa6 LD_ISCSI add pwite 2012-11-11 08:15:26 -08:00
Peter Lieven
6884b6eb75 LD_ISCSI add write
the write command is limited in the sense that file offset and
count bytes must be multiple of the targets blocksize. for most
copy/dd etc. operations this is sufficient to work.
2012-11-11 08:14:38 -08:00
Peter Lieven
bf758c7833 LD_ISCSI add pread 2012-11-11 08:14:10 -08:00
Peter Lieven
59860df16a LD_ISCSI add lseek 2012-11-11 08:13:47 -08:00
Peter Lieven
01cd2ee42b LD_ISCSI fix segfault on reconnect
iscsi_reconnect calls dup2 which is intercepted in ld_iscsi. Fix this by
calling the real dup2 in this case.
2012-11-11 08:13:03 -08:00
Ronnie Sahlberg
50e7c682bb Add a logging subsystem and change all DPRINTF to ISCSI_LOG
Add a mechanism where we can set a logging subsystem that libiscsi can use.
Create an example 'log to stderr' that utilities can use for convenience.
2012-11-07 06:34:38 -08:00
Peter Lieven
83ac22abbb Fix memleaks in iscsi-ls, iscsi-inq & iscsi-readcapacity16 2012-10-27 16:18:50 +02:00
Peter Lieven
2df2f4f12e ISCSI_READCAPACITY16 add switch to print only target size 2012-10-26 08:39:37 +02:00
Ronnie Sahlberg
1132e4f941 ISCSI_READCAPACITY16 : Update the output to show all fields in the returned data
not just the total size of the device.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-10-25 19:24:09 -07:00
Peter Lieven
2427926327 ISCSI-READCAPACITY16 modified copyright notice 2012-10-23 17:17:53 +02:00
Peter Lieven
fec061ac68 Add iscsi-readcapacity16 binary
This patch adds a small binary to read the size of an iscsi target. The value
is returned on stdout.
2012-10-23 15:59:28 +02:00
Peter Lieven
56b1e27980 LD_ISCSI fix whitespace 2012-10-23 10:59:07 +02:00
Peter Lieven
afc963c312 LD_ISCSI: cache last result of get_lba_status
get_lba_status returns provisioning for a range of blocks starting
from given lba. Especially for sequential reads its likely that
the next block read is already covered by the last result.

In case there is write support added to ld_iscsi there needs
to be an invalidation code for the cache.
2012-10-21 20:29:39 +02:00
Peter Lieven
bfac1f85a3 LD_SCSI: Introduce get_lba_status in read()
For large continous reads I may be benifical to check if the blocks
that are going to be read are allocated. If they are not allocated
they do not need to be read which massivly speeds up the read.

This behaviour is optional and can be turned on with environment
variable LD_ISCSI_GET_LBA_STATUS=1
2012-10-21 09:24:19 +02:00
Peter Lieven
08bfabcd36 LD_ISCSI: Use readcapacity16 instead of readcapacity10
This allows for handling volumes larger than 2TB
2012-10-21 08:35:55 +02:00
Peter Lieven
8a3e312f06 LD_ISCSI: Fail open with O_NONBLOCK
Non-Blocking I/O is supported nowhere in the code. We should fail
until we have support for it.
2012-10-21 08:24:24 +02:00
Peter Lieven
bca635c75d LD_ISCSI: storage file mode for further usage 2012-10-21 08:22:17 +02:00
Peter Lieven
54d8aa0ab6 LD_ISCSI: use read16 instead of read10
Use READ16 to support for large volumes. READ16 takes a 64bit LBA offset instead
of 32bit.
2012-10-21 08:17:40 +02:00
Peter Lieven
86fa62558e LD_ISCSI: add debugging support 2012-10-21 08:13:16 +02:00
Peter Lieven
4cb845477d Add debugging framework
This patch adds a user configurable debug level. For testing
it includes connection info and reporting errors.
2012-10-18 10:36:26 +02:00
Jon Grimm
365f6ddf10 ld_iscsi: add xstat64, lxstat64, fsxstat64, open64 2012-09-14 12:41:11 -05:00
Jon Grimm
a434a90d64 ld_iscsi: minor, use value already calculated in 'lba' local var in call to readcapacity 2012-09-14 12:27:37 -05:00
Jon Grimm
74496e36fd ld_iscsi: don't try to read beyond last lba 2012-09-14 12:22:07 -05:00
Jon Grimm
eb90ab98c1 ld_iscsi: return block size for stat and friends 2012-09-14 12:02:05 -05:00
Jon Grimm
60a96e0ebf off by one error for calculating num_blocks 2012-09-14 11:19:09 -05: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
Ronnie Sahlberg
7b3c04a43c Use a better iqn name for ld_iscsi.so 2012-08-17 14:50:40 +10:00
Ronnie Sahlberg
b7f342906f Change to proper default IQN names for the iscsi-ls/-inq utilities
Change the default iqn name for the utilities to
iqn.2007-10.com.github:sahlberg:libiscsi:iscsi-ls/-inq
2012-08-10 10:17:47 +10:00
Ronnie Sahlberg
213918a2f3 LS --SHOW-LUNS Dont treat NOT_READY/MEDIUM_NOT_PRESENT as an error
Detect this sensecode and just print (No media) for that LUN
2012-07-10 16:50:16 +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
d71a9d4f95 Add support for BLOCK LIMITS VPD page
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-04-20 17:57:40 +10:00
Ronnie Sahlberg
422bc32ce8 Add support for INQUIRY LOGICAL_BLOCK_PROVISIONING page
Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-04-19 20:09:14 +10:00
Ronnie Sahlberg
50594830bd Task Management. When we abort a task or a task set, or reset the lun or target
we must also cancel all active tasks.
This will trigger all affected tasks to have their callback invoked with
SCSI_STATUS_CANCELLED
2012-03-10 12:12:47 +11:00
Ronnie Sahlberg
3f44347dae fix compiler warning 2012-03-10 12:09:21 +11:00
Ronnie Sahlberg
ed1d957ec9 fix a compiler warning 2012-03-10 12:02:01 +11:00
Ronnie Sahlberg
c2da7c9680 Update the licence texts 2012-03-05 13:50:10 +11:00
Paolo Bonzini
d1f2f854da ld_iscsi: use constructor attribute
This is cleaner, and libtool otherwise complains.
2011-10-28 15:54:03 +02: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
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
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
827cf9af05 iscsi-ls --show-luns: We need to remember the username/password used
during the initial discovery login so we can use it again when we do
the normal logins to do inquiry/readcapacity for --show-luns
2011-01-03 18:16:40 +11:00