diff --git a/0029-put-variable-sized-type-at-the-end-of-the-struct.patch b/0029-put-variable-sized-type-at-the-end-of-the-struct.patch new file mode 100644 index 0000000000000000000000000000000000000000..2cc35760c66f1d780ce614fa873032c4466be898 --- /dev/null +++ b/0029-put-variable-sized-type-at-the-end-of-the-struct.patch @@ -0,0 +1,62 @@ +From ebda34abefe39857422d06cc959ceae6bbbab409 Mon Sep 17 00:00:00 2001 +From: yuncang123 <1050706328@qq.com> +Date: Wed, 4 Sep 2024 20:38:45 +0800 +Subject: [PATCH] put variable sized type at the end of the struct or class + +--- + usr/initiator.h | 4 ++-- + usr/mgmt_ipc.h | 2 +- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/usr/initiator.h b/usr/initiator.h +index dbf6f2b..2c2f976 100644 +--- a/usr/initiator.h ++++ b/usr/initiator.h +@@ -183,12 +183,12 @@ struct iscsi_ev_context { + typedef struct queue_task { + iscsi_conn_t *conn; + iscsiadm_req_t req; +- iscsiadm_rsp_t rsp; + int mgmt_ipc_fd; + int allocated : 1; + /* Newer request types include a + * variable-length payload */ + void *payload; ++ iscsiadm_rsp_t rsp; + } queue_task_t; + + struct iscsi_transport_template; +@@ -250,7 +250,6 @@ typedef struct iscsi_session { + /* connection reopens during recovery */ + int reopen_cnt; + int reopen_max; +- queue_task_t reopen_qtask; + iscsi_session_r_stage_e r_stage; + uint32_t replacement_timeout; + +@@ -264,6 +263,7 @@ typedef struct iscsi_session { + * is complete + */ + queue_task_t *notify_qtask; ++ queue_task_t reopen_qtask; + } iscsi_session_t; + + #define INVALID_SESSION_ID (uint32_t)-1 +diff --git a/usr/mgmt_ipc.h b/usr/mgmt_ipc.h +index 55972ed..25a79a4 100644 +--- a/usr/mgmt_ipc.h ++++ b/usr/mgmt_ipc.h +@@ -92,9 +92,9 @@ typedef struct iscsiadm_rsp { + ISCSI_STATS_CUSTOM_MAX) + struct ipc_msg_getstats { + struct iscsi_uevent ev; +- struct iscsi_stats stats; + char custom[sizeof(struct iscsi_stats_custom) * + ISCSI_STATS_CUSTOM_MAX]; ++ struct iscsi_stats stats; + } getstats; + struct ipc_msg_config { + char var[VALUE_MAXLEN]; +-- +2.43.0 + diff --git a/0030-backport-fix-missing-underline-in-iscsid_req.h.patch b/0030-backport-fix-missing-underline-in-iscsid_req.h.patch new file mode 100644 index 0000000000000000000000000000000000000000..d414834743ff32b575f34596df295e97d37a9597 --- /dev/null +++ b/0030-backport-fix-missing-underline-in-iscsid_req.h.patch @@ -0,0 +1,25 @@ +From edf9debf9764eb5173c744d51c42b973a77f636f Mon Sep 17 00:00:00 2001 +From: yuncang123 <1050706328@qq.com> +Date: Thu, 5 Sep 2024 19:45:09 +0800 +Subject: [PATCH] backport fix missing underline in iscsid_req.h + +--- + usr/iscsid_req.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/usr/iscsid_req.h b/usr/iscsid_req.h +index d580ed2..27d58e1 100644 +--- a/usr/iscsid_req.h ++++ b/usr/iscsid_req.h +@@ -19,7 +19,7 @@ + */ + + #ifndef ISCSID_REQ_H_ +-#define ISCSID_REQ_H ++#define ISCSID_REQ_H_ + + #define ISCSID_REQ_TIMEOUT 1000 + +-- +2.43.0 + diff --git a/0030-fix-naming-conflict-of-iscsi_session.patch b/0030-fix-naming-conflict-of-iscsi_session.patch new file mode 100644 index 0000000000000000000000000000000000000000..e348e5b352ce55d787e4fcf206ec6fa341e83e25 --- /dev/null +++ b/0030-fix-naming-conflict-of-iscsi_session.patch @@ -0,0 +1,25 @@ +From d9aef2f27379dd725a31fb31c61e7ebf0d189c94 Mon Sep 17 00:00:00 2001 +From: yuncang123 <1050706328@qq.com> +Date: Wed, 4 Sep 2024 21:16:49 +0800 +Subject: [PATCH] fix naming conflict of iscsi_session + +--- + usr/initiator.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/usr/initiator.h b/usr/initiator.h +index 2c2f976..8f2d083 100644 +--- a/usr/initiator.h ++++ b/usr/initiator.h +@@ -195,7 +195,7 @@ struct iscsi_transport_template; + struct iscsi_transport; + + /* daemon's session structure */ +-typedef struct iscsi_session { ++typedef struct iscsi_session_ { + struct list_head list; + uint32_t id; + uint32_t hostno; +-- +2.43.0 + diff --git a/open-iscsi.spec b/open-iscsi.spec index 74795297e96ea8cba9c3a4c8297d2bb327584cde..aaf9bc7da4063a93583581859d8d39e5f21f82c9 100644 --- a/open-iscsi.spec +++ b/open-iscsi.spec @@ -37,6 +37,7 @@ patch25: 0025-iscsid-iscsiuio-fix-OOM-adjustment-377.patch patch26: 0026-iscsid-clear-scanning-thread-s-PR_SET_IO_FLUSHER-fla.patch patch27: 0027-iscsid-stop-connection-for-recovery-if-error-is-not-.patch patch28: 0028-discoveryd-fix-format-overflow-warning-413.patch +patch30: 0030-backport-fix-missing-underline-in-iscsid_req.h.patch BuildRequires: flex bison doxygen kmod-devel systemd-units gcc git isns-utils-devel systemd-devel BuildRequires: autoconf automake libtool libmount-devel openssl-devel pkg-config @@ -91,7 +92,14 @@ This contains man files for the using of %{name}. perl -i -pe 's|^exec_prefix = /$|exec_prefix = %{_exec_prefix}|' Makefile %build +%if "%toolchain"=="clang" +CFLAGS="%{optflags} -DUSE_KMOD -fPIC -Wno-error=unused-command-line-argument -Wno-error=ignored-attributes -Wno-error=single-bit-bitfield-constant-conversion -Wno-error=unused-but-set-variable -Wno-error=gnu-variable-sized-type-not-at-end" \ +LDFLAGS="%{?__global_ldflags} -lkmod" \ +LIB_DIR=%{_libdir} +%make_build +%else %make_build OPTFLAGS="%{optflags} %{?__global_ldflags} -DUSE_KMOD -lkmod" LIB_DIR=%{_libdir} +%endif %install