[PATCH rdma-core 3/5] utils: Remove container_of and offset local declarations

Leon Romanovsky
2016-09-25T06:50:05Z

Signed-off-by: Leon Romanovsky <leon-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
---
ibacm/linux/osd.h | 3 ---
libmlx5/src/list.h | 19 -------------------
librdmacm/src/cma.h | 6 ------
3 files changed, 28 deletions(-)

diff --git a/ibacm/linux/osd.h b/ibacm/linux/osd.h
index ec18f7b..1a738e0 100644
--- a/ibacm/linux/osd.h
+++ b/ibacm/linux/osd.h
@@ -55,9 +55,6 @@
#define LIB_DESTRUCTOR __attribute__((destructor))
#define CDECL_FUNC

-#define container_of(ptr, type, field) \
- ((type *) ((void *) ptr - offsetof(type, field)))
-
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define htonll(x) bswap_64(x)
#else
diff --git a/libmlx5/src/list.h b/libmlx5/src/list.h
index cd7d25b..4f96482 100644
--- a/libmlx5/src/list.h
+++ b/libmlx5/src/list.h
@@ -201,25 +201,6 @@ static inline void list_splice_init(struct list_head *list,
}
}

-#ifndef offsetof
-#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
-#endif
-
-/**
- * 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.
- *
- */
-#ifndef container_of
-#define container_of(ptr, type, member) ({ \
- const typeof(((type *)0)->member)*__mptr = (ptr); \
- (type *)((char *)__mptr - offsetof(type, member)); })
-#endif
-
-
/**
* list_entry - get the struct for this entry
* @ptr: the &struct list_head pointer.
diff --git a/librdmacm/src/cma.h b/librdmacm/src/cma.h
index d640688..83d98b0 100644
--- a/librdmacm/src/cma.h
+++ b/librdmacm/src/cma.h
@@ -70,12 +70,6 @@ static inline uint64_t htonll(uint64_t x) { return x; }
static inline uint64_t ntohll(uint64_t x) { return x; }
#endif

-#ifndef container_of
-#define container_of(ptr, type, field) \
- ((type *) ((void *)ptr - offsetof(type, field)))
-#endif
-
-
/*
* Fast synchronization for low contention locking.
*/
--
2.7.4