Merge pull request #265 from crobinso/container_of

iser: Use local container_of definition
This commit is contained in:
Ronnie Sahlberg
2018-05-01 09:23:43 +10:00
committed by GitHub

View File

@@ -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
/* MUST keep in sync with socket.c */