diff --git a/0001-Fix-compiler-warning-error-under-gcc7.patch b/0001-Fix-compiler-warning-error-under-gcc7.patch new file mode 100644 index 0000000..99ba46e --- /dev/null +++ b/0001-Fix-compiler-warning-error-under-gcc7.patch @@ -0,0 +1,25 @@ +From: Ronnie Sahlberg +Date: Sat, 3 Jun 2017 11:20:20 -0700 +Subject: [PATCH] Fix compiler warning/error under gcc7 + +Gcc7 complains about falling through from the previous case to the default arm + +Signed-off-by: Ronnie Sahlberg +(cherry picked from commit 854e37aab7d7d2093a0a6620a3257b8f2a1d405c) +--- + test-tool/iscsi-support.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c +index 02367ca..ed00ce7 100644 +--- a/test-tool/iscsi-support.c ++++ b/test-tool/iscsi-support.c +@@ -2930,8 +2930,6 @@ void populate_ident_tgt_desc(unsigned char *buf, struct scsi_device *dev) + tgt_desig = desig; + prev_type = desig->designator_type; + } +- default: +- continue; + } + } + if (tgt_desig == NULL) { diff --git a/0002-Fix-another-compiler-warning.patch b/0002-Fix-another-compiler-warning.patch new file mode 100644 index 0000000..e8aa623 --- /dev/null +++ b/0002-Fix-another-compiler-warning.patch @@ -0,0 +1,43 @@ +From: Ronnie Sahlberg +Date: Sat, 3 Jun 2017 11:33:51 -0700 +Subject: [PATCH] Fix another compiler warning + +We do need a default: arm here as the switch is not supposed to deal with +all possible values for the enum. + +Signed-off-by: Ronnie Sahlberg +(cherry picked from commit fb45f0343e3de45f2bc7516591d36c7466c2184e) +--- + test-tool/iscsi-support.c | 19 +++++++++++-------- + 1 file changed, 11 insertions(+), 8 deletions(-) + +diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c +index ed00ce7..3f860ed 100644 +--- a/test-tool/iscsi-support.c ++++ b/test-tool/iscsi-support.c +@@ -2922,14 +2922,17 @@ void populate_ident_tgt_desc(unsigned char *buf, struct scsi_device *dev) + + for (desig = inq_di->designators; desig; desig = desig->next) { + switch (desig->designator_type) { +- case SCSI_DESIGNATOR_TYPE_VENDOR_SPECIFIC: +- case SCSI_DESIGNATOR_TYPE_T10_VENDORT_ID: +- case SCSI_DESIGNATOR_TYPE_EUI_64: +- case SCSI_DESIGNATOR_TYPE_NAA: +- if (prev_type <= desig->designator_type) { +- tgt_desig = desig; +- prev_type = desig->designator_type; +- } ++ case SCSI_DESIGNATOR_TYPE_VENDOR_SPECIFIC: ++ case SCSI_DESIGNATOR_TYPE_T10_VENDORT_ID: ++ case SCSI_DESIGNATOR_TYPE_EUI_64: ++ case SCSI_DESIGNATOR_TYPE_NAA: ++ if (prev_type <= desig->designator_type) { ++ tgt_desig = desig; ++ prev_type = desig->designator_type; ++ } ++ continue; ++ default: ++ continue; + } + } + if (tgt_desig == NULL) { diff --git a/0003-Fix-32bit-build.patch b/0003-Fix-32bit-build.patch new file mode 100644 index 0000000..7f6d462 --- /dev/null +++ b/0003-Fix-32bit-build.patch @@ -0,0 +1,114 @@ +From: Michal Suchanek +Date: Mon, 14 Nov 2016 17:28:31 +0100 +Subject: [PATCH] Fix 32bit build. + +Signed-off-by: Michal Suchanek +(cherry picked from commit a239423a0f9250dad9998152fa4b4b46accdf641) +--- + lib/iser.c | 7 ++++--- + test-tool/test_compareandwrite_invalid_dataout_size.c | 4 ++-- + test-tool/test_writesame10_invalid_dataout_size.c | 4 ++-- + test-tool/test_writesame16_invalid_dataout_size.c | 4 ++-- + 4 files changed, 10 insertions(+), 9 deletions(-) + +diff --git a/lib/iser.c b/lib/iser.c +index ad3adb3..17832c3 100644 +--- a/lib/iser.c ++++ b/lib/iser.c +@@ -23,6 +23,7 @@ + #include + #include + #include ++#include + #include "iscsi.h" + #include "iser-private.h" + #include "iscsi-private.h" +@@ -524,7 +525,7 @@ iser_prepare_read_cmd(struct iser_conn *iser_conn,struct iser_pdu *iser_pdu) + } + + tx_desc->data_dir = DATA_READ; +- hdr->read_va = htobe64((uint64_t)tx_desc->data_buff); ++ hdr->read_va = htobe64((intptr_t)tx_desc->data_buff); + hdr->read_stag = htobe32((uint32_t)tx_desc->data_mr->rkey); + hdr->flags |= ISER_RSV; + +@@ -565,7 +566,7 @@ iser_prepare_write_cmd(struct iser_conn *iser_conn, struct iser_pdu *iser_pdu) + + hdr->flags |= ISER_WSV; + hdr->write_stag = htobe32((uint32_t)(tx_desc->data_mr->rkey)); +- hdr->write_va = htobe64((uint64_t)(tx_desc->data_buff)); ++ hdr->write_va = htobe64((intptr_t)(tx_desc->data_buff)); + + return 0; + } +@@ -1146,7 +1147,7 @@ static int iser_handle_wc(struct ibv_wc *wc,struct iser_conn *iser_conn) + wc->wr_id, wc->status, wc->vendor_err); + return iscsi_service_reconnect_if_loggedin(iscsi); + } else { +- iscsi_set_error(iscsi, "flush error: wr id %lx\n", wc->wr_id); ++ iscsi_set_error(iscsi, "flush error: wr id %" PRIx64 "\n", wc->wr_id); + + return 0; + } +diff --git a/test-tool/test_compareandwrite_invalid_dataout_size.c b/test-tool/test_compareandwrite_invalid_dataout_size.c +index b27b4f8..76da1e0 100644 +--- a/test-tool/test_compareandwrite_invalid_dataout_size.c ++++ b/test-tool/test_compareandwrite_invalid_dataout_size.c +@@ -64,7 +64,7 @@ test_compareandwrite_invalid_dataout_size(void) + + + logging(LOG_VERBOSE, "Check too small DataOut"); +- logging(LOG_VERBOSE, "COMPAREANDWRITE with DataOut==%ld (4 blocks) " ++ logging(LOG_VERBOSE, "COMPAREANDWRITE with DataOut==%zd (4 blocks) " + "and TL == 1 ", 4 * block_size); + + new_tl = 1; +@@ -74,7 +74,7 @@ test_compareandwrite_invalid_dataout_size(void) + EXPECT_STATUS_GENERIC_BAD); + + logging(LOG_VERBOSE, "Check too large DataOut"); +- logging(LOG_VERBOSE, "COMPAREANDWRITE with DataOut==%ld (4 blocks) " ++ logging(LOG_VERBOSE, "COMPAREANDWRITE with DataOut==%zd (4 blocks) " + "and TL == 3 ", 4 * block_size); + + new_tl = 2; +diff --git a/test-tool/test_writesame10_invalid_dataout_size.c b/test-tool/test_writesame10_invalid_dataout_size.c +index f521908..119d786 100644 +--- a/test-tool/test_writesame10_invalid_dataout_size.c ++++ b/test-tool/test_writesame10_invalid_dataout_size.c +@@ -41,13 +41,13 @@ test_writesame10_invalid_dataout_size(void) + memset(scratch, 0xa6, block_size); + + logging(LOG_VERBOSE, "Check too small DataOut"); +- logging(LOG_VERBOSE, "Unmap with DataOut==%ld (block_size==%ld)", ++ logging(LOG_VERBOSE, "Unmap with DataOut==%zd (block_size==%zd)", + block_size / 2, block_size); + WRITESAME10(sd, 0, block_size / 2, 1, 0, 1, 0, 0, scratch, + EXPECT_STATUS_GENERIC_BAD); + + logging(LOG_VERBOSE, "Check too large DataOut"); +- logging(LOG_VERBOSE, "Unmap with DataOut==%ld (block_size==%ld)", ++ logging(LOG_VERBOSE, "Unmap with DataOut==%zd (block_size==%zd)", + block_size * 2, block_size); + WRITESAME10(sd, 0, block_size * 2, 1, 0, 1, 0, 0, scratch, + EXPECT_STATUS_GENERIC_BAD); +diff --git a/test-tool/test_writesame16_invalid_dataout_size.c b/test-tool/test_writesame16_invalid_dataout_size.c +index 128673f..a2e22bb 100644 +--- a/test-tool/test_writesame16_invalid_dataout_size.c ++++ b/test-tool/test_writesame16_invalid_dataout_size.c +@@ -41,13 +41,13 @@ test_writesame16_invalid_dataout_size(void) + memset(scratch, 0xa6, block_size); + + logging(LOG_VERBOSE, "Check too small DataOut"); +- logging(LOG_VERBOSE, "Unmap with DataOut==%ld (block_size==%ld)", ++ logging(LOG_VERBOSE, "Unmap with DataOut==%zd (block_size==%zd)", + block_size / 2, block_size); + WRITESAME16(sd, 0, block_size / 2, 1, 0, 1, 0, 0, scratch, + EXPECT_STATUS_GENERIC_BAD); + + logging(LOG_VERBOSE, "Check too large DataOut"); +- logging(LOG_VERBOSE, "Unmap with DataOut==%ld (block_size==%ld)", ++ logging(LOG_VERBOSE, "Unmap with DataOut==%zd (block_size==%zd)", + block_size * 2, block_size); + WRITESAME16(sd, 0, block_size * 2, 1, 0, 1, 0, 0, scratch, + EXPECT_STATUS_GENERIC_BAD); diff --git a/0004-iser-Use-local-container_of-definition.patch b/0004-iser-Use-local-container_of-definition.patch new file mode 100644 index 0000000..cbf14ae --- /dev/null +++ b/0004-iser-Use-local-container_of-definition.patch @@ -0,0 +1,42 @@ +From: Cole Robinson +Date: Mon, 30 Apr 2018 18:11:05 -0400 +Subject: [PATCH] iser: Use local container_of definition + +The code was implicitly dependent on container_of from +inifiniband/verbs.h, however that's been removed in rdma-core +latest release: + +https://github.com/linux-rdma/rdma-core/commit/ce0274acffc78ed2861a56bdc34cdd3d60c20e1f + +Define container_of locally if it's not already defined + +(cherry picked from commit f1feb218e2823d236569f0ca3cfad07334f2a304) +--- + lib/iser.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/lib/iser.c b/lib/iser.c +index 17832c3..aa7244c 100644 +--- a/lib/iser.c ++++ b/lib/iser.c +@@ -32,6 +32,20 @@ + #include + #include + ++ ++#ifndef container_of ++/** ++ * container_of - cast a member of a structure out to the containing structure ++ * @ptr: the pointer to the member. ++ * @type: the type of the container struct this is embedded in. ++ * @member: the name of the member within the struct. ++ * ++ */ ++#define container_of(ptr, type, member) \ ++ ((type *) ((uint8_t *)(ptr) - offsetof(type, member))) ++#endif ++ ++ + #ifdef __linux + + static int cq_handle(struct iser_conn *iser_conn); diff --git a/container_of.patch b/container_of.patch deleted file mode 100644 index 145fa1e..0000000 --- a/container_of.patch +++ /dev/null @@ -1,25 +0,0 @@ -Binary files libiscsi-1.18.0/.git/index and new/.git/index differ -diff -rup libiscsi-1.18.0/lib/iser.c new/lib/iser.c ---- libiscsi-1.18.0/lib/iser.c 2018-04-26 09:51:53.869133618 -0400 -+++ new/lib/iser.c 2018-04-26 10:03:45.163899456 -0400 -@@ -32,6 +32,20 @@ - #include - #include - -+ -+#ifndef container_of -+/** -+ * container_of - cast a member of a structure out to the containing structure -+ * @ptr: the pointer to the member. -+ * @type: the type of the container struct this is embedded in. -+ * @member: the name of the member within the struct. -+ * -+ */ -+#define container_of(ptr, type, member) \ -+ ((type *) ((uint8_t *)(ptr) - offsetof(type, member))) -+#endif -+ -+ - #ifdef __linux - - static int cq_handle(struct iser_conn *iser_conn); diff --git a/disable-ld_iscsi.patch b/disable-ld_iscsi.patch deleted file mode 100644 index 36a5485..0000000 --- a/disable-ld_iscsi.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/configure.ac b/configure.ac -index e1d01c6..72a5019 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -118,7 +118,7 @@ - fi - AM_CONDITIONAL(ISCSITEST, [test "$ac_cv_have_cunit" = yes -a "$enable_shared" = "yes"]) - --AM_CONDITIONAL(LD_ISCSI, [expr "(" "$host_os" : "linux" ")" "&" "$enable_shared" "=" "yes"]) -+AM_CONDITIONAL(LD_ISCSI, [false]) - - AC_CHECK_MEMBER([struct CU_SuiteInfo.pSetUpFunc], - [AC_DEFINE([HAVE_CU_SUITEINFO_PSETUPFUNC], 1, diff --git a/fix-32bit-build.patch b/fix-32bit-build.patch deleted file mode 100644 index b49c650..0000000 --- a/fix-32bit-build.patch +++ /dev/null @@ -1,117 +0,0 @@ -From a239423a0f9250dad9998152fa4b4b46accdf641 Mon Sep 17 00:00:00 2001 -From: Michal Suchanek -Date: Mon, 14 Nov 2016 17:28:31 +0100 -Subject: [PATCH] Fix 32bit build. - -Signed-off-by: Michal Suchanek ---- - lib/iser.c | 7 ++++--- - test-tool/test_compareandwrite_invalid_dataout_size.c | 4 ++-- - test-tool/test_writesame10_invalid_dataout_size.c | 4 ++-- - test-tool/test_writesame16_invalid_dataout_size.c | 4 ++-- - 4 files changed, 10 insertions(+), 9 deletions(-) - -diff --git a/lib/iser.c b/lib/iser.c -index ad3adb3..17832c3 100644 ---- a/lib/iser.c -+++ b/lib/iser.c -@@ -23,6 +23,7 @@ - #include - #include - #include -+#include - #include "iscsi.h" - #include "iser-private.h" - #include "iscsi-private.h" -@@ -524,7 +525,7 @@ iser_prepare_read_cmd(struct iser_conn *iser_conn,struct iser_pdu *iser_pdu) - } - - tx_desc->data_dir = DATA_READ; -- hdr->read_va = htobe64((uint64_t)tx_desc->data_buff); -+ hdr->read_va = htobe64((intptr_t)tx_desc->data_buff); - hdr->read_stag = htobe32((uint32_t)tx_desc->data_mr->rkey); - hdr->flags |= ISER_RSV; - -@@ -565,7 +566,7 @@ iser_prepare_write_cmd(struct iser_conn *iser_conn, struct iser_pdu *iser_pdu) - - hdr->flags |= ISER_WSV; - hdr->write_stag = htobe32((uint32_t)(tx_desc->data_mr->rkey)); -- hdr->write_va = htobe64((uint64_t)(tx_desc->data_buff)); -+ hdr->write_va = htobe64((intptr_t)(tx_desc->data_buff)); - - return 0; - } -@@ -1146,7 +1147,7 @@ static int iser_handle_wc(struct ibv_wc *wc,struct iser_conn *iser_conn) - wc->wr_id, wc->status, wc->vendor_err); - return iscsi_service_reconnect_if_loggedin(iscsi); - } else { -- iscsi_set_error(iscsi, "flush error: wr id %lx\n", wc->wr_id); -+ iscsi_set_error(iscsi, "flush error: wr id %" PRIx64 "\n", wc->wr_id); - - return 0; - } -diff --git a/test-tool/test_compareandwrite_invalid_dataout_size.c b/test-tool/test_compareandwrite_invalid_dataout_size.c -index b27b4f8..76da1e0 100644 ---- a/test-tool/test_compareandwrite_invalid_dataout_size.c -+++ b/test-tool/test_compareandwrite_invalid_dataout_size.c -@@ -64,7 +64,7 @@ test_compareandwrite_invalid_dataout_size(void) - - - logging(LOG_VERBOSE, "Check too small DataOut"); -- logging(LOG_VERBOSE, "COMPAREANDWRITE with DataOut==%ld (4 blocks) " -+ logging(LOG_VERBOSE, "COMPAREANDWRITE with DataOut==%zd (4 blocks) " - "and TL == 1 ", 4 * block_size); - - new_tl = 1; -@@ -74,7 +74,7 @@ test_compareandwrite_invalid_dataout_size(void) - EXPECT_STATUS_GENERIC_BAD); - - logging(LOG_VERBOSE, "Check too large DataOut"); -- logging(LOG_VERBOSE, "COMPAREANDWRITE with DataOut==%ld (4 blocks) " -+ logging(LOG_VERBOSE, "COMPAREANDWRITE with DataOut==%zd (4 blocks) " - "and TL == 3 ", 4 * block_size); - - new_tl = 2; -diff --git a/test-tool/test_writesame10_invalid_dataout_size.c b/test-tool/test_writesame10_invalid_dataout_size.c -index f521908..119d786 100644 ---- a/test-tool/test_writesame10_invalid_dataout_size.c -+++ b/test-tool/test_writesame10_invalid_dataout_size.c -@@ -41,13 +41,13 @@ test_writesame10_invalid_dataout_size(void) - memset(scratch, 0xa6, block_size); - - logging(LOG_VERBOSE, "Check too small DataOut"); -- logging(LOG_VERBOSE, "Unmap with DataOut==%ld (block_size==%ld)", -+ logging(LOG_VERBOSE, "Unmap with DataOut==%zd (block_size==%zd)", - block_size / 2, block_size); - WRITESAME10(sd, 0, block_size / 2, 1, 0, 1, 0, 0, scratch, - EXPECT_STATUS_GENERIC_BAD); - - logging(LOG_VERBOSE, "Check too large DataOut"); -- logging(LOG_VERBOSE, "Unmap with DataOut==%ld (block_size==%ld)", -+ logging(LOG_VERBOSE, "Unmap with DataOut==%zd (block_size==%zd)", - block_size * 2, block_size); - WRITESAME10(sd, 0, block_size * 2, 1, 0, 1, 0, 0, scratch, - EXPECT_STATUS_GENERIC_BAD); -diff --git a/test-tool/test_writesame16_invalid_dataout_size.c b/test-tool/test_writesame16_invalid_dataout_size.c -index 128673f..a2e22bb 100644 ---- a/test-tool/test_writesame16_invalid_dataout_size.c -+++ b/test-tool/test_writesame16_invalid_dataout_size.c -@@ -41,13 +41,13 @@ test_writesame16_invalid_dataout_size(void) - memset(scratch, 0xa6, block_size); - - logging(LOG_VERBOSE, "Check too small DataOut"); -- logging(LOG_VERBOSE, "Unmap with DataOut==%ld (block_size==%ld)", -+ logging(LOG_VERBOSE, "Unmap with DataOut==%zd (block_size==%zd)", - block_size / 2, block_size); - WRITESAME16(sd, 0, block_size / 2, 1, 0, 1, 0, 0, scratch, - EXPECT_STATUS_GENERIC_BAD); - - logging(LOG_VERBOSE, "Check too large DataOut"); -- logging(LOG_VERBOSE, "Unmap with DataOut==%ld (block_size==%ld)", -+ logging(LOG_VERBOSE, "Unmap with DataOut==%zd (block_size==%zd)", - block_size * 2, block_size); - WRITESAME16(sd, 0, block_size * 2, 1, 0, 1, 0, 0, scratch, - EXPECT_STATUS_GENERIC_BAD); --- -2.13.6 - diff --git a/fix-gcc7-warnings.patch b/fix-gcc7-warnings.patch deleted file mode 100644 index cd7282f..0000000 --- a/fix-gcc7-warnings.patch +++ /dev/null @@ -1,35 +0,0 @@ -upstream commits 854e37aab7d7d2093a0a6620a3257b8f2a1d405c -and fb45f0343e3de45f2bc7516591d36c7466c2184e - -diff --git a/test-tool/iscsi-support.c b/test-tool/iscsi-support.c -index cbadf85..20993d4 100644 ---- a/test-tool/iscsi-support.c -+++ b/test-tool/iscsi-support.c -@@ -2931,16 +2931,17 @@ void populate_ident_tgt_desc(unsigned char *buf, struct scsi_device *dev) - - for (desig = inq_di->designators; desig; desig = desig->next) { - switch (desig->designator_type) { -- case SCSI_DESIGNATOR_TYPE_VENDOR_SPECIFIC: -- case SCSI_DESIGNATOR_TYPE_T10_VENDORT_ID: -- case SCSI_DESIGNATOR_TYPE_EUI_64: -- case SCSI_DESIGNATOR_TYPE_NAA: -- if (prev_type <= desig->designator_type) { -- tgt_desig = desig; -- prev_type = desig->designator_type; -- } -- default: -- continue; -+ case SCSI_DESIGNATOR_TYPE_VENDOR_SPECIFIC: -+ case SCSI_DESIGNATOR_TYPE_T10_VENDORT_ID: -+ case SCSI_DESIGNATOR_TYPE_EUI_64: -+ case SCSI_DESIGNATOR_TYPE_NAA: -+ if (prev_type <= desig->designator_type) { -+ tgt_desig = desig; -+ prev_type = desig->designator_type; -+ } -+ continue; -+ default: -+ continue; - } - } - if (tgt_desig == NULL) { diff --git a/libiscsi.spec b/libiscsi.spec index 2141b14..ffbc907 100644 --- a/libiscsi.spec +++ b/libiscsi.spec @@ -6,10 +6,15 @@ License: LGPLv2+ URL: https://github.com/sahlberg/%{name} Source: https://github.com/sahlberg/%{name}/archive/%{version}.tar.gz -Patch1: disable-ld_iscsi.patch -Patch2: fix-gcc7-warnings.patch -Patch3: fix-32bit-build.patch -Patch4: container_of.patch + +# Fix gcc7 warnings +Patch0001: 0001-Fix-compiler-warning-error-under-gcc7.patch +Patch0002: 0002-Fix-another-compiler-warning.patch +# Fix 32bit build +Patch0003: 0003-Fix-32bit-build.patch +# Fix build with latest rdma-core +# Submitted upstream: https://github.com/sahlberg/libiscsi/pull/265 +Patch0004: 0004-iser-Use-local-container_of-definition.patch BuildRequires: autoconf BuildRequires: automake @@ -50,6 +55,9 @@ rm $RPM_BUILD_ROOT/%{libiscsi_libdir}/libiscsi.la # Remove "*.old" files find $RPM_BUILD_ROOT -name "*.old" -exec rm -f {} \; +# Remove library put in /usr/bin +rm $RPM_BUILD_ROOT/%{_bindir}/ld_iscsi.so + %post -p /sbin/ldconfig %postun -p /sbin/ldconfig