1 #ifndef _LINUX_STDDEF_H
2 #define _LINUX_STDDEF_H
5 #if defined(__cplusplus)
8 #define NULL ((void *)0)
12 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
16 * container_of - cast a member of a structure out to the containing structure
18 * @ptr: the pointer to the member.
19 * @type: the type of the container struct this is embedded in.
20 * @member: the name of the member within the struct.
23 #define container_of(ptr, type, member) ({ \
24 const typeof( ((type *)0)->member ) *__mptr = (ptr); \
25 (type *)( (char *)__mptr - offsetof(type,member) );})
28 * Check at compile time that something is of a particular type.
29 * Always evaluates to 1 so you may use it easily in comparisons.
31 #define typecheck(type,x) \
34 (void)(&__dummy == &__dummy2); \