51f72b8
From: Cole Robinson <crobinso@redhat.com>
51f72b8
Date: Mon, 30 Apr 2018 18:11:05 -0400
51f72b8
Subject: [PATCH] iser: Use local container_of definition
51f72b8
51f72b8
The code was implicitly dependent on container_of from
51f72b8
inifiniband/verbs.h, however that's been removed in rdma-core
51f72b8
latest release:
51f72b8
51f72b8
https://github.com/linux-rdma/rdma-core/commit/ce0274acffc78ed2861a56bdc34cdd3d60c20e1f
51f72b8
51f72b8
Define container_of locally if it's not already defined
51f72b8
51f72b8
(cherry picked from commit f1feb218e2823d236569f0ca3cfad07334f2a304)
51f72b8
---
51f72b8
 lib/iser.c | 14 ++++++++++++++
51f72b8
 1 file changed, 14 insertions(+)
51f72b8
51f72b8
diff --git a/lib/iser.c b/lib/iser.c
51f72b8
index 17832c3..aa7244c 100644
51f72b8
--- a/lib/iser.c
51f72b8
+++ b/lib/iser.c
73b83d8
@@ -32,6 +32,20 @@
73b83d8
 #include <semaphore.h>
73b83d8
 #include <poll.h>
73b83d8
 
73b83d8
+
73b83d8
+#ifndef container_of
73b83d8
+/**
73b83d8
+  * container_of - cast a member of a structure out to the containing structure
73b83d8
+  * @ptr:        the pointer to the member.
73b83d8
+  * @type:       the type of the container struct this is embedded in.
73b83d8
+  * @member:     the name of the member within the struct.
73b83d8
+  *
73b83d8
+ */
73b83d8
+#define container_of(ptr, type, member) \
73b83d8
+    ((type *) ((uint8_t *)(ptr) - offsetof(type, member)))
73b83d8
+#endif
73b83d8
+
73b83d8
+
73b83d8
 #ifdef __linux
73b83d8
 
73b83d8
 static int cq_handle(struct iser_conn *iser_conn);