Handle missing container_of

libiscsi was implicitly depending on this definition from rdma headers.
Latest rdma headers dropped this though, so we need to define it
locally
This commit is contained in:
Cole Robinson 2018-04-30 17:57:49 -04:00
parent 033f2fc29f
commit 73b83d8607
2 changed files with 31 additions and 2 deletions

25
container_of.patch Normal file
View File

@ -0,0 +1,25 @@
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 <semaphore.h>
#include <poll.h>
+
+#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);

View File

@ -1,7 +1,7 @@
Name: libiscsi
Summary: iSCSI client library
Version: 1.18.0
Release: 3%{?dist}
Release: 4%{?dist}
License: LGPLv2+
URL: https://github.com/sahlberg/%{name}
@ -9,6 +9,7 @@ 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
BuildRequires: autoconf
BuildRequires: automake
@ -97,7 +98,10 @@ The libiscsi-devel package includes the header files for libiscsi.
%{_libdir}/pkgconfig/libiscsi.pc
%changelog
* Fri Mar 23 2018 Cole Robinson <crobinso@redhat.com> - 1.18.0-2
* Mon Apr 30 2018 Cole Robinson <crobinso@redhat.com> - 1.18.0-4
- Fix build with newer rdma-core
* Fri Mar 23 2018 Cole Robinson <crobinso@redhat.com> - 1.18.0-3
- Fix rdma deps and don't restrict archs
- Add --disable-werror to fix gcc8 build (bz #1556044)
- Spec file cleanups (bz #1483290)