提交 620b117a 编写于 作者: R Romain Vimont

Add container_of() macro

This will allow to get the parent of an embedded struct.
上级 14e83175
......@@ -8,4 +8,7 @@
#define MIN(X,Y) (X) < (Y) ? (X) : (Y)
#define MAX(X,Y) (X) > (Y) ? (X) : (Y)
#define container_of(ptr, type, member) \
((type *) (((char *) (ptr)) - offsetof(type, member)))
#endif
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册