Commit Graph

574 Commits

Author SHA1 Message Date
Ronnie Sahlberg
5a95010b59 Fix some compiler warnings 2012-11-11 10:12:39 -08:00
Ronnie Sahlberg
9eb26a368d Fix compiler warnings related to 'const' 2012-11-11 10:03:45 -08:00
Ronnie Sahlberg
a5b8224f4e Dont include iscsi headers from the scsi implementation in scsi-lowlevel.c 2012-11-11 09:49:49 -08:00
Ronnie Sahlberg
3b05e9996f Move cancel_task and cancel_all_tasks from scsi-lowlevel.c to scsi-command.c
These two functions belong in the iscsi layer, not the scsi layer so move them
out from scsi-lowlevel.c so that we can start turning scsi-lowlevel.c to a pure
scsi layer and remove all dependencies to iscsi from it.
2012-11-11 09:44:11 -08:00
Ronnie Sahlberg
49af416f47 When we cancel a scsi task we don't need to unlink the in_buffers
We dont need to unlink the in-buffers when cancelling a scsi task
since the whole task structure will go away shortly anyway and all
entries in the link will be automatically freed when the task is freed.
2012-11-11 09:35:34 -08:00
Peter Lieven
5722ad7e98 LOGIN change dynamic string allocations to statics 2012-11-11 08:42:06 -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
4de36794f2 Make scsi_allocated_memory private to scsi-lowlevel and remove the ptr pointer
Change the list-head structure for in-task scsi memory allocations to
be private to scsi-lowlevel since is is never accessed from anyehwere else and
it is private to this function.
Remove the pointer to the user data in the list head and replace it with a zero length buffer at the end of the header.

Signed-off-by: Ronnie Sahlberg <ronniesahlberg@gmail.com>
2012-11-11 08:07:26 -08:00
Peter Lieven
a0b9080c6c SCSI half mallocs in scsi_malloc 2012-11-11 08:07:13 -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
Ronnie Sahlberg
c10ae3ae3e New version 1.7.0
- Lots of additional tests.
- ld_iscsi updates and bugfixes.
- Fix a protocol bug where we might send > FirstBurstLength amount of data
  as unsolicited data.
- Tcp keepalive improvements.
- Debugging framework.
- Add support for redirection.
- Fix reconnect bug where we would incorrectly re-queue DATA-OUT PDUs after
  reconnect.
- Add a new iscsi-readcapacity16 command.
- Squelch a huge number of compiler warnings.
2012-11-06 18:40:30 -08:00
Ronnie Sahlberg
d81bcd7b38 Dont print to stderr from _set_error if iscsi is NULL
If iscsi is NULL then just do nothing and dont log to stderr.
Our caller might have closed stderr or worse, re-used fd 2 for something else.
2012-11-06 06:20:11 -08:00
Peter Lieven
bde85a4b57 INIT allow iscsi_context = NULL in iscsi_set_error()
qemu-kvm calls iscsi_parse_url_full() with iscsi = NULL.
In case there is an invalid URL specified qemu-kvm segfaults when
it tries to set iscsi->error_string.

I tried to patch this in qemu-kvm, but the initiator_name is dirived
from the target name so this seemed to be the easier approach.
2012-11-06 06:13:17 -08:00
Ronnie Sahlberg
6c2c583af1 Merge pull request #34 from aredlich/master
Fixes for libiscsi compiler warnings
2012-11-04 15:40:47 -08:00
Arne Redlich
f618d08350 T1030_unsolicited_data_overflow: fix uninitialized variable warning
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-02 21:28:40 +01:00
Arne Redlich
13b1f49fe5 T1031_unsolicited_data_out: fix uninitialised variable warning
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-02 21:23:47 +01:00
Arne Redlich
d2e68d7a25 T0122_read6_invalid: suppress signed/unsigned comparison warnings
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-02 21:16:45 +01:00
Arne Redlich
0bf9b6389c Annotate iscsi_set_error with printf format attribute
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-11-02 21:11:30 +01:00
Arne Redlich
081ae59cdf T0105_read10_invalid: suppress signed/unsigned comparison warnings
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 17:05:47 +01:00
Arne Redlich
5cd48f87ff T0403_inquiry_supported_vpd: fix signed/unsigned comparison warning
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 17:00:46 +01:00
Arne Redlich
b5372272b1 T0422_reserve6_logout: fix compiler warnings
Remove unused labels and mark unused parameter as such.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:54:29 +01:00
Arne Redlich
578bdae3af T0421_reserve6_lun_reset: fix compiler warnings
Remove unused label and mark unused parameter as such.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:53:26 +01:00
Arne Redlich
af33ca36ff T1031_unsolicited_data_out: mark unused parameters as such
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:50:38 +01:00
Arne Redlich
17e8b54759 T1030_unsolicited_data_overflow: remove unused variable
old_first_burst_len is set but never used - remove it. Also replace an
  if (!ptr)
    free(ptr)
with
  free(ptr)

as the check is redundant.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:48:48 +01:00
Arne Redlich
e0555555bb T0430_report_all_supported_ops: fix compiler warnings
* remove unused label
* mark unused parameter
* fix signedness warnings

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:46:01 +01:00
Arne Redlich
ea560255a6 T0424_reserve6_target_reset: fix compiler warnings
Remove unused labels and mark unused parameter as such.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:40:29 +01:00
Arne Redlich
ab411e4401 T0423_reserve6_sessionloss: fix compiler warnings
Remove unused labels and mark unused parameters as such.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:34:11 +01:00
Arne Redlich
d402a337e3 T0420_reserve6_simple: fix compiler warnings
Mark unused parameter as such and remove unused labels.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:32:12 +01:00
Arne Redlich
88341c0a73 T0410_readtoc_basic: fix compiler warnings
Remove unused labels and mark unused parameter as such.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:25:47 +01:00
Arne Redlich
13c253f0dc T0404_inquiry_all_reported_vpd: fix compiler warnings
* mark unused parameter as such
* wrap parens around a bitop
* remove unused labels
* fix error messages

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:20:55 +01:00
Arne Redlich
c195348e4d T0403_inquiry_supported_vpd: fix compiler warnings
Remove unused labels and mark unused parameter as such.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:12:21 +01:00
Arne Redlich
ea20edb513 T0402_inquiry_evpd: fix compiler warnings
Remove unused label and mark unused parameter as such.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 16:06:25 +01:00
Arne Redlich
6819637ddc T0401_inquiry_alloclen: fix compiler warnings
Remove unused variables and mark unused parameter as such.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:59:42 +01:00
Arne Redlich
e991146902 T0241_prefetch10_flags: remove unused variable
Pointed out by gcc: num_blocks is set but unused

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:58:31 +01:00
Arne Redlich
1be5fe1bda T0251_prefetch16_flags: remove unused variable
gcc points out that num_blocks is set but never used

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:55:52 +01:00
Arne Redlich
d983cdfc2c T0161_readcapacity16_alloclen: remove unused variable
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:54:33 +01:00
Arne Redlich
34b25f94c1 0122_read6_invalid.c: add missing include
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:53:08 +01:00
Arne Redlich
45ce1537f2 T0400_inquiry_basic: fix compiler warnings
gcc complains about an unused parameter (mark it as such) and unused labels
(remove 'em).

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:52:11 +01:00
Arne Redlich
311a63c61d T0401_inquiry_alloclen: remove unused label
Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:50:59 +01:00
Arne Redlich
4d27ecae32 test-tool: fix initiatorname and initiatorname2 issues
gcc-4.6.3 warned about this one on several occasions:
  gcc -DHAVE_CONFIG_H -I.  -I. -I./include "-D_U_=__attribute__((unused))" -I./test-tool  -Wall -W -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wwrite-strings -ggdb3 -O0 -MT test-tool/bin_iscsi_test-0000_testunitready_simple.o -MD -MP -MF test-tool/.deps/bin_iscsi_test-0000_testunitready_simple.Tpo -c -o test-tool/bin_iscsi_test-0000_testunitready_simple.o `test -f 'test-tool/0000_testunitready_simple.c' || echo './'`test-tool/0000_testunitready_simple.c
  test-tool/0000_testunitready_simple.c: In function 'T0000_testunitready_simple':
  test-tool/0000_testunitready_simple.c:23:44: warning: declaration of 'initiator' shadows a global declaration [-Wshadow]
  test-tool/iscsi-test.h:20:20: warning: shadowed declaration is here [-Wshadow]

For now the global initiator is renamed to initiatorname1 (and initiator2 is
renamed to initiatorname2, respectively), but ultimately the globals should
probably go away.

While fixing this it also became apparent that initiator-name-2 was parsed
into the "initiator" variable as well.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:32:18 +01:00
Arne Redlich
3af45f5867 testunitready_simple: fix compiler warnings
The compiler complains about an unused label and and unused
variable.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 15:19:55 +01:00
Arne Redlich
558ad00038 iscsi_service_reconnect_if_loggedin: fix compiler warning and make it static
Quoth gcc-4.6.3:
  libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I. -I./include "-D_U_=__attribute__((unused))" -Wall -W -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wwrite-strings -g -O2 -MT lib/socket.lo -MD -MP -MF lib/.deps/socket.Tpo -c lib/socket.c  -fPIC -DPIC -o lib/.libs/socket.o
  lib/socket.c:445:1: warning: 'inline' is not at beginning of declaration [-Wold-style-declaration]

Fix this and make it a static function.
Also remove trailing whitespace from this file while at it.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 14:39:51 +01:00
Arne Redlich
b910efa7c5 iscsi_parse_url: fix spurious compiler warnings
gcc-4.6.3 reports these:
  libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I. -I./include "-D_U_=__attribute__((unused))" -Wall -W -Wshadow -Wstrict-prototypes -Wpointer-arith -Wcast-align -Wwrite-strings -g -O2 -MT lib/init.lo -MD -MP -MF lib/.deps/init.Tpo -c lib/init.c  -fPIC -DPIC -o lib/.libs/init.o
  lib/init.c: In function 'iscsi_parse_url':
  lib/init.c:410:18: warning: 'l' may be used uninitialized in this function [-Wuninitialized]
  lib/init.c:409:10: warning: 'target' may be used uninitialized in this function [-Wuninitialized]

Both warnings appear to be spurious though, as both "target" and "l" are only used if
"full" is set, which implies that these are initialized before.

Signed-off-by: Arne Redlich <arne.redlich@googlemail.com>
2012-10-31 14:34:30 +01:00