debian/0000755000000000000000000000000011753277733007205 5ustar debian/changelog0000644000000000000000000000231711753277374011063 0ustar libiscsi (1.4.0-3) unstable; urgency=low * patches/always-export-iscsi_set_tcp_keepalive.patch: always define and export the function, even on platform that does not support some or all TCP socket options. (Closes: #672529) * patches/export-only-required-symbols.patch: create a list of symbols which needs to be exported, and use it with libtool. * remove unnecessary symbols from debian/symbols and rename it to debian/libiscsi1.symbols. * simplify/cleanup debian/rules, and explicitly use dpkg-architecture -qDEB_HOST_MULTIARCH * add debian/.gitignore -- Michael Tokarev Sat, 12 May 2012 00:24:43 +0400 libiscsi (1.4.0-2) unstable; urgency=low * introduce debian/symbols file to track which symbols introduced when -- Michael Tokarev Fri, 11 May 2012 14:56:43 +0400 libiscsi (1.4.0-1) unstable; urgency=low * new upstream version * build-depend on debhelper > 9~ * update Standards-Version to 3.9.3 (no changes needed) -- Michael Tokarev Fri, 04 May 2012 12:05:48 +0400 libiscsi (1.0.1-1) unstable; urgency=low * Initial release. (Closes: #653055) -- Michael Tokarev Fri, 23 Dec 2011 13:47:46 +0400 debian/libiscsi1.install0000644000000000000000000000003011753144756012446 0ustar usr/lib/*/libiscsi.so.* debian/control0000644000000000000000000000355611753167030010605 0ustar Source: libiscsi Section: net Priority: optional Maintainer: Michael Tokarev Build-Depends: debhelper (>= 9~), dh-autoreconf, libpopt-dev Standards-Version: 3.9.3 Homepage: https://github.com/sahlberg/libiscsi Package: libiscsi1 Section: libs Architecture: any Multi-Arch: same Pre-Depends: ${misc:Pre-Depends} Depends: ${shlibs:Depends}, ${misc:Depends} Description: iSCSI client shared library Libiscsi is a clientside library to implement the iSCSI protocol that can be used to access resource of an iSCSI Target. . The library is fully async with regards to iscsi commands and scsi tasks, but a sync layer is also provided for ease of use for simpler applications. . This package contains the library itself. Package: libiscsi-dev Section: libdevel Architecture: any Depends: libiscsi1 (= ${binary:Version}), ${misc:Depends} Description: iSCSI client shared library Libiscsi is a clientside library to implement the iSCSI protocol that can be used to access resource of an iSCSI Target. . The library is fully async with regards to iscsi commands and scsi tasks, but a sync layer is also provided for ease of use for simpler applications. . This package contains the header files, static library and other files needed to compile applications which uses libiscsi. Package: libiscsi-bin Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends} Description: iSCSI client shared library - utilities Libiscsi is a clientside library to implement the iSCSI protocol that can be used to access resource of an iSCSI Target. . The library is fully async with regards to iscsi commands and scsi tasks, but a sync layer is also provided for ease of use for simpler applications. . This package contains a set of useful iscsi utilities such as logging in to and enumerating all targets on a portal and all devices of a target, all built on top of libiscsi. debian/source/0000755000000000000000000000000011753167030010471 5ustar debian/source/format0000644000000000000000000000001411753144756011711 0ustar 3.0 (quilt) debian/source/options0000644000000000000000000000012511753167030012105 0ustar # ignore changes in m4/ directory since dh may touch these --extend-diff-ignore=^m4/ debian/compat0000644000000000000000000000000211753144756010401 0ustar 9 debian/copyright0000644000000000000000000000415311753144756011141 0ustar Format: http://dep.debian.net/deps/dep5 Upstream-Name: libiscsi Source: https://github.com/sahlberg/libiscsi Files: * Copyright: 2010-2011 Ronnie Sahlberg License: GPL-2+ Files: lib/* include/* Copyright: 2010-2011 Ronnie Sahlberg License: LGPL-2.1+ Files: src/* examples/* Copyright: 2010-2011 Ronnie Sahlberg License: GPL-2+ Files: debian/* Copyright: 2011 Michael Tokarev License: GPL-2+ License: GPL-2+ This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. License: LGPL-2.1+ This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. . This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. . You should have received a copy of the GNU Lesser General Public License along with this library; if not, see . . On Debian systems, the complete text of the GNU Lesser General Public License can be found in "/usr/share/common-licenses/LGPL-2.1". debian/libiscsi1.symbols0000644000000000000000000000741311753277356012507 0ustar libiscsi.so.1 libiscsi1 #MINVER# iscsi_connect_async@Base 1.0 iscsi_connect_sync@Base 1.0 iscsi_create_context@Base 1.0 iscsi_destroy_context@Base 1.0 iscsi_destroy_url@Base 1.0 iscsi_disconnect@Base 1.0 iscsi_discovery_async@Base 1.0 iscsi_full_connect_async@Base 1.0 iscsi_full_connect_sync@Base 1.0 iscsi_get_error@Base 1.0 iscsi_get_fd@Base 1.0 iscsi_get_target_address@Base 1.0 iscsi_inquiry_sync@Base 1.0 iscsi_inquiry_task@Base 1.0 iscsi_is_logged_in@Base 1.0 iscsi_login_async@Base 1.0 iscsi_login_sync@Base 1.0 iscsi_logout_async@Base 1.0 iscsi_logout_sync@Base 1.0 iscsi_modesense6_task@Base 1.0 iscsi_nop_out_async@Base 1.0 iscsi_parse_full_url@Base 1.0 iscsi_parse_portal_url@Base 1.0 iscsi_queue_length@Base 1.0 iscsi_prefetch10_sync@Base 1.4 iscsi_prefetch10_task@Base 1.4 iscsi_prefetch16_sync@Base 1.4 iscsi_prefetch16_task@Base 1.4 iscsi_read10_sync@Base 1.0 iscsi_read10_task@Base 1.0 iscsi_read12_sync@Base 1.4 iscsi_read12_task@Base 1.4 iscsi_read16_sync@Base 1.4 iscsi_read16_task@Base 1.4 iscsi_read6_sync@Base 1.0 iscsi_read6_task@Base 1.0 iscsi_readcapacity10_sync@Base 1.0 iscsi_readcapacity10_task@Base 1.0 iscsi_readcapacity16_sync@Base 1.4 iscsi_readcapacity16_task@Base 1.4 iscsi_reconnect@Base 1.4 iscsi_reportluns_sync@Base 1.0 iscsi_reportluns_task@Base 1.0 iscsi_scsi_cancel_all_tasks@Base 1.4 iscsi_scsi_command_async@Base 1.0 iscsi_scsi_command_sync@Base 1.0 iscsi_scsi_task_cancel@Base 1.0 iscsi_service@Base 1.0 iscsi_set_alias@Base 1.0 iscsi_set_header_digest@Base 1.0 iscsi_set_initiator_username_pwd@Base 1.0 iscsi_set_isid_en@Base 1.0 iscsi_set_isid_oui@Base 1.0 iscsi_set_isid_random@Base 1.0 iscsi_set_isid_reserved@Base 1.0 iscsi_set_session_type@Base 1.0 iscsi_set_targetname@Base 1.0 iscsi_set_tcp_keepalive@Base 1.0 iscsi_synchronizecache10_sync@Base 1.0 iscsi_synchronizecache10_task@Base 1.0 iscsi_task_mgmt_abort_task_async@Base 1.0 iscsi_task_mgmt_abort_task_set_async@Base 1.0 iscsi_task_mgmt_async@Base 1.0 iscsi_task_mgmt_lun_reset_async@Base 1.0 iscsi_task_mgmt_target_cold_reset_async@Base 1.0 iscsi_task_mgmt_target_warm_reset_async@Base 1.0 iscsi_testunitready_sync@Base 1.0 iscsi_testunitready_task@Base 1.0 iscsi_unmap_sync@Base 1.4 iscsi_unmap_task@Base 1.4 iscsi_verify10_sync@Base 1.4 iscsi_verify10_task@Base 1.4 iscsi_which_events@Base 1.0 iscsi_write10_sync@Base 1.0 iscsi_write10_task@Base 1.0 iscsi_write12_sync@Base 1.4 iscsi_write12_task@Base 1.4 iscsi_write16_sync@Base 1.4 iscsi_write16_task@Base 1.4 iscsi_writesame10_sync@Base 1.4 iscsi_writesame10_task@Base 1.4 iscsi_writesame16_sync@Base 1.4 iscsi_writesame16_task@Base 1.4 scsi_association_to_str@Base 1.0 scsi_cdb_inquiry@Base 1.0 scsi_cdb_modesense6@Base 1.0 scsi_cdb_prefetch10@Base 1.4 scsi_cdb_prefetch16@Base 1.4 scsi_cdb_read10@Base 1.0 scsi_cdb_read12@Base 1.4 scsi_cdb_read16@Base 1.4 scsi_cdb_read6@Base 1.0 scsi_cdb_readcapacity10@Base 1.0 scsi_cdb_readcapacity16@Base 1.4 scsi_cdb_serviceactionin16@Base 1.4 scsi_cdb_synchronizecache10@Base 1.0 scsi_cdb_testunitready@Base 1.0 scsi_cdb_unmap@Base 1.4 scsi_cdb_verify10@Base 1.4 scsi_cdb_write10@Base 1.0 scsi_cdb_write12@Base 1.4 scsi_cdb_write16@Base 1.4 scsi_cdb_writesame10@Base 1.4 scsi_cdb_writesame16@Base 1.4 scsi_codeset_to_str@Base 1.0 scsi_datain_getfullsize@Base 1.0 scsi_datain_unmarshall@Base 1.0 scsi_designator_type_to_str@Base 1.0 scsi_devqualifier_to_str@Base 1.0 scsi_devtype_to_str@Base 1.0 scsi_free_scsi_task@Base 1.0 scsi_get_task_private_ptr@Base 1.0 scsi_inquiry_pagecode_to_str@Base 1.0 scsi_protocol_identifier_to_str@Base 1.0 scsi_reportluns_cdb@Base 1.0 scsi_sense_ascq_str@Base 1.0 scsi_sense_key_str@Base 1.0 scsi_set_task_private_ptr@Base 1.0 scsi_task_add_data_in_buffer@Base 1.0 scsi_version_to_str@Base 1.0 debian/patches/0000755000000000000000000000000011753277356010635 5ustar debian/patches/series0000644000000000000000000000011711753277356012051 0ustar always-export-iscsi_set_tcp_keepalive.patch export-only-required-symbols.patch debian/patches/export-only-required-symbols.patch0000644000000000000000000000707511753277356017473 0ustar commit 0b7e2785396ede9165470614848b6a97c6e6eaae Author: Michael Tokarev Date: Sat May 12 00:22:04 2012 +0400 export only required symbols, do not export internal symbols from the library Signed-off-by: Michael Tokarev diff --git a/Makefile.am b/Makefile.am index c6b4844..532b046 100644 --- a/Makefile.am +++ b/Makefile.am @@ -30,7 +30,8 @@ lib_libiscsi_la_SOURCES = \ SONAME=$(firstword $(subst ., ,$(VERSION))) SOREL=$(shell printf "%d%02d%02d" $(subst ., ,$(VERSION))) lib_libiscsi_la_LDFLAGS = \ - -version-info $(SONAME):$(SOREL):0 -bindir $(bindir) -no-undefined + -version-info $(SONAME):$(SOREL):0 -bindir $(bindir) -no-undefined \ + -export-symbols lib/libiscsi.syms # libiscsi utilities diff --git a/lib/libiscsi.syms b/lib/libiscsi.syms new file mode 100644 index 0000000..d4cece1 --- /dev/null +++ b/lib/libiscsi.syms @@ -0,0 +1,120 @@ +iscsi_connect_async +iscsi_connect_sync +iscsi_create_context +iscsi_destroy_context +iscsi_destroy_url +iscsi_disconnect +iscsi_discovery_async +iscsi_full_connect_async +iscsi_full_connect_sync +iscsi_get_error +iscsi_get_fd +iscsi_get_target_address +iscsi_inquiry_sync +iscsi_inquiry_task +iscsi_is_logged_in +iscsi_login_async +iscsi_login_sync +iscsi_logout_async +iscsi_logout_sync +iscsi_modesense6_task +iscsi_nop_out_async +iscsi_parse_full_url +iscsi_parse_portal_url +iscsi_prefetch10_sync +iscsi_prefetch10_task +iscsi_prefetch16_sync +iscsi_prefetch16_task +iscsi_queue_length +iscsi_read10_sync +iscsi_read10_task +iscsi_read12_sync +iscsi_read12_task +iscsi_read16_sync +iscsi_read16_task +iscsi_read6_sync +iscsi_read6_task +iscsi_readcapacity10_sync +iscsi_readcapacity10_task +iscsi_readcapacity16_sync +iscsi_readcapacity16_task +iscsi_reconnect +iscsi_reportluns_sync +iscsi_reportluns_task +iscsi_scsi_cancel_all_tasks +iscsi_scsi_command_async +iscsi_scsi_command_sync +iscsi_scsi_task_cancel +iscsi_service +iscsi_set_alias +iscsi_set_header_digest +iscsi_set_initiator_username_pwd +iscsi_set_isid_en +iscsi_set_isid_oui +iscsi_set_isid_random +iscsi_set_isid_reserved +iscsi_set_session_type +iscsi_set_targetname +iscsi_set_tcp_keepalive +iscsi_synchronizecache10_sync +iscsi_synchronizecache10_task +iscsi_task_mgmt_abort_task_async +iscsi_task_mgmt_abort_task_set_async +iscsi_task_mgmt_async +iscsi_task_mgmt_lun_reset_async +iscsi_task_mgmt_target_cold_reset_async +iscsi_task_mgmt_target_warm_reset_async +iscsi_testunitready_sync +iscsi_testunitready_task +iscsi_unmap_sync +iscsi_unmap_task +iscsi_verify10_sync +iscsi_verify10_task +iscsi_which_events +iscsi_write10_sync +iscsi_write10_task +iscsi_write12_sync +iscsi_write12_task +iscsi_write16_sync +iscsi_write16_task +iscsi_writesame10_sync +iscsi_writesame10_task +iscsi_writesame16_sync +iscsi_writesame16_task +scsi_association_to_str +scsi_cdb_inquiry +scsi_cdb_modesense6 +scsi_cdb_prefetch10 +scsi_cdb_prefetch16 +scsi_cdb_read10 +scsi_cdb_read12 +scsi_cdb_read16 +scsi_cdb_read6 +scsi_cdb_readcapacity10 +scsi_cdb_readcapacity16 +scsi_cdb_serviceactionin16 +scsi_cdb_synchronizecache10 +scsi_cdb_testunitready +scsi_cdb_unmap +scsi_cdb_verify10 +scsi_cdb_write10 +scsi_cdb_write12 +scsi_cdb_write16 +scsi_cdb_writesame10 +scsi_cdb_writesame16 +scsi_codeset_to_str +scsi_datain_getfullsize +scsi_datain_unmarshall +scsi_designator_type_to_str +scsi_devqualifier_to_str +scsi_devtype_to_str +scsi_free_scsi_task +scsi_get_task_private_ptr +scsi_inquiry_pagecode_to_str +scsi_protocol_identifier_to_str +scsi_reportluns_cdb +scsi_sense_ascq_str +scsi_sense_key_str +scsi_set_task_private_ptr +scsi_task_add_data_in_buffer +scsi_version_to_str debian/patches/always-export-iscsi_set_tcp_keepalive.patch0000644000000000000000000000707211753277356021361 0ustar commit f96bcc98166f15c308a9460519fc5b9d167baed7 Author: Michael Tokarev Date: Sat May 12 00:15:04 2012 +0400 always export iscsi_set_tcp_keepalive() Set only the (socket) options which are defined on a given platform. The function becomes a no-op if no option is known at complie time. Remove autoconf test for HAVE_TCP_KEEPALIVE too. Signed-off-by: Michael Tokarev diff --git a/configure.ac b/configure.ac index f971597..bb95018 100644 --- a/configure.ac +++ b/configure.ac @@ -38,16 +38,6 @@ if test x"$libiscsi_cv_HAVE_SOCK_SIN_LEN" = x"yes"; then AC_DEFINE(HAVE_SOCK_SIN_LEN,1,[Whether the sockaddr_in struct has a sin_len property]) fi -AC_CACHE_CHECK([for tcp keepalive],libiscsi_cv_HAVE_TCP_KEEPALIVE,[ -AC_TRY_COMPILE([#include -#include -#include ], -[int foo = TCP_KEEPCNT + TCP_KEEPIDLE + TCP_KEEPINTVL], -libiscsi_cv_HAVE_TCP_KEEPALIVE=yes,libiscsi_cv_HAVE_TCP_KEEPALIVE=no)]) -if test x"$libiscsi_cv_HAVE_TCP_KEEPALIVE" = x"yes"; then - AC_DEFINE(HAVE_TCP_KEEPALIVE,1,[Whether we have support for tcp keepalive socket options]) -fi - AC_CACHE_CHECK([for sys filio.h],libiscsi_cv_NEED_SYS_FILIO_H,[ AC_TRY_COMPILE([#include #include ], diff --git a/include/iscsi.h b/include/iscsi.h index f05919f..96af979 100644 --- a/include/iscsi.h +++ b/include/iscsi.h @@ -61,8 +61,8 @@ EXTERN int iscsi_service(struct iscsi_context *iscsi, int revents); EXTERN int iscsi_queue_length(struct iscsi_context *iscsi); /* - * To set tcp keepalive for the session - * ONLY available on platforms with tcp keepalive socket options + * To set tcp keepalive for the session. + * Only options supported by given platform (if any) are set. */ int iscsi_set_tcp_keepalive(struct iscsi_context *iscsi, int idle, int count, int interval); diff --git a/lib/socket.c b/lib/socket.c index c88cdfb..37ef103 100644 --- a/lib/socket.c +++ b/lib/socket.c @@ -452,9 +452,7 @@ iscsi_service(struct iscsi_context *iscsi, int revents) return -1; } -#ifdef HAVE_TCP_KEEPALIVE iscsi_set_tcp_keepalive(iscsi, 30, 3, 30); -#endif iscsi->is_connected = 1; iscsi->socket_status_cb(iscsi, SCSI_STATUS_GOOD, NULL, iscsi->connect_data); @@ -532,39 +530,42 @@ iscsi_free_iscsi_inqueue(struct iscsi_in_pdu *inqueue) } } -#ifdef HAVE_TCP_KEEPALIVE int iscsi_set_tcp_keepalive(struct iscsi_context *iscsi, int idle, int count, int interval) { int value; +#ifdef SO_KEEPALIVE value =1; if (setsockopt(iscsi->fd, SOL_SOCKET, SO_KEEPALIVE, &value, sizeof(value)) != 0) { iscsi_set_error(iscsi, "TCP: Failed to set socket option SO_KEEPALIVE. Error %s(%d)", strerror(errno), errno); return -1; } - +#endif +#ifdef TCP_KEEPCNT value = count; if (setsockopt(iscsi->fd, SOL_TCP, TCP_KEEPCNT, &value, sizeof(value)) != 0) { iscsi_set_error(iscsi, "TCP: Failed to set tcp keepalive count. Error %s(%d)", strerror(errno), errno); return -1; } - +#endif +#ifdef TCP_KEEPINTVL value = interval; if (setsockopt(iscsi->fd, SOL_TCP, TCP_KEEPINTVL, &value, sizeof(value)) != 0) { iscsi_set_error(iscsi, "TCP: Failed to set tcp keepalive interval. Error %s(%d)", strerror(errno), errno); return -1; } - +#endif +#ifdef TCP_KEEPIDLE value = idle; if (setsockopt(iscsi->fd, SOL_TCP, TCP_KEEPIDLE, &value, sizeof(value)) != 0) { iscsi_set_error(iscsi, "TCP: Failed to set tcp keepalive idle. Error %s(%d)", strerror(errno), errno); return -1; } +#endif return 0; } -#endif #if defined(WIN32) int poll(struct pollfd *fds, int nfsd, int timeout) { debian/libiscsi-dev.install0000644000000000000000000000007111753144756013146 0ustar usr/include/* usr/lib/*/libiscsi.a usr/lib/*/libiscsi.so debian/rules0000755000000000000000000000030211753277356010261 0ustar #!/usr/bin/make -f DEB_HOST_MULTIARCH = $(shell dpkg-architecture -qDEB_HOST_MULTIARCH) DEB_CONFIGURE_EXTRA_FLAGS += --libdir=\$${prefix}/lib/$(DEB_HOST_MULTIARCH) %: dh $@ --with autoreconf debian/libiscsi-bin.install0000644000000000000000000000030411753144756013137 0ustar # do not use ld_iscsi.so (which is built on linux) for now, # to avoid complications with multilib. Note that this # shared object is put to /usr/bin by upstream, which is wrong. usr/bin/iscsi-*